001package org.hl7.fhir.r4.formats;
002
003import java.io.IOException;
004
005import org.hl7.fhir.exceptions.FHIRFormatError;
006
007/*-
008 * #%L
009 * org.hl7.fhir.r4
010 * %%
011 * Copyright (C) 2014 - 2019 Health Level 7
012 * %%
013 * Licensed under the Apache License, Version 2.0 (the "License");
014 * you may not use this file except in compliance with the License.
015 * You may obtain a copy of the License at
016 * 
017 *      http://www.apache.org/licenses/LICENSE-2.0
018 * 
019 * Unless required by applicable law or agreed to in writing, software
020 * distributed under the License is distributed on an "AS IS" BASIS,
021 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
022 * See the License for the specific language governing permissions and
023 * limitations under the License.
024 * #L%
025 */
026
027/*
028  Copyright (c) 2011+, HL7, Inc.
029  All rights reserved.
030  
031  Redistribution and use in source and binary forms, with or without modification, 
032  are permitted provided that the following conditions are met:
033  
034   * Redistributions of source code must retain the above copyright notice, this 
035     list of conditions and the following disclaimer.
036   * Redistributions in binary form must reproduce the above copyright notice, 
037     this list of conditions and the following disclaimer in the documentation 
038     and/or other materials provided with the distribution.
039   * Neither the name of HL7 nor the names of its contributors may be used to 
040     endorse or promote products derived from this software without specific 
041     prior written permission.
042  
043  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
044  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
045  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
046  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
047  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
048  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
049  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
050  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
051  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
052  POSSIBILITY OF SUCH DAMAGE.
053  
054*/
055
056// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
057import org.hl7.fhir.r4.model.*;
058import org.hl7.fhir.utilities.Utilities;
059import org.hl7.fhir.utilities.json.JsonTrackingParser.PresentedBigDecimal;
060import org.hl7.fhir.utilities.xhtml.XhtmlNode;
061
062import com.google.gson.JsonArray;
063import com.google.gson.JsonObject;
064
065public class JsonParser extends JsonParserBase {
066
067  public JsonParser() {
068    super();
069  }
070
071  public JsonParser(boolean allowUnknownContent) {
072    super();
073    setAllowUnknownContent(allowUnknownContent);
074  }
075
076
077  protected void parseElementProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
078    super.parseElementProperties(json, element);
079    if (json.has("extension")) {
080      JsonArray array = json.getAsJsonArray("extension");
081      for (int i = 0; i < array.size(); i++) {
082        element.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
083      }
084    };
085  }
086
087  protected void parseBackboneElementProperties(JsonObject json, BackboneElement element) throws IOException, FHIRFormatError {
088    parseElementProperties(json, element);
089    if (json.has("modifierExtension")) {
090      JsonArray array = json.getAsJsonArray("modifierExtension");
091      for (int i = 0; i < array.size(); i++) {
092        element.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
093      }
094    }
095  }
096
097  protected void parseBackboneElementProperties(JsonObject json, BackboneType element) throws IOException, FHIRFormatError {
098    parseElementProperties(json, element);
099    if (json.has("modifierExtension")) {
100      JsonArray array = json.getAsJsonArray("modifierExtension");
101      for (int i = 0; i < array.size(); i++) {
102        element.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
103      }
104    }
105  }
106
107  protected void parseTypeProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
108    parseElementProperties(json, element);
109  }
110
111  @SuppressWarnings("unchecked")
112  protected <E extends Enum<E>> Enumeration<E> parseEnumeration(String s, E item, EnumFactory e) throws IOException, FHIRFormatError {
113    Enumeration<E> res = new Enumeration<E>(e);
114    if (s != null)
115      res.setValue((E) e.fromCode(s));
116    return res;
117  }
118
119  protected DateType parseDate(String v) throws IOException, FHIRFormatError {
120    DateType res = new DateType(v);
121    return res;
122  }
123
124  protected DateTimeType parseDateTime(String v) throws IOException, FHIRFormatError {
125    DateTimeType res = new DateTimeType(v);
126    return res;
127  }
128
129  protected CodeType parseCode(String v) throws IOException, FHIRFormatError {
130    CodeType res = new CodeType(v);
131    return res;
132  }
133
134  protected StringType parseString(String v) throws IOException, FHIRFormatError {
135    StringType res = new StringType(v);
136    return res;
137  }
138
139  protected IntegerType parseInteger(java.lang.Long v) throws IOException, FHIRFormatError {
140    IntegerType res = new IntegerType(v);
141    return res;
142  }
143
144  protected OidType parseOid(String v) throws IOException, FHIRFormatError {
145    OidType res = new OidType(v);
146    return res;
147  }
148
149  protected CanonicalType parseCanonical(String v) throws IOException, FHIRFormatError {
150    CanonicalType res = new CanonicalType(v);
151    return res;
152  }
153
154  protected UriType parseUri(String v) throws IOException, FHIRFormatError {
155    UriType res = new UriType(v);
156    return res;
157  }
158
159  protected UuidType parseUuid(String v) throws IOException, FHIRFormatError {
160    UuidType res = new UuidType(v);
161    return res;
162  }
163
164  protected UrlType parseUrl(String v) throws IOException, FHIRFormatError {
165    UrlType res = new UrlType(v);
166    return res;
167  }
168
169  protected InstantType parseInstant(String v) throws IOException, FHIRFormatError {
170    InstantType res = new InstantType(v);
171    return res;
172  }
173
174  protected BooleanType parseBoolean(java.lang.Boolean v) throws IOException, FHIRFormatError {
175    BooleanType res = new BooleanType(v);
176    return res;
177  }
178
179  protected Base64BinaryType parseBase64Binary(String v) throws IOException, FHIRFormatError {
180    Base64BinaryType res = new Base64BinaryType(v);
181    return res;
182  }
183
184  protected UnsignedIntType parseUnsignedInt(String v) throws IOException, FHIRFormatError {
185    UnsignedIntType res = new UnsignedIntType(v);
186    return res;
187  }
188
189  protected MarkdownType parseMarkdown(String v) throws IOException, FHIRFormatError {
190    MarkdownType res = new MarkdownType(v);
191    return res;
192  }
193
194  protected TimeType parseTime(String v) throws IOException, FHIRFormatError {
195    TimeType res = new TimeType(v);
196    return res;
197  }
198
199  protected IdType parseId(String v) throws IOException, FHIRFormatError {
200    IdType res = new IdType(v);
201    return res;
202  }
203
204  protected PositiveIntType parsePositiveInt(String v) throws IOException, FHIRFormatError {
205    PositiveIntType res = new PositiveIntType(v);
206    return res;
207  }
208
209  protected DecimalType parseDecimal(java.math.BigDecimal v) throws IOException, FHIRFormatError {
210    DecimalType res = new DecimalType(v);
211    if (v instanceof PresentedBigDecimal)
212      res.setRepresentation(((PresentedBigDecimal) v).getPresentation());
213    return res;
214  }
215
216  protected Extension parseExtension(JsonObject json) throws IOException, FHIRFormatError {
217    Extension res = new Extension();
218    parseExtensionProperties(json, res);
219    return res;
220  }
221
222  protected void parseExtensionProperties(JsonObject json, Extension res) throws IOException, FHIRFormatError {
223    parseTypeProperties(json, res);
224    if (json.has("url"))
225      res.setUrlElement(parseUri(json.get("url").getAsString()));
226    if (json.has("_url"))
227      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
228    Type value = parseType("value", json);
229    if (value != null)
230      res.setValue(value);
231  }
232
233  protected Narrative parseNarrative(JsonObject json) throws IOException, FHIRFormatError {
234    Narrative res = new Narrative();
235    parseNarrativeProperties(json, res);
236    return res;
237  }
238
239  protected void parseNarrativeProperties(JsonObject json, Narrative res) throws IOException, FHIRFormatError {
240    parseTypeProperties(json, res);
241    if (json.has("status"))
242      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Narrative.NarrativeStatus.NULL, new Narrative.NarrativeStatusEnumFactory()));
243    if (json.has("_status"))
244      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
245    if (json.has("div"))
246      res.setDiv(parseXhtml(json.get("div").getAsString()));
247  }
248
249  protected Meta parseMeta(JsonObject json) throws IOException, FHIRFormatError {
250    Meta res = new Meta();
251    parseMetaProperties(json, res);
252    return res;
253  }
254
255  protected void parseMetaProperties(JsonObject json, Meta res) throws IOException, FHIRFormatError {
256    parseElementProperties(json, res);
257    if (json.has("versionId"))
258      res.setVersionIdElement(parseId(json.get("versionId").getAsString()));
259    if (json.has("_versionId"))
260      parseElementProperties(json.getAsJsonObject("_versionId"), res.getVersionIdElement());
261    if (json.has("lastUpdated"))
262      res.setLastUpdatedElement(parseInstant(json.get("lastUpdated").getAsString()));
263    if (json.has("_lastUpdated"))
264      parseElementProperties(json.getAsJsonObject("_lastUpdated"), res.getLastUpdatedElement());
265    if (json.has("source"))
266      res.setSourceElement(parseUri(json.get("source").getAsString()));
267    if (json.has("_source"))
268      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
269    if (json.has("profile")) {
270      JsonArray array = json.getAsJsonArray("profile");
271      for (int i = 0; i < array.size(); i++) {
272        res.getProfile().add(parseCanonical(array.get(i).getAsString()));
273      }
274    };
275    if (json.has("_profile")) {
276      JsonArray array = json.getAsJsonArray("_profile");
277      for (int i = 0; i < array.size(); i++) {
278        if (i == res.getProfile().size())
279          res.getProfile().add(parseCanonical(null));
280        if (array.get(i) instanceof JsonObject) 
281          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
282      }
283    };
284    if (json.has("security")) {
285      JsonArray array = json.getAsJsonArray("security");
286      for (int i = 0; i < array.size(); i++) {
287        res.getSecurity().add(parseCoding(array.get(i).getAsJsonObject()));
288      }
289    };
290    if (json.has("tag")) {
291      JsonArray array = json.getAsJsonArray("tag");
292      for (int i = 0; i < array.size(); i++) {
293        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
294      }
295    };
296  }
297
298  protected Address parseAddress(JsonObject json) throws IOException, FHIRFormatError {
299    Address res = new Address();
300    parseAddressProperties(json, res);
301    return res;
302  }
303
304  protected void parseAddressProperties(JsonObject json, Address res) throws IOException, FHIRFormatError {
305    parseTypeProperties(json, res);
306    if (json.has("use"))
307      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Address.AddressUse.NULL, new Address.AddressUseEnumFactory()));
308    if (json.has("_use"))
309      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
310    if (json.has("type"))
311      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Address.AddressType.NULL, new Address.AddressTypeEnumFactory()));
312    if (json.has("_type"))
313      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
314    if (json.has("text"))
315      res.setTextElement(parseString(json.get("text").getAsString()));
316    if (json.has("_text"))
317      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
318    if (json.has("line")) {
319      JsonArray array = json.getAsJsonArray("line");
320      for (int i = 0; i < array.size(); i++) {
321        res.getLine().add(parseString(array.get(i).getAsString()));
322      }
323    };
324    if (json.has("_line")) {
325      JsonArray array = json.getAsJsonArray("_line");
326      for (int i = 0; i < array.size(); i++) {
327        if (i == res.getLine().size())
328          res.getLine().add(parseString(null));
329        if (array.get(i) instanceof JsonObject) 
330          parseElementProperties(array.get(i).getAsJsonObject(), res.getLine().get(i));
331      }
332    };
333    if (json.has("city"))
334      res.setCityElement(parseString(json.get("city").getAsString()));
335    if (json.has("_city"))
336      parseElementProperties(json.getAsJsonObject("_city"), res.getCityElement());
337    if (json.has("district"))
338      res.setDistrictElement(parseString(json.get("district").getAsString()));
339    if (json.has("_district"))
340      parseElementProperties(json.getAsJsonObject("_district"), res.getDistrictElement());
341    if (json.has("state"))
342      res.setStateElement(parseString(json.get("state").getAsString()));
343    if (json.has("_state"))
344      parseElementProperties(json.getAsJsonObject("_state"), res.getStateElement());
345    if (json.has("postalCode"))
346      res.setPostalCodeElement(parseString(json.get("postalCode").getAsString()));
347    if (json.has("_postalCode"))
348      parseElementProperties(json.getAsJsonObject("_postalCode"), res.getPostalCodeElement());
349    if (json.has("country"))
350      res.setCountryElement(parseString(json.get("country").getAsString()));
351    if (json.has("_country"))
352      parseElementProperties(json.getAsJsonObject("_country"), res.getCountryElement());
353    if (json.has("period"))
354      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
355  }
356
357  protected Contributor parseContributor(JsonObject json) throws IOException, FHIRFormatError {
358    Contributor res = new Contributor();
359    parseContributorProperties(json, res);
360    return res;
361  }
362
363  protected void parseContributorProperties(JsonObject json, Contributor res) throws IOException, FHIRFormatError {
364    parseTypeProperties(json, res);
365    if (json.has("type"))
366      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Contributor.ContributorType.NULL, new Contributor.ContributorTypeEnumFactory()));
367    if (json.has("_type"))
368      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
369    if (json.has("name"))
370      res.setNameElement(parseString(json.get("name").getAsString()));
371    if (json.has("_name"))
372      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
373    if (json.has("contact")) {
374      JsonArray array = json.getAsJsonArray("contact");
375      for (int i = 0; i < array.size(); i++) {
376        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
377      }
378    };
379  }
380
381  protected Attachment parseAttachment(JsonObject json) throws IOException, FHIRFormatError {
382    Attachment res = new Attachment();
383    parseAttachmentProperties(json, res);
384    return res;
385  }
386
387  protected void parseAttachmentProperties(JsonObject json, Attachment res) throws IOException, FHIRFormatError {
388    parseTypeProperties(json, res);
389    if (json.has("contentType"))
390      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
391    if (json.has("_contentType"))
392      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
393    if (json.has("language"))
394      res.setLanguageElement(parseCode(json.get("language").getAsString()));
395    if (json.has("_language"))
396      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
397    if (json.has("data"))
398      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
399    if (json.has("_data"))
400      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
401    if (json.has("url"))
402      res.setUrlElement(parseUrl(json.get("url").getAsString()));
403    if (json.has("_url"))
404      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
405    if (json.has("size"))
406      res.setSizeElement(parseUnsignedInt(json.get("size").getAsString()));
407    if (json.has("_size"))
408      parseElementProperties(json.getAsJsonObject("_size"), res.getSizeElement());
409    if (json.has("hash"))
410      res.setHashElement(parseBase64Binary(json.get("hash").getAsString()));
411    if (json.has("_hash"))
412      parseElementProperties(json.getAsJsonObject("_hash"), res.getHashElement());
413    if (json.has("title"))
414      res.setTitleElement(parseString(json.get("title").getAsString()));
415    if (json.has("_title"))
416      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
417    if (json.has("creation"))
418      res.setCreationElement(parseDateTime(json.get("creation").getAsString()));
419    if (json.has("_creation"))
420      parseElementProperties(json.getAsJsonObject("_creation"), res.getCreationElement());
421  }
422
423  protected Count parseCount(JsonObject json) throws IOException, FHIRFormatError {
424    Count res = new Count();
425    parseCountProperties(json, res);
426    return res;
427  }
428
429  protected void parseCountProperties(JsonObject json, Count res) throws IOException, FHIRFormatError {
430    parseQuantityProperties(json, res);
431  }
432
433  protected DataRequirement parseDataRequirement(JsonObject json) throws IOException, FHIRFormatError {
434    DataRequirement res = new DataRequirement();
435    parseDataRequirementProperties(json, res);
436    return res;
437  }
438
439  protected void parseDataRequirementProperties(JsonObject json, DataRequirement res) throws IOException, FHIRFormatError {
440    parseTypeProperties(json, res);
441    if (json.has("type"))
442      res.setTypeElement(parseCode(json.get("type").getAsString()));
443    if (json.has("_type"))
444      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
445    if (json.has("profile")) {
446      JsonArray array = json.getAsJsonArray("profile");
447      for (int i = 0; i < array.size(); i++) {
448        res.getProfile().add(parseCanonical(array.get(i).getAsString()));
449      }
450    };
451    if (json.has("_profile")) {
452      JsonArray array = json.getAsJsonArray("_profile");
453      for (int i = 0; i < array.size(); i++) {
454        if (i == res.getProfile().size())
455          res.getProfile().add(parseCanonical(null));
456        if (array.get(i) instanceof JsonObject) 
457          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
458      }
459    };
460    Type subject = parseType("subject", json);
461    if (subject != null)
462      res.setSubject(subject);
463    if (json.has("mustSupport")) {
464      JsonArray array = json.getAsJsonArray("mustSupport");
465      for (int i = 0; i < array.size(); i++) {
466        res.getMustSupport().add(parseString(array.get(i).getAsString()));
467      }
468    };
469    if (json.has("_mustSupport")) {
470      JsonArray array = json.getAsJsonArray("_mustSupport");
471      for (int i = 0; i < array.size(); i++) {
472        if (i == res.getMustSupport().size())
473          res.getMustSupport().add(parseString(null));
474        if (array.get(i) instanceof JsonObject) 
475          parseElementProperties(array.get(i).getAsJsonObject(), res.getMustSupport().get(i));
476      }
477    };
478    if (json.has("codeFilter")) {
479      JsonArray array = json.getAsJsonArray("codeFilter");
480      for (int i = 0; i < array.size(); i++) {
481        res.getCodeFilter().add(parseDataRequirementDataRequirementCodeFilterComponent(array.get(i).getAsJsonObject(), res));
482      }
483    };
484    if (json.has("dateFilter")) {
485      JsonArray array = json.getAsJsonArray("dateFilter");
486      for (int i = 0; i < array.size(); i++) {
487        res.getDateFilter().add(parseDataRequirementDataRequirementDateFilterComponent(array.get(i).getAsJsonObject(), res));
488      }
489    };
490    if (json.has("limit"))
491      res.setLimitElement(parsePositiveInt(json.get("limit").getAsString()));
492    if (json.has("_limit"))
493      parseElementProperties(json.getAsJsonObject("_limit"), res.getLimitElement());
494    if (json.has("sort")) {
495      JsonArray array = json.getAsJsonArray("sort");
496      for (int i = 0; i < array.size(); i++) {
497        res.getSort().add(parseDataRequirementDataRequirementSortComponent(array.get(i).getAsJsonObject(), res));
498      }
499    };
500  }
501
502  protected DataRequirement.DataRequirementCodeFilterComponent parseDataRequirementDataRequirementCodeFilterComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
503    DataRequirement.DataRequirementCodeFilterComponent res = new DataRequirement.DataRequirementCodeFilterComponent();
504    parseDataRequirementDataRequirementCodeFilterComponentProperties(json, owner, res);
505    return res;
506  }
507
508  protected void parseDataRequirementDataRequirementCodeFilterComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementCodeFilterComponent res) throws IOException, FHIRFormatError {
509    parseTypeProperties(json, res);
510    if (json.has("path"))
511      res.setPathElement(parseString(json.get("path").getAsString()));
512    if (json.has("_path"))
513      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
514    if (json.has("searchParam"))
515      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
516    if (json.has("_searchParam"))
517      parseElementProperties(json.getAsJsonObject("_searchParam"), res.getSearchParamElement());
518    if (json.has("valueSet"))
519      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
520    if (json.has("_valueSet"))
521      parseElementProperties(json.getAsJsonObject("_valueSet"), res.getValueSetElement());
522    if (json.has("code")) {
523      JsonArray array = json.getAsJsonArray("code");
524      for (int i = 0; i < array.size(); i++) {
525        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
526      }
527    };
528  }
529
530  protected DataRequirement.DataRequirementDateFilterComponent parseDataRequirementDataRequirementDateFilterComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
531    DataRequirement.DataRequirementDateFilterComponent res = new DataRequirement.DataRequirementDateFilterComponent();
532    parseDataRequirementDataRequirementDateFilterComponentProperties(json, owner, res);
533    return res;
534  }
535
536  protected void parseDataRequirementDataRequirementDateFilterComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementDateFilterComponent res) throws IOException, FHIRFormatError {
537    parseTypeProperties(json, res);
538    if (json.has("path"))
539      res.setPathElement(parseString(json.get("path").getAsString()));
540    if (json.has("_path"))
541      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
542    if (json.has("searchParam"))
543      res.setSearchParamElement(parseString(json.get("searchParam").getAsString()));
544    if (json.has("_searchParam"))
545      parseElementProperties(json.getAsJsonObject("_searchParam"), res.getSearchParamElement());
546    Type value = parseType("value", json);
547    if (value != null)
548      res.setValue(value);
549  }
550
551  protected DataRequirement.DataRequirementSortComponent parseDataRequirementDataRequirementSortComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
552    DataRequirement.DataRequirementSortComponent res = new DataRequirement.DataRequirementSortComponent();
553    parseDataRequirementDataRequirementSortComponentProperties(json, owner, res);
554    return res;
555  }
556
557  protected void parseDataRequirementDataRequirementSortComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementSortComponent res) throws IOException, FHIRFormatError {
558    parseTypeProperties(json, res);
559    if (json.has("path"))
560      res.setPathElement(parseString(json.get("path").getAsString()));
561    if (json.has("_path"))
562      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
563    if (json.has("direction"))
564      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), DataRequirement.SortDirection.NULL, new DataRequirement.SortDirectionEnumFactory()));
565    if (json.has("_direction"))
566      parseElementProperties(json.getAsJsonObject("_direction"), res.getDirectionElement());
567  }
568
569  protected Dosage parseDosage(JsonObject json) throws IOException, FHIRFormatError {
570    Dosage res = new Dosage();
571    parseDosageProperties(json, res);
572    return res;
573  }
574
575  protected void parseDosageProperties(JsonObject json, Dosage res) throws IOException, FHIRFormatError {
576    parseBackboneElementProperties(json, res);
577    if (json.has("sequence"))
578      res.setSequenceElement(parseInteger(json.get("sequence").getAsLong()));
579    if (json.has("_sequence"))
580      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
581    if (json.has("text"))
582      res.setTextElement(parseString(json.get("text").getAsString()));
583    if (json.has("_text"))
584      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
585    if (json.has("additionalInstruction")) {
586      JsonArray array = json.getAsJsonArray("additionalInstruction");
587      for (int i = 0; i < array.size(); i++) {
588        res.getAdditionalInstruction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
589      }
590    };
591    if (json.has("patientInstruction"))
592      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
593    if (json.has("_patientInstruction"))
594      parseElementProperties(json.getAsJsonObject("_patientInstruction"), res.getPatientInstructionElement());
595    if (json.has("timing"))
596      res.setTiming(parseTiming(json.getAsJsonObject("timing")));
597    Type asNeeded = parseType("asNeeded", json);
598    if (asNeeded != null)
599      res.setAsNeeded(asNeeded);
600    if (json.has("site"))
601      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
602    if (json.has("route"))
603      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
604    if (json.has("method"))
605      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
606    if (json.has("doseAndRate")) {
607      JsonArray array = json.getAsJsonArray("doseAndRate");
608      for (int i = 0; i < array.size(); i++) {
609        res.getDoseAndRate().add(parseDosageDosageDoseAndRateComponent(array.get(i).getAsJsonObject(), res));
610      }
611    };
612    if (json.has("maxDosePerPeriod"))
613      res.setMaxDosePerPeriod(parseRatio(json.getAsJsonObject("maxDosePerPeriod")));
614    if (json.has("maxDosePerAdministration"))
615      res.setMaxDosePerAdministration(parseQuantity(json.getAsJsonObject("maxDosePerAdministration")));
616    if (json.has("maxDosePerLifetime"))
617      res.setMaxDosePerLifetime(parseQuantity(json.getAsJsonObject("maxDosePerLifetime")));
618  }
619
620  protected Dosage.DosageDoseAndRateComponent parseDosageDosageDoseAndRateComponent(JsonObject json, Dosage owner) throws IOException, FHIRFormatError {
621    Dosage.DosageDoseAndRateComponent res = new Dosage.DosageDoseAndRateComponent();
622    parseDosageDosageDoseAndRateComponentProperties(json, owner, res);
623    return res;
624  }
625
626  protected void parseDosageDosageDoseAndRateComponentProperties(JsonObject json, Dosage owner, Dosage.DosageDoseAndRateComponent res) throws IOException, FHIRFormatError {
627    parseTypeProperties(json, res);
628    if (json.has("type"))
629      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
630    Type dose = parseType("dose", json);
631    if (dose != null)
632      res.setDose(dose);
633    Type rate = parseType("rate", json);
634    if (rate != null)
635      res.setRate(rate);
636  }
637
638  protected Money parseMoney(JsonObject json) throws IOException, FHIRFormatError {
639    Money res = new Money();
640    parseMoneyProperties(json, res);
641    return res;
642  }
643
644  protected void parseMoneyProperties(JsonObject json, Money res) throws IOException, FHIRFormatError {
645    parseTypeProperties(json, res);
646    if (json.has("value"))
647      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
648    if (json.has("_value"))
649      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
650    if (json.has("currency"))
651      res.setCurrencyElement(parseCode(json.get("currency").getAsString()));
652    if (json.has("_currency"))
653      parseElementProperties(json.getAsJsonObject("_currency"), res.getCurrencyElement());
654  }
655
656  protected HumanName parseHumanName(JsonObject json) throws IOException, FHIRFormatError {
657    HumanName res = new HumanName();
658    parseHumanNameProperties(json, res);
659    return res;
660  }
661
662  protected void parseHumanNameProperties(JsonObject json, HumanName res) throws IOException, FHIRFormatError {
663    parseTypeProperties(json, res);
664    if (json.has("use"))
665      res.setUseElement(parseEnumeration(json.get("use").getAsString(), HumanName.NameUse.NULL, new HumanName.NameUseEnumFactory()));
666    if (json.has("_use"))
667      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
668    if (json.has("text"))
669      res.setTextElement(parseString(json.get("text").getAsString()));
670    if (json.has("_text"))
671      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
672    if (json.has("family"))
673      res.setFamilyElement(parseString(json.get("family").getAsString()));
674    if (json.has("_family"))
675      parseElementProperties(json.getAsJsonObject("_family"), res.getFamilyElement());
676    if (json.has("given")) {
677      JsonArray array = json.getAsJsonArray("given");
678      for (int i = 0; i < array.size(); i++) {
679        res.getGiven().add(parseString(array.get(i).getAsString()));
680      }
681    };
682    if (json.has("_given")) {
683      JsonArray array = json.getAsJsonArray("_given");
684      for (int i = 0; i < array.size(); i++) {
685        if (i == res.getGiven().size())
686          res.getGiven().add(parseString(null));
687        if (array.get(i) instanceof JsonObject) 
688          parseElementProperties(array.get(i).getAsJsonObject(), res.getGiven().get(i));
689      }
690    };
691    if (json.has("prefix")) {
692      JsonArray array = json.getAsJsonArray("prefix");
693      for (int i = 0; i < array.size(); i++) {
694        res.getPrefix().add(parseString(array.get(i).getAsString()));
695      }
696    };
697    if (json.has("_prefix")) {
698      JsonArray array = json.getAsJsonArray("_prefix");
699      for (int i = 0; i < array.size(); i++) {
700        if (i == res.getPrefix().size())
701          res.getPrefix().add(parseString(null));
702        if (array.get(i) instanceof JsonObject) 
703          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrefix().get(i));
704      }
705    };
706    if (json.has("suffix")) {
707      JsonArray array = json.getAsJsonArray("suffix");
708      for (int i = 0; i < array.size(); i++) {
709        res.getSuffix().add(parseString(array.get(i).getAsString()));
710      }
711    };
712    if (json.has("_suffix")) {
713      JsonArray array = json.getAsJsonArray("_suffix");
714      for (int i = 0; i < array.size(); i++) {
715        if (i == res.getSuffix().size())
716          res.getSuffix().add(parseString(null));
717        if (array.get(i) instanceof JsonObject) 
718          parseElementProperties(array.get(i).getAsJsonObject(), res.getSuffix().get(i));
719      }
720    };
721    if (json.has("period"))
722      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
723  }
724
725  protected ContactPoint parseContactPoint(JsonObject json) throws IOException, FHIRFormatError {
726    ContactPoint res = new ContactPoint();
727    parseContactPointProperties(json, res);
728    return res;
729  }
730
731  protected void parseContactPointProperties(JsonObject json, ContactPoint res) throws IOException, FHIRFormatError {
732    parseTypeProperties(json, res);
733    if (json.has("system"))
734      res.setSystemElement(parseEnumeration(json.get("system").getAsString(), ContactPoint.ContactPointSystem.NULL, new ContactPoint.ContactPointSystemEnumFactory()));
735    if (json.has("_system"))
736      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
737    if (json.has("value"))
738      res.setValueElement(parseString(json.get("value").getAsString()));
739    if (json.has("_value"))
740      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
741    if (json.has("use"))
742      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ContactPoint.ContactPointUse.NULL, new ContactPoint.ContactPointUseEnumFactory()));
743    if (json.has("_use"))
744      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
745    if (json.has("rank"))
746      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
747    if (json.has("_rank"))
748      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
749    if (json.has("period"))
750      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
751  }
752
753  protected MarketingStatus parseMarketingStatus(JsonObject json) throws IOException, FHIRFormatError {
754    MarketingStatus res = new MarketingStatus();
755    parseMarketingStatusProperties(json, res);
756    return res;
757  }
758
759  protected void parseMarketingStatusProperties(JsonObject json, MarketingStatus res) throws IOException, FHIRFormatError {
760    parseBackboneElementProperties(json, res);
761    if (json.has("country"))
762      res.setCountry(parseCodeableConcept(json.getAsJsonObject("country")));
763    if (json.has("jurisdiction"))
764      res.setJurisdiction(parseCodeableConcept(json.getAsJsonObject("jurisdiction")));
765    if (json.has("status"))
766      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
767    if (json.has("dateRange"))
768      res.setDateRange(parsePeriod(json.getAsJsonObject("dateRange")));
769    if (json.has("restoreDate"))
770      res.setRestoreDateElement(parseDateTime(json.get("restoreDate").getAsString()));
771    if (json.has("_restoreDate"))
772      parseElementProperties(json.getAsJsonObject("_restoreDate"), res.getRestoreDateElement());
773  }
774
775  protected Identifier parseIdentifier(JsonObject json) throws IOException, FHIRFormatError {
776    Identifier res = new Identifier();
777    parseIdentifierProperties(json, res);
778    return res;
779  }
780
781  protected void parseIdentifierProperties(JsonObject json, Identifier res) throws IOException, FHIRFormatError {
782    parseTypeProperties(json, res);
783    if (json.has("use"))
784      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Identifier.IdentifierUse.NULL, new Identifier.IdentifierUseEnumFactory()));
785    if (json.has("_use"))
786      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
787    if (json.has("type"))
788      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
789    if (json.has("system"))
790      res.setSystemElement(parseUri(json.get("system").getAsString()));
791    if (json.has("_system"))
792      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
793    if (json.has("value"))
794      res.setValueElement(parseString(json.get("value").getAsString()));
795    if (json.has("_value"))
796      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
797    if (json.has("period"))
798      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
799    if (json.has("assigner"))
800      res.setAssigner(parseReference(json.getAsJsonObject("assigner")));
801  }
802
803  protected SubstanceAmount parseSubstanceAmount(JsonObject json) throws IOException, FHIRFormatError {
804    SubstanceAmount res = new SubstanceAmount();
805    parseSubstanceAmountProperties(json, res);
806    return res;
807  }
808
809  protected void parseSubstanceAmountProperties(JsonObject json, SubstanceAmount res) throws IOException, FHIRFormatError {
810    parseBackboneElementProperties(json, res);
811    Type amount = parseType("amount", json);
812    if (amount != null)
813      res.setAmount(amount);
814    if (json.has("amountType"))
815      res.setAmountType(parseCodeableConcept(json.getAsJsonObject("amountType")));
816    if (json.has("amountText"))
817      res.setAmountTextElement(parseString(json.get("amountText").getAsString()));
818    if (json.has("_amountText"))
819      parseElementProperties(json.getAsJsonObject("_amountText"), res.getAmountTextElement());
820    if (json.has("referenceRange"))
821      res.setReferenceRange(parseSubstanceAmountSubstanceAmountReferenceRangeComponent(json.getAsJsonObject("referenceRange"), res));
822  }
823
824  protected SubstanceAmount.SubstanceAmountReferenceRangeComponent parseSubstanceAmountSubstanceAmountReferenceRangeComponent(JsonObject json, SubstanceAmount owner) throws IOException, FHIRFormatError {
825    SubstanceAmount.SubstanceAmountReferenceRangeComponent res = new SubstanceAmount.SubstanceAmountReferenceRangeComponent();
826    parseSubstanceAmountSubstanceAmountReferenceRangeComponentProperties(json, owner, res);
827    return res;
828  }
829
830  protected void parseSubstanceAmountSubstanceAmountReferenceRangeComponentProperties(JsonObject json, SubstanceAmount owner, SubstanceAmount.SubstanceAmountReferenceRangeComponent res) throws IOException, FHIRFormatError {
831    parseTypeProperties(json, res);
832    if (json.has("lowLimit"))
833      res.setLowLimit(parseQuantity(json.getAsJsonObject("lowLimit")));
834    if (json.has("highLimit"))
835      res.setHighLimit(parseQuantity(json.getAsJsonObject("highLimit")));
836  }
837
838  protected Coding parseCoding(JsonObject json) throws IOException, FHIRFormatError {
839    Coding res = new Coding();
840    parseCodingProperties(json, res);
841    return res;
842  }
843
844  protected void parseCodingProperties(JsonObject json, Coding res) throws IOException, FHIRFormatError {
845    parseTypeProperties(json, res);
846    if (json.has("system"))
847      res.setSystemElement(parseUri(json.get("system").getAsString()));
848    if (json.has("_system"))
849      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
850    if (json.has("version"))
851      res.setVersionElement(parseString(json.get("version").getAsString()));
852    if (json.has("_version"))
853      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
854    if (json.has("code"))
855      res.setCodeElement(parseCode(json.get("code").getAsString()));
856    if (json.has("_code"))
857      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
858    if (json.has("display"))
859      res.setDisplayElement(parseString(json.get("display").getAsString()));
860    if (json.has("_display"))
861      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
862    if (json.has("userSelected"))
863      res.setUserSelectedElement(parseBoolean(json.get("userSelected").getAsBoolean()));
864    if (json.has("_userSelected"))
865      parseElementProperties(json.getAsJsonObject("_userSelected"), res.getUserSelectedElement());
866  }
867
868  protected SampledData parseSampledData(JsonObject json) throws IOException, FHIRFormatError {
869    SampledData res = new SampledData();
870    parseSampledDataProperties(json, res);
871    return res;
872  }
873
874  protected void parseSampledDataProperties(JsonObject json, SampledData res) throws IOException, FHIRFormatError {
875    parseTypeProperties(json, res);
876    if (json.has("origin"))
877      res.setOrigin(parseQuantity(json.getAsJsonObject("origin")));
878    if (json.has("period"))
879      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
880    if (json.has("_period"))
881      parseElementProperties(json.getAsJsonObject("_period"), res.getPeriodElement());
882    if (json.has("factor"))
883      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
884    if (json.has("_factor"))
885      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
886    if (json.has("lowerLimit"))
887      res.setLowerLimitElement(parseDecimal(json.get("lowerLimit").getAsBigDecimal()));
888    if (json.has("_lowerLimit"))
889      parseElementProperties(json.getAsJsonObject("_lowerLimit"), res.getLowerLimitElement());
890    if (json.has("upperLimit"))
891      res.setUpperLimitElement(parseDecimal(json.get("upperLimit").getAsBigDecimal()));
892    if (json.has("_upperLimit"))
893      parseElementProperties(json.getAsJsonObject("_upperLimit"), res.getUpperLimitElement());
894    if (json.has("dimensions"))
895      res.setDimensionsElement(parsePositiveInt(json.get("dimensions").getAsString()));
896    if (json.has("_dimensions"))
897      parseElementProperties(json.getAsJsonObject("_dimensions"), res.getDimensionsElement());
898    if (json.has("data"))
899      res.setDataElement(parseString(json.get("data").getAsString()));
900    if (json.has("_data"))
901      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
902  }
903
904  protected Population parsePopulation(JsonObject json) throws IOException, FHIRFormatError {
905    Population res = new Population();
906    parsePopulationProperties(json, res);
907    return res;
908  }
909
910  protected void parsePopulationProperties(JsonObject json, Population res) throws IOException, FHIRFormatError {
911    parseBackboneElementProperties(json, res);
912    Type age = parseType("age", json);
913    if (age != null)
914      res.setAge(age);
915    if (json.has("gender"))
916      res.setGender(parseCodeableConcept(json.getAsJsonObject("gender")));
917    if (json.has("race"))
918      res.setRace(parseCodeableConcept(json.getAsJsonObject("race")));
919    if (json.has("physiologicalCondition"))
920      res.setPhysiologicalCondition(parseCodeableConcept(json.getAsJsonObject("physiologicalCondition")));
921  }
922
923  protected Ratio parseRatio(JsonObject json) throws IOException, FHIRFormatError {
924    Ratio res = new Ratio();
925    parseRatioProperties(json, res);
926    return res;
927  }
928
929  protected void parseRatioProperties(JsonObject json, Ratio res) throws IOException, FHIRFormatError {
930    parseTypeProperties(json, res);
931    if (json.has("numerator"))
932      res.setNumerator(parseQuantity(json.getAsJsonObject("numerator")));
933    if (json.has("denominator"))
934      res.setDenominator(parseQuantity(json.getAsJsonObject("denominator")));
935  }
936
937  protected Distance parseDistance(JsonObject json) throws IOException, FHIRFormatError {
938    Distance res = new Distance();
939    parseDistanceProperties(json, res);
940    return res;
941  }
942
943  protected void parseDistanceProperties(JsonObject json, Distance res) throws IOException, FHIRFormatError {
944    parseQuantityProperties(json, res);
945  }
946
947  protected Age parseAge(JsonObject json) throws IOException, FHIRFormatError {
948    Age res = new Age();
949    parseAgeProperties(json, res);
950    return res;
951  }
952
953  protected void parseAgeProperties(JsonObject json, Age res) throws IOException, FHIRFormatError {
954    parseQuantityProperties(json, res);
955  }
956
957  protected Reference parseReference(JsonObject json) throws IOException, FHIRFormatError {
958    Reference res = new Reference();
959    parseReferenceProperties(json, res);
960    return res;
961  }
962
963  protected void parseReferenceProperties(JsonObject json, Reference res) throws IOException, FHIRFormatError {
964    parseTypeProperties(json, res);
965    if (json.has("reference"))
966      res.setReferenceElement(parseString(json.get("reference").getAsString()));
967    if (json.has("_reference"))
968      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
969    if (json.has("type"))
970      res.setTypeElement(parseUri(json.get("type").getAsString()));
971    if (json.has("_type"))
972      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
973    if (json.has("identifier"))
974      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
975    if (json.has("display"))
976      res.setDisplayElement(parseString(json.get("display").getAsString()));
977    if (json.has("_display"))
978      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
979  }
980
981  protected TriggerDefinition parseTriggerDefinition(JsonObject json) throws IOException, FHIRFormatError {
982    TriggerDefinition res = new TriggerDefinition();
983    parseTriggerDefinitionProperties(json, res);
984    return res;
985  }
986
987  protected void parseTriggerDefinitionProperties(JsonObject json, TriggerDefinition res) throws IOException, FHIRFormatError {
988    parseTypeProperties(json, res);
989    if (json.has("type"))
990      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TriggerDefinition.TriggerType.NULL, new TriggerDefinition.TriggerTypeEnumFactory()));
991    if (json.has("_type"))
992      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
993    if (json.has("name"))
994      res.setNameElement(parseString(json.get("name").getAsString()));
995    if (json.has("_name"))
996      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
997    Type timing = parseType("timing", json);
998    if (timing != null)
999      res.setTiming(timing);
1000    if (json.has("data")) {
1001      JsonArray array = json.getAsJsonArray("data");
1002      for (int i = 0; i < array.size(); i++) {
1003        res.getData().add(parseDataRequirement(array.get(i).getAsJsonObject()));
1004      }
1005    };
1006    if (json.has("condition"))
1007      res.setCondition(parseExpression(json.getAsJsonObject("condition")));
1008  }
1009
1010  protected Quantity parseQuantity(JsonObject json) throws IOException, FHIRFormatError {
1011    Quantity res = new Quantity();
1012    parseQuantityProperties(json, res);
1013    return res;
1014  }
1015
1016  protected void parseQuantityProperties(JsonObject json, Quantity res) throws IOException, FHIRFormatError {
1017    parseTypeProperties(json, res);
1018    if (json.has("value"))
1019      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
1020    if (json.has("_value"))
1021      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
1022    if (json.has("comparator"))
1023      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
1024    if (json.has("_comparator"))
1025      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
1026    if (json.has("unit"))
1027      res.setUnitElement(parseString(json.get("unit").getAsString()));
1028    if (json.has("_unit"))
1029      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
1030    if (json.has("system"))
1031      res.setSystemElement(parseUri(json.get("system").getAsString()));
1032    if (json.has("_system"))
1033      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
1034    if (json.has("code"))
1035      res.setCodeElement(parseCode(json.get("code").getAsString()));
1036    if (json.has("_code"))
1037      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
1038  }
1039
1040  protected Period parsePeriod(JsonObject json) throws IOException, FHIRFormatError {
1041    Period res = new Period();
1042    parsePeriodProperties(json, res);
1043    return res;
1044  }
1045
1046  protected void parsePeriodProperties(JsonObject json, Period res) throws IOException, FHIRFormatError {
1047    parseTypeProperties(json, res);
1048    if (json.has("start"))
1049      res.setStartElement(parseDateTime(json.get("start").getAsString()));
1050    if (json.has("_start"))
1051      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
1052    if (json.has("end"))
1053      res.setEndElement(parseDateTime(json.get("end").getAsString()));
1054    if (json.has("_end"))
1055      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
1056  }
1057
1058  protected Duration parseDuration(JsonObject json) throws IOException, FHIRFormatError {
1059    Duration res = new Duration();
1060    parseDurationProperties(json, res);
1061    return res;
1062  }
1063
1064  protected void parseDurationProperties(JsonObject json, Duration res) throws IOException, FHIRFormatError {
1065    parseQuantityProperties(json, res);
1066  }
1067
1068  protected Range parseRange(JsonObject json) throws IOException, FHIRFormatError {
1069    Range res = new Range();
1070    parseRangeProperties(json, res);
1071    return res;
1072  }
1073
1074  protected void parseRangeProperties(JsonObject json, Range res) throws IOException, FHIRFormatError {
1075    parseTypeProperties(json, res);
1076    if (json.has("low"))
1077      res.setLow(parseQuantity(json.getAsJsonObject("low")));
1078    if (json.has("high"))
1079      res.setHigh(parseQuantity(json.getAsJsonObject("high")));
1080  }
1081
1082  protected RelatedArtifact parseRelatedArtifact(JsonObject json) throws IOException, FHIRFormatError {
1083    RelatedArtifact res = new RelatedArtifact();
1084    parseRelatedArtifactProperties(json, res);
1085    return res;
1086  }
1087
1088  protected void parseRelatedArtifactProperties(JsonObject json, RelatedArtifact res) throws IOException, FHIRFormatError {
1089    parseTypeProperties(json, res);
1090    if (json.has("type"))
1091      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), RelatedArtifact.RelatedArtifactType.NULL, new RelatedArtifact.RelatedArtifactTypeEnumFactory()));
1092    if (json.has("_type"))
1093      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1094    if (json.has("label"))
1095      res.setLabelElement(parseString(json.get("label").getAsString()));
1096    if (json.has("_label"))
1097      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
1098    if (json.has("display"))
1099      res.setDisplayElement(parseString(json.get("display").getAsString()));
1100    if (json.has("_display"))
1101      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
1102    if (json.has("citation"))
1103      res.setCitationElement(parseMarkdown(json.get("citation").getAsString()));
1104    if (json.has("_citation"))
1105      parseElementProperties(json.getAsJsonObject("_citation"), res.getCitationElement());
1106    if (json.has("url"))
1107      res.setUrlElement(parseUrl(json.get("url").getAsString()));
1108    if (json.has("_url"))
1109      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
1110    if (json.has("document"))
1111      res.setDocument(parseAttachment(json.getAsJsonObject("document")));
1112    if (json.has("resource"))
1113      res.setResourceElement(parseCanonical(json.get("resource").getAsString()));
1114    if (json.has("_resource"))
1115      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
1116  }
1117
1118  protected Annotation parseAnnotation(JsonObject json) throws IOException, FHIRFormatError {
1119    Annotation res = new Annotation();
1120    parseAnnotationProperties(json, res);
1121    return res;
1122  }
1123
1124  protected void parseAnnotationProperties(JsonObject json, Annotation res) throws IOException, FHIRFormatError {
1125    parseTypeProperties(json, res);
1126    Type author = parseType("author", json);
1127    if (author != null)
1128      res.setAuthor(author);
1129    if (json.has("time"))
1130      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
1131    if (json.has("_time"))
1132      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
1133    if (json.has("text"))
1134      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
1135    if (json.has("_text"))
1136      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
1137  }
1138
1139  protected ProductShelfLife parseProductShelfLife(JsonObject json) throws IOException, FHIRFormatError {
1140    ProductShelfLife res = new ProductShelfLife();
1141    parseProductShelfLifeProperties(json, res);
1142    return res;
1143  }
1144
1145  protected void parseProductShelfLifeProperties(JsonObject json, ProductShelfLife res) throws IOException, FHIRFormatError {
1146    parseBackboneElementProperties(json, res);
1147    if (json.has("identifier"))
1148      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
1149    if (json.has("type"))
1150      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
1151    if (json.has("period"))
1152      res.setPeriod(parseQuantity(json.getAsJsonObject("period")));
1153    if (json.has("specialPrecautionsForStorage")) {
1154      JsonArray array = json.getAsJsonArray("specialPrecautionsForStorage");
1155      for (int i = 0; i < array.size(); i++) {
1156        res.getSpecialPrecautionsForStorage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1157      }
1158    };
1159  }
1160
1161  protected ContactDetail parseContactDetail(JsonObject json) throws IOException, FHIRFormatError {
1162    ContactDetail res = new ContactDetail();
1163    parseContactDetailProperties(json, res);
1164    return res;
1165  }
1166
1167  protected void parseContactDetailProperties(JsonObject json, ContactDetail res) throws IOException, FHIRFormatError {
1168    parseTypeProperties(json, res);
1169    if (json.has("name"))
1170      res.setNameElement(parseString(json.get("name").getAsString()));
1171    if (json.has("_name"))
1172      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1173    if (json.has("telecom")) {
1174      JsonArray array = json.getAsJsonArray("telecom");
1175      for (int i = 0; i < array.size(); i++) {
1176        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
1177      }
1178    };
1179  }
1180
1181  protected UsageContext parseUsageContext(JsonObject json) throws IOException, FHIRFormatError {
1182    UsageContext res = new UsageContext();
1183    parseUsageContextProperties(json, res);
1184    return res;
1185  }
1186
1187  protected void parseUsageContextProperties(JsonObject json, UsageContext res) throws IOException, FHIRFormatError {
1188    parseTypeProperties(json, res);
1189    if (json.has("code"))
1190      res.setCode(parseCoding(json.getAsJsonObject("code")));
1191    Type value = parseType("value", json);
1192    if (value != null)
1193      res.setValue(value);
1194  }
1195
1196  protected Expression parseExpression(JsonObject json) throws IOException, FHIRFormatError {
1197    Expression res = new Expression();
1198    parseExpressionProperties(json, res);
1199    return res;
1200  }
1201
1202  protected void parseExpressionProperties(JsonObject json, Expression res) throws IOException, FHIRFormatError {
1203    parseElementProperties(json, res);
1204    if (json.has("description"))
1205      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1206    if (json.has("_description"))
1207      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1208    if (json.has("name"))
1209      res.setNameElement(parseId(json.get("name").getAsString()));
1210    if (json.has("_name"))
1211      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1212    if (json.has("language"))
1213      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1214    if (json.has("_language"))
1215      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
1216    if (json.has("expression"))
1217      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1218    if (json.has("_expression"))
1219      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
1220    if (json.has("reference"))
1221      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
1222    if (json.has("_reference"))
1223      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
1224  }
1225
1226  protected Signature parseSignature(JsonObject json) throws IOException, FHIRFormatError {
1227    Signature res = new Signature();
1228    parseSignatureProperties(json, res);
1229    return res;
1230  }
1231
1232  protected void parseSignatureProperties(JsonObject json, Signature res) throws IOException, FHIRFormatError {
1233    parseTypeProperties(json, res);
1234    if (json.has("type")) {
1235      JsonArray array = json.getAsJsonArray("type");
1236      for (int i = 0; i < array.size(); i++) {
1237        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
1238      }
1239    };
1240    if (json.has("when"))
1241      res.setWhenElement(parseInstant(json.get("when").getAsString()));
1242    if (json.has("_when"))
1243      parseElementProperties(json.getAsJsonObject("_when"), res.getWhenElement());
1244    if (json.has("who"))
1245      res.setWho(parseReference(json.getAsJsonObject("who")));
1246    if (json.has("onBehalfOf"))
1247      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
1248    if (json.has("targetFormat"))
1249      res.setTargetFormatElement(parseCode(json.get("targetFormat").getAsString()));
1250    if (json.has("_targetFormat"))
1251      parseElementProperties(json.getAsJsonObject("_targetFormat"), res.getTargetFormatElement());
1252    if (json.has("sigFormat"))
1253      res.setSigFormatElement(parseCode(json.get("sigFormat").getAsString()));
1254    if (json.has("_sigFormat"))
1255      parseElementProperties(json.getAsJsonObject("_sigFormat"), res.getSigFormatElement());
1256    if (json.has("data"))
1257      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
1258    if (json.has("_data"))
1259      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
1260  }
1261
1262  protected Timing parseTiming(JsonObject json) throws IOException, FHIRFormatError {
1263    Timing res = new Timing();
1264    parseTimingProperties(json, res);
1265    return res;
1266  }
1267
1268  protected void parseTimingProperties(JsonObject json, Timing res) throws IOException, FHIRFormatError {
1269    parseBackboneElementProperties(json, res);
1270    if (json.has("event")) {
1271      JsonArray array = json.getAsJsonArray("event");
1272      for (int i = 0; i < array.size(); i++) {
1273        res.getEvent().add(parseDateTime(array.get(i).getAsString()));
1274      }
1275    };
1276    if (json.has("_event")) {
1277      JsonArray array = json.getAsJsonArray("_event");
1278      for (int i = 0; i < array.size(); i++) {
1279        if (i == res.getEvent().size())
1280          res.getEvent().add(parseDateTime(null));
1281        if (array.get(i) instanceof JsonObject) 
1282          parseElementProperties(array.get(i).getAsJsonObject(), res.getEvent().get(i));
1283      }
1284    };
1285    if (json.has("repeat"))
1286      res.setRepeat(parseTimingTimingRepeatComponent(json.getAsJsonObject("repeat"), res));
1287    if (json.has("code"))
1288      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
1289  }
1290
1291  protected Timing.TimingRepeatComponent parseTimingTimingRepeatComponent(JsonObject json, Timing owner) throws IOException, FHIRFormatError {
1292    Timing.TimingRepeatComponent res = new Timing.TimingRepeatComponent();
1293    parseTimingTimingRepeatComponentProperties(json, owner, res);
1294    return res;
1295  }
1296
1297  protected void parseTimingTimingRepeatComponentProperties(JsonObject json, Timing owner, Timing.TimingRepeatComponent res) throws IOException, FHIRFormatError {
1298    parseTypeProperties(json, res);
1299    Type bounds = parseType("bounds", json);
1300    if (bounds != null)
1301      res.setBounds(bounds);
1302    if (json.has("count"))
1303      res.setCountElement(parsePositiveInt(json.get("count").getAsString()));
1304    if (json.has("_count"))
1305      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
1306    if (json.has("countMax"))
1307      res.setCountMaxElement(parsePositiveInt(json.get("countMax").getAsString()));
1308    if (json.has("_countMax"))
1309      parseElementProperties(json.getAsJsonObject("_countMax"), res.getCountMaxElement());
1310    if (json.has("duration"))
1311      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
1312    if (json.has("_duration"))
1313      parseElementProperties(json.getAsJsonObject("_duration"), res.getDurationElement());
1314    if (json.has("durationMax"))
1315      res.setDurationMaxElement(parseDecimal(json.get("durationMax").getAsBigDecimal()));
1316    if (json.has("_durationMax"))
1317      parseElementProperties(json.getAsJsonObject("_durationMax"), res.getDurationMaxElement());
1318    if (json.has("durationUnit"))
1319      res.setDurationUnitElement(parseEnumeration(json.get("durationUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1320    if (json.has("_durationUnit"))
1321      parseElementProperties(json.getAsJsonObject("_durationUnit"), res.getDurationUnitElement());
1322    if (json.has("frequency"))
1323      res.setFrequencyElement(parsePositiveInt(json.get("frequency").getAsString()));
1324    if (json.has("_frequency"))
1325      parseElementProperties(json.getAsJsonObject("_frequency"), res.getFrequencyElement());
1326    if (json.has("frequencyMax"))
1327      res.setFrequencyMaxElement(parsePositiveInt(json.get("frequencyMax").getAsString()));
1328    if (json.has("_frequencyMax"))
1329      parseElementProperties(json.getAsJsonObject("_frequencyMax"), res.getFrequencyMaxElement());
1330    if (json.has("period"))
1331      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
1332    if (json.has("_period"))
1333      parseElementProperties(json.getAsJsonObject("_period"), res.getPeriodElement());
1334    if (json.has("periodMax"))
1335      res.setPeriodMaxElement(parseDecimal(json.get("periodMax").getAsBigDecimal()));
1336    if (json.has("_periodMax"))
1337      parseElementProperties(json.getAsJsonObject("_periodMax"), res.getPeriodMaxElement());
1338    if (json.has("periodUnit"))
1339      res.setPeriodUnitElement(parseEnumeration(json.get("periodUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1340    if (json.has("_periodUnit"))
1341      parseElementProperties(json.getAsJsonObject("_periodUnit"), res.getPeriodUnitElement());
1342    if (json.has("dayOfWeek")) {
1343      JsonArray array = json.getAsJsonArray("dayOfWeek");
1344      for (int i = 0; i < array.size(); i++) {
1345        res.getDayOfWeek().add(parseEnumeration(array.get(i).getAsString(), Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1346      }
1347    };
1348    if (json.has("_dayOfWeek")) {
1349      JsonArray array = json.getAsJsonArray("_dayOfWeek");
1350      for (int i = 0; i < array.size(); i++) {
1351        if (i == res.getDayOfWeek().size())
1352          res.getDayOfWeek().add(parseEnumeration(null, Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1353        if (array.get(i) instanceof JsonObject) 
1354          parseElementProperties(array.get(i).getAsJsonObject(), res.getDayOfWeek().get(i));
1355      }
1356    };
1357    if (json.has("timeOfDay")) {
1358      JsonArray array = json.getAsJsonArray("timeOfDay");
1359      for (int i = 0; i < array.size(); i++) {
1360        res.getTimeOfDay().add(parseTime(array.get(i).getAsString()));
1361      }
1362    };
1363    if (json.has("_timeOfDay")) {
1364      JsonArray array = json.getAsJsonArray("_timeOfDay");
1365      for (int i = 0; i < array.size(); i++) {
1366        if (i == res.getTimeOfDay().size())
1367          res.getTimeOfDay().add(parseTime(null));
1368        if (array.get(i) instanceof JsonObject) 
1369          parseElementProperties(array.get(i).getAsJsonObject(), res.getTimeOfDay().get(i));
1370      }
1371    };
1372    if (json.has("when")) {
1373      JsonArray array = json.getAsJsonArray("when");
1374      for (int i = 0; i < array.size(); i++) {
1375        res.getWhen().add(parseEnumeration(array.get(i).getAsString(), Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1376      }
1377    };
1378    if (json.has("_when")) {
1379      JsonArray array = json.getAsJsonArray("_when");
1380      for (int i = 0; i < array.size(); i++) {
1381        if (i == res.getWhen().size())
1382          res.getWhen().add(parseEnumeration(null, Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1383        if (array.get(i) instanceof JsonObject) 
1384          parseElementProperties(array.get(i).getAsJsonObject(), res.getWhen().get(i));
1385      }
1386    };
1387    if (json.has("offset"))
1388      res.setOffsetElement(parseUnsignedInt(json.get("offset").getAsString()));
1389    if (json.has("_offset"))
1390      parseElementProperties(json.getAsJsonObject("_offset"), res.getOffsetElement());
1391  }
1392
1393  protected ProdCharacteristic parseProdCharacteristic(JsonObject json) throws IOException, FHIRFormatError {
1394    ProdCharacteristic res = new ProdCharacteristic();
1395    parseProdCharacteristicProperties(json, res);
1396    return res;
1397  }
1398
1399  protected void parseProdCharacteristicProperties(JsonObject json, ProdCharacteristic res) throws IOException, FHIRFormatError {
1400    parseBackboneElementProperties(json, res);
1401    if (json.has("height"))
1402      res.setHeight(parseQuantity(json.getAsJsonObject("height")));
1403    if (json.has("width"))
1404      res.setWidth(parseQuantity(json.getAsJsonObject("width")));
1405    if (json.has("depth"))
1406      res.setDepth(parseQuantity(json.getAsJsonObject("depth")));
1407    if (json.has("weight"))
1408      res.setWeight(parseQuantity(json.getAsJsonObject("weight")));
1409    if (json.has("nominalVolume"))
1410      res.setNominalVolume(parseQuantity(json.getAsJsonObject("nominalVolume")));
1411    if (json.has("externalDiameter"))
1412      res.setExternalDiameter(parseQuantity(json.getAsJsonObject("externalDiameter")));
1413    if (json.has("shape"))
1414      res.setShapeElement(parseString(json.get("shape").getAsString()));
1415    if (json.has("_shape"))
1416      parseElementProperties(json.getAsJsonObject("_shape"), res.getShapeElement());
1417    if (json.has("color")) {
1418      JsonArray array = json.getAsJsonArray("color");
1419      for (int i = 0; i < array.size(); i++) {
1420        res.getColor().add(parseString(array.get(i).getAsString()));
1421      }
1422    };
1423    if (json.has("_color")) {
1424      JsonArray array = json.getAsJsonArray("_color");
1425      for (int i = 0; i < array.size(); i++) {
1426        if (i == res.getColor().size())
1427          res.getColor().add(parseString(null));
1428        if (array.get(i) instanceof JsonObject) 
1429          parseElementProperties(array.get(i).getAsJsonObject(), res.getColor().get(i));
1430      }
1431    };
1432    if (json.has("imprint")) {
1433      JsonArray array = json.getAsJsonArray("imprint");
1434      for (int i = 0; i < array.size(); i++) {
1435        res.getImprint().add(parseString(array.get(i).getAsString()));
1436      }
1437    };
1438    if (json.has("_imprint")) {
1439      JsonArray array = json.getAsJsonArray("_imprint");
1440      for (int i = 0; i < array.size(); i++) {
1441        if (i == res.getImprint().size())
1442          res.getImprint().add(parseString(null));
1443        if (array.get(i) instanceof JsonObject) 
1444          parseElementProperties(array.get(i).getAsJsonObject(), res.getImprint().get(i));
1445      }
1446    };
1447    if (json.has("image")) {
1448      JsonArray array = json.getAsJsonArray("image");
1449      for (int i = 0; i < array.size(); i++) {
1450        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
1451      }
1452    };
1453    if (json.has("scoring"))
1454      res.setScoring(parseCodeableConcept(json.getAsJsonObject("scoring")));
1455  }
1456
1457  protected CodeableConcept parseCodeableConcept(JsonObject json) throws IOException, FHIRFormatError {
1458    CodeableConcept res = new CodeableConcept();
1459    parseCodeableConceptProperties(json, res);
1460    return res;
1461  }
1462
1463  protected void parseCodeableConceptProperties(JsonObject json, CodeableConcept res) throws IOException, FHIRFormatError {
1464    parseTypeProperties(json, res);
1465    if (json.has("coding")) {
1466      JsonArray array = json.getAsJsonArray("coding");
1467      for (int i = 0; i < array.size(); i++) {
1468        res.getCoding().add(parseCoding(array.get(i).getAsJsonObject()));
1469      }
1470    };
1471    if (json.has("text"))
1472      res.setTextElement(parseString(json.get("text").getAsString()));
1473    if (json.has("_text"))
1474      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
1475  }
1476
1477  protected ParameterDefinition parseParameterDefinition(JsonObject json) throws IOException, FHIRFormatError {
1478    ParameterDefinition res = new ParameterDefinition();
1479    parseParameterDefinitionProperties(json, res);
1480    return res;
1481  }
1482
1483  protected void parseParameterDefinitionProperties(JsonObject json, ParameterDefinition res) throws IOException, FHIRFormatError {
1484    parseTypeProperties(json, res);
1485    if (json.has("name"))
1486      res.setNameElement(parseCode(json.get("name").getAsString()));
1487    if (json.has("_name"))
1488      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1489    if (json.has("use"))
1490      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ParameterDefinition.ParameterUse.NULL, new ParameterDefinition.ParameterUseEnumFactory()));
1491    if (json.has("_use"))
1492      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
1493    if (json.has("min"))
1494      res.setMinElement(parseInteger(json.get("min").getAsLong()));
1495    if (json.has("_min"))
1496      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1497    if (json.has("max"))
1498      res.setMaxElement(parseString(json.get("max").getAsString()));
1499    if (json.has("_max"))
1500      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1501    if (json.has("documentation"))
1502      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
1503    if (json.has("_documentation"))
1504      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
1505    if (json.has("type"))
1506      res.setTypeElement(parseCode(json.get("type").getAsString()));
1507    if (json.has("_type"))
1508      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1509    if (json.has("profile"))
1510      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
1511    if (json.has("_profile"))
1512      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
1513  }
1514
1515  protected ElementDefinition parseElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
1516    ElementDefinition res = new ElementDefinition();
1517    parseElementDefinitionProperties(json, res);
1518    return res;
1519  }
1520
1521  protected void parseElementDefinitionProperties(JsonObject json, ElementDefinition res) throws IOException, FHIRFormatError {
1522    parseBackboneElementProperties(json, res);
1523    if (json.has("path"))
1524      res.setPathElement(parseString(json.get("path").getAsString()));
1525    if (json.has("_path"))
1526      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1527    if (json.has("representation")) {
1528      JsonArray array = json.getAsJsonArray("representation");
1529      for (int i = 0; i < array.size(); i++) {
1530        res.getRepresentation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
1531      }
1532    };
1533    if (json.has("_representation")) {
1534      JsonArray array = json.getAsJsonArray("_representation");
1535      for (int i = 0; i < array.size(); i++) {
1536        if (i == res.getRepresentation().size())
1537          res.getRepresentation().add(parseEnumeration(null, ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
1538        if (array.get(i) instanceof JsonObject) 
1539          parseElementProperties(array.get(i).getAsJsonObject(), res.getRepresentation().get(i));
1540      }
1541    };
1542    if (json.has("sliceName"))
1543      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
1544    if (json.has("_sliceName"))
1545      parseElementProperties(json.getAsJsonObject("_sliceName"), res.getSliceNameElement());
1546    if (json.has("sliceIsConstraining"))
1547      res.setSliceIsConstrainingElement(parseBoolean(json.get("sliceIsConstraining").getAsBoolean()));
1548    if (json.has("_sliceIsConstraining"))
1549      parseElementProperties(json.getAsJsonObject("_sliceIsConstraining"), res.getSliceIsConstrainingElement());
1550    if (json.has("label"))
1551      res.setLabelElement(parseString(json.get("label").getAsString()));
1552    if (json.has("_label"))
1553      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
1554    if (json.has("code")) {
1555      JsonArray array = json.getAsJsonArray("code");
1556      for (int i = 0; i < array.size(); i++) {
1557        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
1558      }
1559    };
1560    if (json.has("slicing"))
1561      res.setSlicing(parseElementDefinitionElementDefinitionSlicingComponent(json.getAsJsonObject("slicing"), res));
1562    if (json.has("short"))
1563      res.setShortElement(parseString(json.get("short").getAsString()));
1564    if (json.has("_short"))
1565      parseElementProperties(json.getAsJsonObject("_short"), res.getShortElement());
1566    if (json.has("definition"))
1567      res.setDefinitionElement(parseMarkdown(json.get("definition").getAsString()));
1568    if (json.has("_definition"))
1569      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
1570    if (json.has("comment"))
1571      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
1572    if (json.has("_comment"))
1573      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
1574    if (json.has("requirements"))
1575      res.setRequirementsElement(parseMarkdown(json.get("requirements").getAsString()));
1576    if (json.has("_requirements"))
1577      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
1578    if (json.has("alias")) {
1579      JsonArray array = json.getAsJsonArray("alias");
1580      for (int i = 0; i < array.size(); i++) {
1581        res.getAlias().add(parseString(array.get(i).getAsString()));
1582      }
1583    };
1584    if (json.has("_alias")) {
1585      JsonArray array = json.getAsJsonArray("_alias");
1586      for (int i = 0; i < array.size(); i++) {
1587        if (i == res.getAlias().size())
1588          res.getAlias().add(parseString(null));
1589        if (array.get(i) instanceof JsonObject) 
1590          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
1591      }
1592    };
1593    if (json.has("min"))
1594      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1595    if (json.has("_min"))
1596      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1597    if (json.has("max"))
1598      res.setMaxElement(parseString(json.get("max").getAsString()));
1599    if (json.has("_max"))
1600      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1601    if (json.has("base"))
1602      res.setBase(parseElementDefinitionElementDefinitionBaseComponent(json.getAsJsonObject("base"), res));
1603    if (json.has("contentReference"))
1604      res.setContentReferenceElement(parseUri(json.get("contentReference").getAsString()));
1605    if (json.has("_contentReference"))
1606      parseElementProperties(json.getAsJsonObject("_contentReference"), res.getContentReferenceElement());
1607    if (json.has("type")) {
1608      JsonArray array = json.getAsJsonArray("type");
1609      for (int i = 0; i < array.size(); i++) {
1610        res.getType().add(parseElementDefinitionTypeRefComponent(array.get(i).getAsJsonObject(), res));
1611      }
1612    };
1613    Type defaultValue = parseType("defaultValue", json);
1614    if (defaultValue != null)
1615      res.setDefaultValue(defaultValue);
1616    if (json.has("meaningWhenMissing"))
1617      res.setMeaningWhenMissingElement(parseMarkdown(json.get("meaningWhenMissing").getAsString()));
1618    if (json.has("_meaningWhenMissing"))
1619      parseElementProperties(json.getAsJsonObject("_meaningWhenMissing"), res.getMeaningWhenMissingElement());
1620    if (json.has("orderMeaning"))
1621      res.setOrderMeaningElement(parseString(json.get("orderMeaning").getAsString()));
1622    if (json.has("_orderMeaning"))
1623      parseElementProperties(json.getAsJsonObject("_orderMeaning"), res.getOrderMeaningElement());
1624    Type fixed = parseType("fixed", json);
1625    if (fixed != null)
1626      res.setFixed(fixed);
1627    Type pattern = parseType("pattern", json);
1628    if (pattern != null)
1629      res.setPattern(pattern);
1630    if (json.has("example")) {
1631      JsonArray array = json.getAsJsonArray("example");
1632      for (int i = 0; i < array.size(); i++) {
1633        res.getExample().add(parseElementDefinitionElementDefinitionExampleComponent(array.get(i).getAsJsonObject(), res));
1634      }
1635    };
1636    Type minValue = parseType("minValue", json);
1637    if (minValue != null)
1638      res.setMinValue(minValue);
1639    Type maxValue = parseType("maxValue", json);
1640    if (maxValue != null)
1641      res.setMaxValue(maxValue);
1642    if (json.has("maxLength"))
1643      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
1644    if (json.has("_maxLength"))
1645      parseElementProperties(json.getAsJsonObject("_maxLength"), res.getMaxLengthElement());
1646    if (json.has("condition")) {
1647      JsonArray array = json.getAsJsonArray("condition");
1648      for (int i = 0; i < array.size(); i++) {
1649        res.getCondition().add(parseId(array.get(i).getAsString()));
1650      }
1651    };
1652    if (json.has("_condition")) {
1653      JsonArray array = json.getAsJsonArray("_condition");
1654      for (int i = 0; i < array.size(); i++) {
1655        if (i == res.getCondition().size())
1656          res.getCondition().add(parseId(null));
1657        if (array.get(i) instanceof JsonObject) 
1658          parseElementProperties(array.get(i).getAsJsonObject(), res.getCondition().get(i));
1659      }
1660    };
1661    if (json.has("constraint")) {
1662      JsonArray array = json.getAsJsonArray("constraint");
1663      for (int i = 0; i < array.size(); i++) {
1664        res.getConstraint().add(parseElementDefinitionElementDefinitionConstraintComponent(array.get(i).getAsJsonObject(), res));
1665      }
1666    };
1667    if (json.has("mustSupport"))
1668      res.setMustSupportElement(parseBoolean(json.get("mustSupport").getAsBoolean()));
1669    if (json.has("_mustSupport"))
1670      parseElementProperties(json.getAsJsonObject("_mustSupport"), res.getMustSupportElement());
1671    if (json.has("isModifier"))
1672      res.setIsModifierElement(parseBoolean(json.get("isModifier").getAsBoolean()));
1673    if (json.has("_isModifier"))
1674      parseElementProperties(json.getAsJsonObject("_isModifier"), res.getIsModifierElement());
1675    if (json.has("isModifierReason"))
1676      res.setIsModifierReasonElement(parseString(json.get("isModifierReason").getAsString()));
1677    if (json.has("_isModifierReason"))
1678      parseElementProperties(json.getAsJsonObject("_isModifierReason"), res.getIsModifierReasonElement());
1679    if (json.has("isSummary"))
1680      res.setIsSummaryElement(parseBoolean(json.get("isSummary").getAsBoolean()));
1681    if (json.has("_isSummary"))
1682      parseElementProperties(json.getAsJsonObject("_isSummary"), res.getIsSummaryElement());
1683    if (json.has("binding"))
1684      res.setBinding(parseElementDefinitionElementDefinitionBindingComponent(json.getAsJsonObject("binding"), res));
1685    if (json.has("mapping")) {
1686      JsonArray array = json.getAsJsonArray("mapping");
1687      for (int i = 0; i < array.size(); i++) {
1688        res.getMapping().add(parseElementDefinitionElementDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
1689      }
1690    };
1691  }
1692
1693  protected ElementDefinition.ElementDefinitionSlicingComponent parseElementDefinitionElementDefinitionSlicingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1694    ElementDefinition.ElementDefinitionSlicingComponent res = new ElementDefinition.ElementDefinitionSlicingComponent();
1695    parseElementDefinitionElementDefinitionSlicingComponentProperties(json, owner, res);
1696    return res;
1697  }
1698
1699  protected void parseElementDefinitionElementDefinitionSlicingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingComponent res) throws IOException, FHIRFormatError {
1700    parseTypeProperties(json, res);
1701    if (json.has("discriminator")) {
1702      JsonArray array = json.getAsJsonArray("discriminator");
1703      for (int i = 0; i < array.size(); i++) {
1704        res.getDiscriminator().add(parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(array.get(i).getAsJsonObject(), owner));
1705      }
1706    };
1707    if (json.has("description"))
1708      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1709    if (json.has("_description"))
1710      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1711    if (json.has("ordered"))
1712      res.setOrderedElement(parseBoolean(json.get("ordered").getAsBoolean()));
1713    if (json.has("_ordered"))
1714      parseElementProperties(json.getAsJsonObject("_ordered"), res.getOrderedElement());
1715    if (json.has("rules"))
1716      res.setRulesElement(parseEnumeration(json.get("rules").getAsString(), ElementDefinition.SlicingRules.NULL, new ElementDefinition.SlicingRulesEnumFactory()));
1717    if (json.has("_rules"))
1718      parseElementProperties(json.getAsJsonObject("_rules"), res.getRulesElement());
1719  }
1720
1721  protected ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1722    ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res = new ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent();
1723    parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(json, owner, res);
1724    return res;
1725  }
1726
1727  protected void parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res) throws IOException, FHIRFormatError {
1728    parseTypeProperties(json, res);
1729    if (json.has("type"))
1730      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ElementDefinition.DiscriminatorType.NULL, new ElementDefinition.DiscriminatorTypeEnumFactory()));
1731    if (json.has("_type"))
1732      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1733    if (json.has("path"))
1734      res.setPathElement(parseString(json.get("path").getAsString()));
1735    if (json.has("_path"))
1736      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1737  }
1738
1739  protected ElementDefinition.ElementDefinitionBaseComponent parseElementDefinitionElementDefinitionBaseComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1740    ElementDefinition.ElementDefinitionBaseComponent res = new ElementDefinition.ElementDefinitionBaseComponent();
1741    parseElementDefinitionElementDefinitionBaseComponentProperties(json, owner, res);
1742    return res;
1743  }
1744
1745  protected void parseElementDefinitionElementDefinitionBaseComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionBaseComponent res) throws IOException, FHIRFormatError {
1746    parseTypeProperties(json, res);
1747    if (json.has("path"))
1748      res.setPathElement(parseString(json.get("path").getAsString()));
1749    if (json.has("_path"))
1750      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1751    if (json.has("min"))
1752      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1753    if (json.has("_min"))
1754      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1755    if (json.has("max"))
1756      res.setMaxElement(parseString(json.get("max").getAsString()));
1757    if (json.has("_max"))
1758      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1759  }
1760
1761  protected ElementDefinition.TypeRefComponent parseElementDefinitionTypeRefComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1762    ElementDefinition.TypeRefComponent res = new ElementDefinition.TypeRefComponent();
1763    parseElementDefinitionTypeRefComponentProperties(json, owner, res);
1764    return res;
1765  }
1766
1767  protected void parseElementDefinitionTypeRefComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.TypeRefComponent res) throws IOException, FHIRFormatError {
1768    parseTypeProperties(json, res);
1769    if (json.has("code"))
1770      res.setCodeElement(parseUri(json.get("code").getAsString()));
1771    if (json.has("_code"))
1772      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
1773    if (json.has("profile")) {
1774      JsonArray array = json.getAsJsonArray("profile");
1775      for (int i = 0; i < array.size(); i++) {
1776        res.getProfile().add(parseCanonical(array.get(i).getAsString()));
1777      }
1778    };
1779    if (json.has("_profile")) {
1780      JsonArray array = json.getAsJsonArray("_profile");
1781      for (int i = 0; i < array.size(); i++) {
1782        if (i == res.getProfile().size())
1783          res.getProfile().add(parseCanonical(null));
1784        if (array.get(i) instanceof JsonObject) 
1785          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
1786      }
1787    };
1788    if (json.has("targetProfile")) {
1789      JsonArray array = json.getAsJsonArray("targetProfile");
1790      for (int i = 0; i < array.size(); i++) {
1791        res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
1792      }
1793    };
1794    if (json.has("_targetProfile")) {
1795      JsonArray array = json.getAsJsonArray("_targetProfile");
1796      for (int i = 0; i < array.size(); i++) {
1797        if (i == res.getTargetProfile().size())
1798          res.getTargetProfile().add(parseCanonical(null));
1799        if (array.get(i) instanceof JsonObject) 
1800          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
1801      }
1802    };
1803    if (json.has("aggregation")) {
1804      JsonArray array = json.getAsJsonArray("aggregation");
1805      for (int i = 0; i < array.size(); i++) {
1806        res.getAggregation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1807      }
1808    };
1809    if (json.has("_aggregation")) {
1810      JsonArray array = json.getAsJsonArray("_aggregation");
1811      for (int i = 0; i < array.size(); i++) {
1812        if (i == res.getAggregation().size())
1813          res.getAggregation().add(parseEnumeration(null, ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1814        if (array.get(i) instanceof JsonObject) 
1815          parseElementProperties(array.get(i).getAsJsonObject(), res.getAggregation().get(i));
1816      }
1817    };
1818    if (json.has("versioning"))
1819      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), ElementDefinition.ReferenceVersionRules.NULL, new ElementDefinition.ReferenceVersionRulesEnumFactory()));
1820    if (json.has("_versioning"))
1821      parseElementProperties(json.getAsJsonObject("_versioning"), res.getVersioningElement());
1822  }
1823
1824  protected ElementDefinition.ElementDefinitionExampleComponent parseElementDefinitionElementDefinitionExampleComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1825    ElementDefinition.ElementDefinitionExampleComponent res = new ElementDefinition.ElementDefinitionExampleComponent();
1826    parseElementDefinitionElementDefinitionExampleComponentProperties(json, owner, res);
1827    return res;
1828  }
1829
1830  protected void parseElementDefinitionElementDefinitionExampleComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionExampleComponent res) throws IOException, FHIRFormatError {
1831    parseTypeProperties(json, res);
1832    if (json.has("label"))
1833      res.setLabelElement(parseString(json.get("label").getAsString()));
1834    if (json.has("_label"))
1835      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
1836    Type value = parseType("value", json);
1837    if (value != null)
1838      res.setValue(value);
1839  }
1840
1841  protected ElementDefinition.ElementDefinitionConstraintComponent parseElementDefinitionElementDefinitionConstraintComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1842    ElementDefinition.ElementDefinitionConstraintComponent res = new ElementDefinition.ElementDefinitionConstraintComponent();
1843    parseElementDefinitionElementDefinitionConstraintComponentProperties(json, owner, res);
1844    return res;
1845  }
1846
1847  protected void parseElementDefinitionElementDefinitionConstraintComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionConstraintComponent res) throws IOException, FHIRFormatError {
1848    parseTypeProperties(json, res);
1849    if (json.has("key"))
1850      res.setKeyElement(parseId(json.get("key").getAsString()));
1851    if (json.has("_key"))
1852      parseElementProperties(json.getAsJsonObject("_key"), res.getKeyElement());
1853    if (json.has("requirements"))
1854      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
1855    if (json.has("_requirements"))
1856      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
1857    if (json.has("severity"))
1858      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), ElementDefinition.ConstraintSeverity.NULL, new ElementDefinition.ConstraintSeverityEnumFactory()));
1859    if (json.has("_severity"))
1860      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
1861    if (json.has("human"))
1862      res.setHumanElement(parseString(json.get("human").getAsString()));
1863    if (json.has("_human"))
1864      parseElementProperties(json.getAsJsonObject("_human"), res.getHumanElement());
1865    if (json.has("expression"))
1866      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1867    if (json.has("_expression"))
1868      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
1869    if (json.has("xpath"))
1870      res.setXpathElement(parseString(json.get("xpath").getAsString()));
1871    if (json.has("_xpath"))
1872      parseElementProperties(json.getAsJsonObject("_xpath"), res.getXpathElement());
1873    if (json.has("source"))
1874      res.setSourceElement(parseCanonical(json.get("source").getAsString()));
1875    if (json.has("_source"))
1876      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
1877  }
1878
1879  protected ElementDefinition.ElementDefinitionBindingComponent parseElementDefinitionElementDefinitionBindingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1880    ElementDefinition.ElementDefinitionBindingComponent res = new ElementDefinition.ElementDefinitionBindingComponent();
1881    parseElementDefinitionElementDefinitionBindingComponentProperties(json, owner, res);
1882    return res;
1883  }
1884
1885  protected void parseElementDefinitionElementDefinitionBindingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionBindingComponent res) throws IOException, FHIRFormatError {
1886    parseTypeProperties(json, res);
1887    if (json.has("strength"))
1888      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
1889    if (json.has("_strength"))
1890      parseElementProperties(json.getAsJsonObject("_strength"), res.getStrengthElement());
1891    if (json.has("description"))
1892      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1893    if (json.has("_description"))
1894      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1895    if (json.has("valueSet"))
1896      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
1897    if (json.has("_valueSet"))
1898      parseElementProperties(json.getAsJsonObject("_valueSet"), res.getValueSetElement());
1899  }
1900
1901  protected ElementDefinition.ElementDefinitionMappingComponent parseElementDefinitionElementDefinitionMappingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1902    ElementDefinition.ElementDefinitionMappingComponent res = new ElementDefinition.ElementDefinitionMappingComponent();
1903    parseElementDefinitionElementDefinitionMappingComponentProperties(json, owner, res);
1904    return res;
1905  }
1906
1907  protected void parseElementDefinitionElementDefinitionMappingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionMappingComponent res) throws IOException, FHIRFormatError {
1908    parseTypeProperties(json, res);
1909    if (json.has("identity"))
1910      res.setIdentityElement(parseId(json.get("identity").getAsString()));
1911    if (json.has("_identity"))
1912      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
1913    if (json.has("language"))
1914      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1915    if (json.has("_language"))
1916      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
1917    if (json.has("map"))
1918      res.setMapElement(parseString(json.get("map").getAsString()));
1919    if (json.has("_map"))
1920      parseElementProperties(json.getAsJsonObject("_map"), res.getMapElement());
1921    if (json.has("comment"))
1922      res.setCommentElement(parseString(json.get("comment").getAsString()));
1923    if (json.has("_comment"))
1924      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
1925  }
1926
1927  protected void parseDomainResourceProperties(JsonObject json, DomainResource res) throws IOException, FHIRFormatError {
1928    parseResourceProperties(json, res);
1929    if (json.has("text"))
1930      res.setText(parseNarrative(json.getAsJsonObject("text")));
1931    if (json.has("contained")) {
1932      JsonArray array = json.getAsJsonArray("contained");
1933      for (int i = 0; i < array.size(); i++) {
1934        res.getContained().add(parseResource(array.get(i).getAsJsonObject()));
1935      }
1936    };
1937    if (json.has("extension")) {
1938      JsonArray array = json.getAsJsonArray("extension");
1939      for (int i = 0; i < array.size(); i++) {
1940        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1941      }
1942    };
1943    if (json.has("modifierExtension")) {
1944      JsonArray array = json.getAsJsonArray("modifierExtension");
1945      for (int i = 0; i < array.size(); i++) {
1946        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1947      }
1948    };
1949  }
1950
1951  protected Parameters parseParameters(JsonObject json) throws IOException, FHIRFormatError {
1952    Parameters res = new Parameters();
1953    parseParametersProperties(json, res);
1954    return res;
1955  }
1956
1957  protected void parseParametersProperties(JsonObject json, Parameters res) throws IOException, FHIRFormatError {
1958    parseResourceProperties(json, res);
1959    if (json.has("parameter")) {
1960      JsonArray array = json.getAsJsonArray("parameter");
1961      for (int i = 0; i < array.size(); i++) {
1962        res.getParameter().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), res));
1963      }
1964    };
1965  }
1966
1967  protected Parameters.ParametersParameterComponent parseParametersParametersParameterComponent(JsonObject json, Parameters owner) throws IOException, FHIRFormatError {
1968    Parameters.ParametersParameterComponent res = new Parameters.ParametersParameterComponent();
1969    parseParametersParametersParameterComponentProperties(json, owner, res);
1970    return res;
1971  }
1972
1973  protected void parseParametersParametersParameterComponentProperties(JsonObject json, Parameters owner, Parameters.ParametersParameterComponent res) throws IOException, FHIRFormatError {
1974    parseBackboneElementProperties(json, res);
1975    if (json.has("name"))
1976      res.setNameElement(parseString(json.get("name").getAsString()));
1977    if (json.has("_name"))
1978      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1979    Type value = parseType("value", json);
1980    if (value != null)
1981      res.setValue(value);
1982    if (json.has("resource"))
1983      res.setResource(parseResource(json.getAsJsonObject("resource")));
1984    if (json.has("part")) {
1985      JsonArray array = json.getAsJsonArray("part");
1986      for (int i = 0; i < array.size(); i++) {
1987        res.getPart().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), owner));
1988      }
1989    };
1990  }
1991
1992  protected void parseResourceProperties(JsonObject json, Resource res) throws IOException, FHIRFormatError {
1993    if (json.has("id"))
1994      res.setIdElement(parseId(json.get("id").getAsString()));
1995    if (json.has("_id"))
1996      parseElementProperties(json.getAsJsonObject("_id"), res.getIdElement());
1997    if (json.has("meta"))
1998      res.setMeta(parseMeta(json.getAsJsonObject("meta")));
1999    if (json.has("implicitRules"))
2000      res.setImplicitRulesElement(parseUri(json.get("implicitRules").getAsString()));
2001    if (json.has("_implicitRules"))
2002      parseElementProperties(json.getAsJsonObject("_implicitRules"), res.getImplicitRulesElement());
2003    if (json.has("language"))
2004      res.setLanguageElement(parseCode(json.get("language").getAsString()));
2005    if (json.has("_language"))
2006      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
2007  }
2008
2009  protected Account parseAccount(JsonObject json) throws IOException, FHIRFormatError {
2010    Account res = new Account();
2011    parseAccountProperties(json, res);
2012    return res;
2013  }
2014
2015  protected void parseAccountProperties(JsonObject json, Account res) throws IOException, FHIRFormatError {
2016    parseDomainResourceProperties(json, res);
2017    if (json.has("identifier")) {
2018      JsonArray array = json.getAsJsonArray("identifier");
2019      for (int i = 0; i < array.size(); i++) {
2020        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2021      }
2022    };
2023    if (json.has("status"))
2024      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Account.AccountStatus.NULL, new Account.AccountStatusEnumFactory()));
2025    if (json.has("_status"))
2026      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2027    if (json.has("type"))
2028      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
2029    if (json.has("name"))
2030      res.setNameElement(parseString(json.get("name").getAsString()));
2031    if (json.has("_name"))
2032      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2033    if (json.has("subject")) {
2034      JsonArray array = json.getAsJsonArray("subject");
2035      for (int i = 0; i < array.size(); i++) {
2036        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
2037      }
2038    };
2039    if (json.has("servicePeriod"))
2040      res.setServicePeriod(parsePeriod(json.getAsJsonObject("servicePeriod")));
2041    if (json.has("coverage")) {
2042      JsonArray array = json.getAsJsonArray("coverage");
2043      for (int i = 0; i < array.size(); i++) {
2044        res.getCoverage().add(parseAccountCoverageComponent(array.get(i).getAsJsonObject(), res));
2045      }
2046    };
2047    if (json.has("owner"))
2048      res.setOwner(parseReference(json.getAsJsonObject("owner")));
2049    if (json.has("description"))
2050      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2051    if (json.has("_description"))
2052      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2053    if (json.has("guarantor")) {
2054      JsonArray array = json.getAsJsonArray("guarantor");
2055      for (int i = 0; i < array.size(); i++) {
2056        res.getGuarantor().add(parseAccountGuarantorComponent(array.get(i).getAsJsonObject(), res));
2057      }
2058    };
2059    if (json.has("partOf"))
2060      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
2061  }
2062
2063  protected Account.CoverageComponent parseAccountCoverageComponent(JsonObject json, Account owner) throws IOException, FHIRFormatError {
2064    Account.CoverageComponent res = new Account.CoverageComponent();
2065    parseAccountCoverageComponentProperties(json, owner, res);
2066    return res;
2067  }
2068
2069  protected void parseAccountCoverageComponentProperties(JsonObject json, Account owner, Account.CoverageComponent res) throws IOException, FHIRFormatError {
2070    parseBackboneElementProperties(json, res);
2071    if (json.has("coverage"))
2072      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
2073    if (json.has("priority"))
2074      res.setPriorityElement(parsePositiveInt(json.get("priority").getAsString()));
2075    if (json.has("_priority"))
2076      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
2077  }
2078
2079  protected Account.GuarantorComponent parseAccountGuarantorComponent(JsonObject json, Account owner) throws IOException, FHIRFormatError {
2080    Account.GuarantorComponent res = new Account.GuarantorComponent();
2081    parseAccountGuarantorComponentProperties(json, owner, res);
2082    return res;
2083  }
2084
2085  protected void parseAccountGuarantorComponentProperties(JsonObject json, Account owner, Account.GuarantorComponent res) throws IOException, FHIRFormatError {
2086    parseBackboneElementProperties(json, res);
2087    if (json.has("party"))
2088      res.setParty(parseReference(json.getAsJsonObject("party")));
2089    if (json.has("onHold"))
2090      res.setOnHoldElement(parseBoolean(json.get("onHold").getAsBoolean()));
2091    if (json.has("_onHold"))
2092      parseElementProperties(json.getAsJsonObject("_onHold"), res.getOnHoldElement());
2093    if (json.has("period"))
2094      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
2095  }
2096
2097  protected ActivityDefinition parseActivityDefinition(JsonObject json) throws IOException, FHIRFormatError {
2098    ActivityDefinition res = new ActivityDefinition();
2099    parseActivityDefinitionProperties(json, res);
2100    return res;
2101  }
2102
2103  protected void parseActivityDefinitionProperties(JsonObject json, ActivityDefinition res) throws IOException, FHIRFormatError {
2104    parseDomainResourceProperties(json, res);
2105    if (json.has("url"))
2106      res.setUrlElement(parseUri(json.get("url").getAsString()));
2107    if (json.has("_url"))
2108      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
2109    if (json.has("identifier")) {
2110      JsonArray array = json.getAsJsonArray("identifier");
2111      for (int i = 0; i < array.size(); i++) {
2112        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2113      }
2114    };
2115    if (json.has("version"))
2116      res.setVersionElement(parseString(json.get("version").getAsString()));
2117    if (json.has("_version"))
2118      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
2119    if (json.has("name"))
2120      res.setNameElement(parseString(json.get("name").getAsString()));
2121    if (json.has("_name"))
2122      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2123    if (json.has("title"))
2124      res.setTitleElement(parseString(json.get("title").getAsString()));
2125    if (json.has("_title"))
2126      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
2127    if (json.has("subtitle"))
2128      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
2129    if (json.has("_subtitle"))
2130      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
2131    if (json.has("status"))
2132      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2133    if (json.has("_status"))
2134      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2135    if (json.has("experimental"))
2136      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
2137    if (json.has("_experimental"))
2138      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
2139    Type subject = parseType("subject", json);
2140    if (subject != null)
2141      res.setSubject(subject);
2142    if (json.has("date"))
2143      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2144    if (json.has("_date"))
2145      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
2146    if (json.has("publisher"))
2147      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
2148    if (json.has("_publisher"))
2149      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
2150    if (json.has("contact")) {
2151      JsonArray array = json.getAsJsonArray("contact");
2152      for (int i = 0; i < array.size(); i++) {
2153        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
2154      }
2155    };
2156    if (json.has("description"))
2157      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
2158    if (json.has("_description"))
2159      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2160    if (json.has("useContext")) {
2161      JsonArray array = json.getAsJsonArray("useContext");
2162      for (int i = 0; i < array.size(); i++) {
2163        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
2164      }
2165    };
2166    if (json.has("jurisdiction")) {
2167      JsonArray array = json.getAsJsonArray("jurisdiction");
2168      for (int i = 0; i < array.size(); i++) {
2169        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2170      }
2171    };
2172    if (json.has("purpose"))
2173      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
2174    if (json.has("_purpose"))
2175      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
2176    if (json.has("usage"))
2177      res.setUsageElement(parseString(json.get("usage").getAsString()));
2178    if (json.has("_usage"))
2179      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
2180    if (json.has("copyright"))
2181      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
2182    if (json.has("_copyright"))
2183      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
2184    if (json.has("approvalDate"))
2185      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
2186    if (json.has("_approvalDate"))
2187      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
2188    if (json.has("lastReviewDate"))
2189      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
2190    if (json.has("_lastReviewDate"))
2191      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
2192    if (json.has("effectivePeriod"))
2193      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
2194    if (json.has("topic")) {
2195      JsonArray array = json.getAsJsonArray("topic");
2196      for (int i = 0; i < array.size(); i++) {
2197        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2198      }
2199    };
2200    if (json.has("author")) {
2201      JsonArray array = json.getAsJsonArray("author");
2202      for (int i = 0; i < array.size(); i++) {
2203        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2204      }
2205    };
2206    if (json.has("editor")) {
2207      JsonArray array = json.getAsJsonArray("editor");
2208      for (int i = 0; i < array.size(); i++) {
2209        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2210      }
2211    };
2212    if (json.has("reviewer")) {
2213      JsonArray array = json.getAsJsonArray("reviewer");
2214      for (int i = 0; i < array.size(); i++) {
2215        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
2216      }
2217    };
2218    if (json.has("endorser")) {
2219      JsonArray array = json.getAsJsonArray("endorser");
2220      for (int i = 0; i < array.size(); i++) {
2221        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
2222      }
2223    };
2224    if (json.has("relatedArtifact")) {
2225      JsonArray array = json.getAsJsonArray("relatedArtifact");
2226      for (int i = 0; i < array.size(); i++) {
2227        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
2228      }
2229    };
2230    if (json.has("library")) {
2231      JsonArray array = json.getAsJsonArray("library");
2232      for (int i = 0; i < array.size(); i++) {
2233        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
2234      }
2235    };
2236    if (json.has("_library")) {
2237      JsonArray array = json.getAsJsonArray("_library");
2238      for (int i = 0; i < array.size(); i++) {
2239        if (i == res.getLibrary().size())
2240          res.getLibrary().add(parseCanonical(null));
2241        if (array.get(i) instanceof JsonObject) 
2242          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
2243      }
2244    };
2245    if (json.has("kind"))
2246      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), ActivityDefinition.ActivityDefinitionKind.NULL, new ActivityDefinition.ActivityDefinitionKindEnumFactory()));
2247    if (json.has("_kind"))
2248      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
2249    if (json.has("profile"))
2250      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
2251    if (json.has("_profile"))
2252      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
2253    if (json.has("code"))
2254      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2255    if (json.has("intent"))
2256      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), ActivityDefinition.RequestIntent.NULL, new ActivityDefinition.RequestIntentEnumFactory()));
2257    if (json.has("_intent"))
2258      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
2259    if (json.has("priority"))
2260      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), ActivityDefinition.RequestPriority.NULL, new ActivityDefinition.RequestPriorityEnumFactory()));
2261    if (json.has("_priority"))
2262      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
2263    if (json.has("doNotPerform"))
2264      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
2265    if (json.has("_doNotPerform"))
2266      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
2267    Type timing = parseType("timing", json);
2268    if (timing != null)
2269      res.setTiming(timing);
2270    if (json.has("location"))
2271      res.setLocation(parseReference(json.getAsJsonObject("location")));
2272    if (json.has("participant")) {
2273      JsonArray array = json.getAsJsonArray("participant");
2274      for (int i = 0; i < array.size(); i++) {
2275        res.getParticipant().add(parseActivityDefinitionActivityDefinitionParticipantComponent(array.get(i).getAsJsonObject(), res));
2276      }
2277    };
2278    Type product = parseType("product", json);
2279    if (product != null)
2280      res.setProduct(product);
2281    if (json.has("quantity"))
2282      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
2283    if (json.has("dosage")) {
2284      JsonArray array = json.getAsJsonArray("dosage");
2285      for (int i = 0; i < array.size(); i++) {
2286        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
2287      }
2288    };
2289    if (json.has("bodySite")) {
2290      JsonArray array = json.getAsJsonArray("bodySite");
2291      for (int i = 0; i < array.size(); i++) {
2292        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2293      }
2294    };
2295    if (json.has("specimenRequirement")) {
2296      JsonArray array = json.getAsJsonArray("specimenRequirement");
2297      for (int i = 0; i < array.size(); i++) {
2298        res.getSpecimenRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2299      }
2300    };
2301    if (json.has("observationRequirement")) {
2302      JsonArray array = json.getAsJsonArray("observationRequirement");
2303      for (int i = 0; i < array.size(); i++) {
2304        res.getObservationRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2305      }
2306    };
2307    if (json.has("observationResultRequirement")) {
2308      JsonArray array = json.getAsJsonArray("observationResultRequirement");
2309      for (int i = 0; i < array.size(); i++) {
2310        res.getObservationResultRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2311      }
2312    };
2313    if (json.has("transform"))
2314      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
2315    if (json.has("_transform"))
2316      parseElementProperties(json.getAsJsonObject("_transform"), res.getTransformElement());
2317    if (json.has("dynamicValue")) {
2318      JsonArray array = json.getAsJsonArray("dynamicValue");
2319      for (int i = 0; i < array.size(); i++) {
2320        res.getDynamicValue().add(parseActivityDefinitionActivityDefinitionDynamicValueComponent(array.get(i).getAsJsonObject(), res));
2321      }
2322    };
2323  }
2324
2325  protected ActivityDefinition.ActivityDefinitionParticipantComponent parseActivityDefinitionActivityDefinitionParticipantComponent(JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
2326    ActivityDefinition.ActivityDefinitionParticipantComponent res = new ActivityDefinition.ActivityDefinitionParticipantComponent();
2327    parseActivityDefinitionActivityDefinitionParticipantComponentProperties(json, owner, res);
2328    return res;
2329  }
2330
2331  protected void parseActivityDefinitionActivityDefinitionParticipantComponentProperties(JsonObject json, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionParticipantComponent res) throws IOException, FHIRFormatError {
2332    parseBackboneElementProperties(json, res);
2333    if (json.has("type"))
2334      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ActivityDefinition.ActivityParticipantType.NULL, new ActivityDefinition.ActivityParticipantTypeEnumFactory()));
2335    if (json.has("_type"))
2336      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2337    if (json.has("role"))
2338      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
2339  }
2340
2341  protected ActivityDefinition.ActivityDefinitionDynamicValueComponent parseActivityDefinitionActivityDefinitionDynamicValueComponent(JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
2342    ActivityDefinition.ActivityDefinitionDynamicValueComponent res = new ActivityDefinition.ActivityDefinitionDynamicValueComponent();
2343    parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(json, owner, res);
2344    return res;
2345  }
2346
2347  protected void parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(JsonObject json, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionDynamicValueComponent res) throws IOException, FHIRFormatError {
2348    parseBackboneElementProperties(json, res);
2349    if (json.has("path"))
2350      res.setPathElement(parseString(json.get("path").getAsString()));
2351    if (json.has("_path"))
2352      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
2353    if (json.has("expression"))
2354      res.setExpression(parseExpression(json.getAsJsonObject("expression")));
2355  }
2356
2357  protected AdverseEvent parseAdverseEvent(JsonObject json) throws IOException, FHIRFormatError {
2358    AdverseEvent res = new AdverseEvent();
2359    parseAdverseEventProperties(json, res);
2360    return res;
2361  }
2362
2363  protected void parseAdverseEventProperties(JsonObject json, AdverseEvent res) throws IOException, FHIRFormatError {
2364    parseDomainResourceProperties(json, res);
2365    if (json.has("identifier"))
2366      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
2367    if (json.has("actuality"))
2368      res.setActualityElement(parseEnumeration(json.get("actuality").getAsString(), AdverseEvent.AdverseEventActuality.NULL, new AdverseEvent.AdverseEventActualityEnumFactory()));
2369    if (json.has("_actuality"))
2370      parseElementProperties(json.getAsJsonObject("_actuality"), res.getActualityElement());
2371    if (json.has("category")) {
2372      JsonArray array = json.getAsJsonArray("category");
2373      for (int i = 0; i < array.size(); i++) {
2374        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2375      }
2376    };
2377    if (json.has("event"))
2378      res.setEvent(parseCodeableConcept(json.getAsJsonObject("event")));
2379    if (json.has("subject"))
2380      res.setSubject(parseReference(json.getAsJsonObject("subject")));
2381    if (json.has("encounter"))
2382      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
2383    if (json.has("date"))
2384      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2385    if (json.has("_date"))
2386      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
2387    if (json.has("detected"))
2388      res.setDetectedElement(parseDateTime(json.get("detected").getAsString()));
2389    if (json.has("_detected"))
2390      parseElementProperties(json.getAsJsonObject("_detected"), res.getDetectedElement());
2391    if (json.has("recordedDate"))
2392      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
2393    if (json.has("_recordedDate"))
2394      parseElementProperties(json.getAsJsonObject("_recordedDate"), res.getRecordedDateElement());
2395    if (json.has("resultingCondition")) {
2396      JsonArray array = json.getAsJsonArray("resultingCondition");
2397      for (int i = 0; i < array.size(); i++) {
2398        res.getResultingCondition().add(parseReference(array.get(i).getAsJsonObject()));
2399      }
2400    };
2401    if (json.has("location"))
2402      res.setLocation(parseReference(json.getAsJsonObject("location")));
2403    if (json.has("seriousness"))
2404      res.setSeriousness(parseCodeableConcept(json.getAsJsonObject("seriousness")));
2405    if (json.has("severity"))
2406      res.setSeverity(parseCodeableConcept(json.getAsJsonObject("severity")));
2407    if (json.has("outcome"))
2408      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
2409    if (json.has("recorder"))
2410      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
2411    if (json.has("contributor")) {
2412      JsonArray array = json.getAsJsonArray("contributor");
2413      for (int i = 0; i < array.size(); i++) {
2414        res.getContributor().add(parseReference(array.get(i).getAsJsonObject()));
2415      }
2416    };
2417    if (json.has("suspectEntity")) {
2418      JsonArray array = json.getAsJsonArray("suspectEntity");
2419      for (int i = 0; i < array.size(); i++) {
2420        res.getSuspectEntity().add(parseAdverseEventAdverseEventSuspectEntityComponent(array.get(i).getAsJsonObject(), res));
2421      }
2422    };
2423    if (json.has("subjectMedicalHistory")) {
2424      JsonArray array = json.getAsJsonArray("subjectMedicalHistory");
2425      for (int i = 0; i < array.size(); i++) {
2426        res.getSubjectMedicalHistory().add(parseReference(array.get(i).getAsJsonObject()));
2427      }
2428    };
2429    if (json.has("referenceDocument")) {
2430      JsonArray array = json.getAsJsonArray("referenceDocument");
2431      for (int i = 0; i < array.size(); i++) {
2432        res.getReferenceDocument().add(parseReference(array.get(i).getAsJsonObject()));
2433      }
2434    };
2435    if (json.has("study")) {
2436      JsonArray array = json.getAsJsonArray("study");
2437      for (int i = 0; i < array.size(); i++) {
2438        res.getStudy().add(parseReference(array.get(i).getAsJsonObject()));
2439      }
2440    };
2441  }
2442
2443  protected AdverseEvent.AdverseEventSuspectEntityComponent parseAdverseEventAdverseEventSuspectEntityComponent(JsonObject json, AdverseEvent owner) throws IOException, FHIRFormatError {
2444    AdverseEvent.AdverseEventSuspectEntityComponent res = new AdverseEvent.AdverseEventSuspectEntityComponent();
2445    parseAdverseEventAdverseEventSuspectEntityComponentProperties(json, owner, res);
2446    return res;
2447  }
2448
2449  protected void parseAdverseEventAdverseEventSuspectEntityComponentProperties(JsonObject json, AdverseEvent owner, AdverseEvent.AdverseEventSuspectEntityComponent res) throws IOException, FHIRFormatError {
2450    parseBackboneElementProperties(json, res);
2451    if (json.has("instance"))
2452      res.setInstance(parseReference(json.getAsJsonObject("instance")));
2453    if (json.has("causality")) {
2454      JsonArray array = json.getAsJsonArray("causality");
2455      for (int i = 0; i < array.size(); i++) {
2456        res.getCausality().add(parseAdverseEventAdverseEventSuspectEntityCausalityComponent(array.get(i).getAsJsonObject(), owner));
2457      }
2458    };
2459  }
2460
2461  protected AdverseEvent.AdverseEventSuspectEntityCausalityComponent parseAdverseEventAdverseEventSuspectEntityCausalityComponent(JsonObject json, AdverseEvent owner) throws IOException, FHIRFormatError {
2462    AdverseEvent.AdverseEventSuspectEntityCausalityComponent res = new AdverseEvent.AdverseEventSuspectEntityCausalityComponent();
2463    parseAdverseEventAdverseEventSuspectEntityCausalityComponentProperties(json, owner, res);
2464    return res;
2465  }
2466
2467  protected void parseAdverseEventAdverseEventSuspectEntityCausalityComponentProperties(JsonObject json, AdverseEvent owner, AdverseEvent.AdverseEventSuspectEntityCausalityComponent res) throws IOException, FHIRFormatError {
2468    parseBackboneElementProperties(json, res);
2469    if (json.has("assessment"))
2470      res.setAssessment(parseCodeableConcept(json.getAsJsonObject("assessment")));
2471    if (json.has("productRelatedness"))
2472      res.setProductRelatednessElement(parseString(json.get("productRelatedness").getAsString()));
2473    if (json.has("_productRelatedness"))
2474      parseElementProperties(json.getAsJsonObject("_productRelatedness"), res.getProductRelatednessElement());
2475    if (json.has("author"))
2476      res.setAuthor(parseReference(json.getAsJsonObject("author")));
2477    if (json.has("method"))
2478      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
2479  }
2480
2481  protected AllergyIntolerance parseAllergyIntolerance(JsonObject json) throws IOException, FHIRFormatError {
2482    AllergyIntolerance res = new AllergyIntolerance();
2483    parseAllergyIntoleranceProperties(json, res);
2484    return res;
2485  }
2486
2487  protected void parseAllergyIntoleranceProperties(JsonObject json, AllergyIntolerance res) throws IOException, FHIRFormatError {
2488    parseDomainResourceProperties(json, res);
2489    if (json.has("identifier")) {
2490      JsonArray array = json.getAsJsonArray("identifier");
2491      for (int i = 0; i < array.size(); i++) {
2492        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2493      }
2494    };
2495    if (json.has("clinicalStatus"))
2496      res.setClinicalStatus(parseCodeableConcept(json.getAsJsonObject("clinicalStatus")));
2497    if (json.has("verificationStatus"))
2498      res.setVerificationStatus(parseCodeableConcept(json.getAsJsonObject("verificationStatus")));
2499    if (json.has("type"))
2500      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AllergyIntolerance.AllergyIntoleranceType.NULL, new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory()));
2501    if (json.has("_type"))
2502      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2503    if (json.has("category")) {
2504      JsonArray array = json.getAsJsonArray("category");
2505      for (int i = 0; i < array.size(); i++) {
2506        res.getCategory().add(parseEnumeration(array.get(i).getAsString(), AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2507      }
2508    };
2509    if (json.has("_category")) {
2510      JsonArray array = json.getAsJsonArray("_category");
2511      for (int i = 0; i < array.size(); i++) {
2512        if (i == res.getCategory().size())
2513          res.getCategory().add(parseEnumeration(null, AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2514        if (array.get(i) instanceof JsonObject) 
2515          parseElementProperties(array.get(i).getAsJsonObject(), res.getCategory().get(i));
2516      }
2517    };
2518    if (json.has("criticality"))
2519      res.setCriticalityElement(parseEnumeration(json.get("criticality").getAsString(), AllergyIntolerance.AllergyIntoleranceCriticality.NULL, new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()));
2520    if (json.has("_criticality"))
2521      parseElementProperties(json.getAsJsonObject("_criticality"), res.getCriticalityElement());
2522    if (json.has("code"))
2523      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2524    if (json.has("patient"))
2525      res.setPatient(parseReference(json.getAsJsonObject("patient")));
2526    if (json.has("encounter"))
2527      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
2528    Type onset = parseType("onset", json);
2529    if (onset != null)
2530      res.setOnset(onset);
2531    if (json.has("recordedDate"))
2532      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
2533    if (json.has("_recordedDate"))
2534      parseElementProperties(json.getAsJsonObject("_recordedDate"), res.getRecordedDateElement());
2535    if (json.has("recorder"))
2536      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
2537    if (json.has("asserter"))
2538      res.setAsserter(parseReference(json.getAsJsonObject("asserter")));
2539    if (json.has("lastOccurrence"))
2540      res.setLastOccurrenceElement(parseDateTime(json.get("lastOccurrence").getAsString()));
2541    if (json.has("_lastOccurrence"))
2542      parseElementProperties(json.getAsJsonObject("_lastOccurrence"), res.getLastOccurrenceElement());
2543    if (json.has("note")) {
2544      JsonArray array = json.getAsJsonArray("note");
2545      for (int i = 0; i < array.size(); i++) {
2546        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2547      }
2548    };
2549    if (json.has("reaction")) {
2550      JsonArray array = json.getAsJsonArray("reaction");
2551      for (int i = 0; i < array.size(); i++) {
2552        res.getReaction().add(parseAllergyIntoleranceAllergyIntoleranceReactionComponent(array.get(i).getAsJsonObject(), res));
2553      }
2554    };
2555  }
2556
2557  protected AllergyIntolerance.AllergyIntoleranceReactionComponent parseAllergyIntoleranceAllergyIntoleranceReactionComponent(JsonObject json, AllergyIntolerance owner) throws IOException, FHIRFormatError {
2558    AllergyIntolerance.AllergyIntoleranceReactionComponent res = new AllergyIntolerance.AllergyIntoleranceReactionComponent();
2559    parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(json, owner, res);
2560    return res;
2561  }
2562
2563  protected void parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(JsonObject json, AllergyIntolerance owner, AllergyIntolerance.AllergyIntoleranceReactionComponent res) throws IOException, FHIRFormatError {
2564    parseBackboneElementProperties(json, res);
2565    if (json.has("substance"))
2566      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
2567    if (json.has("manifestation")) {
2568      JsonArray array = json.getAsJsonArray("manifestation");
2569      for (int i = 0; i < array.size(); i++) {
2570        res.getManifestation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2571      }
2572    };
2573    if (json.has("description"))
2574      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2575    if (json.has("_description"))
2576      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2577    if (json.has("onset"))
2578      res.setOnsetElement(parseDateTime(json.get("onset").getAsString()));
2579    if (json.has("_onset"))
2580      parseElementProperties(json.getAsJsonObject("_onset"), res.getOnsetElement());
2581    if (json.has("severity"))
2582      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), AllergyIntolerance.AllergyIntoleranceSeverity.NULL, new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()));
2583    if (json.has("_severity"))
2584      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
2585    if (json.has("exposureRoute"))
2586      res.setExposureRoute(parseCodeableConcept(json.getAsJsonObject("exposureRoute")));
2587    if (json.has("note")) {
2588      JsonArray array = json.getAsJsonArray("note");
2589      for (int i = 0; i < array.size(); i++) {
2590        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2591      }
2592    };
2593  }
2594
2595  protected Appointment parseAppointment(JsonObject json) throws IOException, FHIRFormatError {
2596    Appointment res = new Appointment();
2597    parseAppointmentProperties(json, res);
2598    return res;
2599  }
2600
2601  protected void parseAppointmentProperties(JsonObject json, Appointment res) throws IOException, FHIRFormatError {
2602    parseDomainResourceProperties(json, res);
2603    if (json.has("identifier")) {
2604      JsonArray array = json.getAsJsonArray("identifier");
2605      for (int i = 0; i < array.size(); i++) {
2606        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2607      }
2608    };
2609    if (json.has("status"))
2610      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.AppointmentStatus.NULL, new Appointment.AppointmentStatusEnumFactory()));
2611    if (json.has("_status"))
2612      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2613    if (json.has("cancelationReason"))
2614      res.setCancelationReason(parseCodeableConcept(json.getAsJsonObject("cancelationReason")));
2615    if (json.has("serviceCategory")) {
2616      JsonArray array = json.getAsJsonArray("serviceCategory");
2617      for (int i = 0; i < array.size(); i++) {
2618        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2619      }
2620    };
2621    if (json.has("serviceType")) {
2622      JsonArray array = json.getAsJsonArray("serviceType");
2623      for (int i = 0; i < array.size(); i++) {
2624        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2625      }
2626    };
2627    if (json.has("specialty")) {
2628      JsonArray array = json.getAsJsonArray("specialty");
2629      for (int i = 0; i < array.size(); i++) {
2630        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2631      }
2632    };
2633    if (json.has("appointmentType"))
2634      res.setAppointmentType(parseCodeableConcept(json.getAsJsonObject("appointmentType")));
2635    if (json.has("reasonCode")) {
2636      JsonArray array = json.getAsJsonArray("reasonCode");
2637      for (int i = 0; i < array.size(); i++) {
2638        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2639      }
2640    };
2641    if (json.has("reasonReference")) {
2642      JsonArray array = json.getAsJsonArray("reasonReference");
2643      for (int i = 0; i < array.size(); i++) {
2644        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
2645      }
2646    };
2647    if (json.has("priority"))
2648      res.setPriorityElement(parseUnsignedInt(json.get("priority").getAsString()));
2649    if (json.has("_priority"))
2650      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
2651    if (json.has("description"))
2652      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2653    if (json.has("_description"))
2654      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2655    if (json.has("supportingInformation")) {
2656      JsonArray array = json.getAsJsonArray("supportingInformation");
2657      for (int i = 0; i < array.size(); i++) {
2658        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
2659      }
2660    };
2661    if (json.has("start"))
2662      res.setStartElement(parseInstant(json.get("start").getAsString()));
2663    if (json.has("_start"))
2664      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
2665    if (json.has("end"))
2666      res.setEndElement(parseInstant(json.get("end").getAsString()));
2667    if (json.has("_end"))
2668      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
2669    if (json.has("minutesDuration"))
2670      res.setMinutesDurationElement(parsePositiveInt(json.get("minutesDuration").getAsString()));
2671    if (json.has("_minutesDuration"))
2672      parseElementProperties(json.getAsJsonObject("_minutesDuration"), res.getMinutesDurationElement());
2673    if (json.has("slot")) {
2674      JsonArray array = json.getAsJsonArray("slot");
2675      for (int i = 0; i < array.size(); i++) {
2676        res.getSlot().add(parseReference(array.get(i).getAsJsonObject()));
2677      }
2678    };
2679    if (json.has("created"))
2680      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
2681    if (json.has("_created"))
2682      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
2683    if (json.has("comment"))
2684      res.setCommentElement(parseString(json.get("comment").getAsString()));
2685    if (json.has("_comment"))
2686      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
2687    if (json.has("patientInstruction"))
2688      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
2689    if (json.has("_patientInstruction"))
2690      parseElementProperties(json.getAsJsonObject("_patientInstruction"), res.getPatientInstructionElement());
2691    if (json.has("basedOn")) {
2692      JsonArray array = json.getAsJsonArray("basedOn");
2693      for (int i = 0; i < array.size(); i++) {
2694        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
2695      }
2696    };
2697    if (json.has("participant")) {
2698      JsonArray array = json.getAsJsonArray("participant");
2699      for (int i = 0; i < array.size(); i++) {
2700        res.getParticipant().add(parseAppointmentAppointmentParticipantComponent(array.get(i).getAsJsonObject(), res));
2701      }
2702    };
2703    if (json.has("requestedPeriod")) {
2704      JsonArray array = json.getAsJsonArray("requestedPeriod");
2705      for (int i = 0; i < array.size(); i++) {
2706        res.getRequestedPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
2707      }
2708    };
2709  }
2710
2711  protected Appointment.AppointmentParticipantComponent parseAppointmentAppointmentParticipantComponent(JsonObject json, Appointment owner) throws IOException, FHIRFormatError {
2712    Appointment.AppointmentParticipantComponent res = new Appointment.AppointmentParticipantComponent();
2713    parseAppointmentAppointmentParticipantComponentProperties(json, owner, res);
2714    return res;
2715  }
2716
2717  protected void parseAppointmentAppointmentParticipantComponentProperties(JsonObject json, Appointment owner, Appointment.AppointmentParticipantComponent res) throws IOException, FHIRFormatError {
2718    parseBackboneElementProperties(json, res);
2719    if (json.has("type")) {
2720      JsonArray array = json.getAsJsonArray("type");
2721      for (int i = 0; i < array.size(); i++) {
2722        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2723      }
2724    };
2725    if (json.has("actor"))
2726      res.setActor(parseReference(json.getAsJsonObject("actor")));
2727    if (json.has("required"))
2728      res.setRequiredElement(parseEnumeration(json.get("required").getAsString(), Appointment.ParticipantRequired.NULL, new Appointment.ParticipantRequiredEnumFactory()));
2729    if (json.has("_required"))
2730      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
2731    if (json.has("status"))
2732      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.ParticipationStatus.NULL, new Appointment.ParticipationStatusEnumFactory()));
2733    if (json.has("_status"))
2734      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2735    if (json.has("period"))
2736      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
2737  }
2738
2739  protected AppointmentResponse parseAppointmentResponse(JsonObject json) throws IOException, FHIRFormatError {
2740    AppointmentResponse res = new AppointmentResponse();
2741    parseAppointmentResponseProperties(json, res);
2742    return res;
2743  }
2744
2745  protected void parseAppointmentResponseProperties(JsonObject json, AppointmentResponse res) throws IOException, FHIRFormatError {
2746    parseDomainResourceProperties(json, res);
2747    if (json.has("identifier")) {
2748      JsonArray array = json.getAsJsonArray("identifier");
2749      for (int i = 0; i < array.size(); i++) {
2750        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2751      }
2752    };
2753    if (json.has("appointment"))
2754      res.setAppointment(parseReference(json.getAsJsonObject("appointment")));
2755    if (json.has("start"))
2756      res.setStartElement(parseInstant(json.get("start").getAsString()));
2757    if (json.has("_start"))
2758      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
2759    if (json.has("end"))
2760      res.setEndElement(parseInstant(json.get("end").getAsString()));
2761    if (json.has("_end"))
2762      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
2763    if (json.has("participantType")) {
2764      JsonArray array = json.getAsJsonArray("participantType");
2765      for (int i = 0; i < array.size(); i++) {
2766        res.getParticipantType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2767      }
2768    };
2769    if (json.has("actor"))
2770      res.setActor(parseReference(json.getAsJsonObject("actor")));
2771    if (json.has("participantStatus"))
2772      res.setParticipantStatusElement(parseEnumeration(json.get("participantStatus").getAsString(), AppointmentResponse.ParticipantStatus.NULL, new AppointmentResponse.ParticipantStatusEnumFactory()));
2773    if (json.has("_participantStatus"))
2774      parseElementProperties(json.getAsJsonObject("_participantStatus"), res.getParticipantStatusElement());
2775    if (json.has("comment"))
2776      res.setCommentElement(parseString(json.get("comment").getAsString()));
2777    if (json.has("_comment"))
2778      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
2779  }
2780
2781  protected AuditEvent parseAuditEvent(JsonObject json) throws IOException, FHIRFormatError {
2782    AuditEvent res = new AuditEvent();
2783    parseAuditEventProperties(json, res);
2784    return res;
2785  }
2786
2787  protected void parseAuditEventProperties(JsonObject json, AuditEvent res) throws IOException, FHIRFormatError {
2788    parseDomainResourceProperties(json, res);
2789    if (json.has("type"))
2790      res.setType(parseCoding(json.getAsJsonObject("type")));
2791    if (json.has("subtype")) {
2792      JsonArray array = json.getAsJsonArray("subtype");
2793      for (int i = 0; i < array.size(); i++) {
2794        res.getSubtype().add(parseCoding(array.get(i).getAsJsonObject()));
2795      }
2796    };
2797    if (json.has("action"))
2798      res.setActionElement(parseEnumeration(json.get("action").getAsString(), AuditEvent.AuditEventAction.NULL, new AuditEvent.AuditEventActionEnumFactory()));
2799    if (json.has("_action"))
2800      parseElementProperties(json.getAsJsonObject("_action"), res.getActionElement());
2801    if (json.has("period"))
2802      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
2803    if (json.has("recorded"))
2804      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
2805    if (json.has("_recorded"))
2806      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
2807    if (json.has("outcome"))
2808      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), AuditEvent.AuditEventOutcome.NULL, new AuditEvent.AuditEventOutcomeEnumFactory()));
2809    if (json.has("_outcome"))
2810      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
2811    if (json.has("outcomeDesc"))
2812      res.setOutcomeDescElement(parseString(json.get("outcomeDesc").getAsString()));
2813    if (json.has("_outcomeDesc"))
2814      parseElementProperties(json.getAsJsonObject("_outcomeDesc"), res.getOutcomeDescElement());
2815    if (json.has("purposeOfEvent")) {
2816      JsonArray array = json.getAsJsonArray("purposeOfEvent");
2817      for (int i = 0; i < array.size(); i++) {
2818        res.getPurposeOfEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2819      }
2820    };
2821    if (json.has("agent")) {
2822      JsonArray array = json.getAsJsonArray("agent");
2823      for (int i = 0; i < array.size(); i++) {
2824        res.getAgent().add(parseAuditEventAuditEventAgentComponent(array.get(i).getAsJsonObject(), res));
2825      }
2826    };
2827    if (json.has("source"))
2828      res.setSource(parseAuditEventAuditEventSourceComponent(json.getAsJsonObject("source"), res));
2829    if (json.has("entity")) {
2830      JsonArray array = json.getAsJsonArray("entity");
2831      for (int i = 0; i < array.size(); i++) {
2832        res.getEntity().add(parseAuditEventAuditEventEntityComponent(array.get(i).getAsJsonObject(), res));
2833      }
2834    };
2835  }
2836
2837  protected AuditEvent.AuditEventAgentComponent parseAuditEventAuditEventAgentComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2838    AuditEvent.AuditEventAgentComponent res = new AuditEvent.AuditEventAgentComponent();
2839    parseAuditEventAuditEventAgentComponentProperties(json, owner, res);
2840    return res;
2841  }
2842
2843  protected void parseAuditEventAuditEventAgentComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventAgentComponent res) throws IOException, FHIRFormatError {
2844    parseBackboneElementProperties(json, res);
2845    if (json.has("type"))
2846      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
2847    if (json.has("role")) {
2848      JsonArray array = json.getAsJsonArray("role");
2849      for (int i = 0; i < array.size(); i++) {
2850        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2851      }
2852    };
2853    if (json.has("who"))
2854      res.setWho(parseReference(json.getAsJsonObject("who")));
2855    if (json.has("altId"))
2856      res.setAltIdElement(parseString(json.get("altId").getAsString()));
2857    if (json.has("_altId"))
2858      parseElementProperties(json.getAsJsonObject("_altId"), res.getAltIdElement());
2859    if (json.has("name"))
2860      res.setNameElement(parseString(json.get("name").getAsString()));
2861    if (json.has("_name"))
2862      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2863    if (json.has("requestor"))
2864      res.setRequestorElement(parseBoolean(json.get("requestor").getAsBoolean()));
2865    if (json.has("_requestor"))
2866      parseElementProperties(json.getAsJsonObject("_requestor"), res.getRequestorElement());
2867    if (json.has("location"))
2868      res.setLocation(parseReference(json.getAsJsonObject("location")));
2869    if (json.has("policy")) {
2870      JsonArray array = json.getAsJsonArray("policy");
2871      for (int i = 0; i < array.size(); i++) {
2872        res.getPolicy().add(parseUri(array.get(i).getAsString()));
2873      }
2874    };
2875    if (json.has("_policy")) {
2876      JsonArray array = json.getAsJsonArray("_policy");
2877      for (int i = 0; i < array.size(); i++) {
2878        if (i == res.getPolicy().size())
2879          res.getPolicy().add(parseUri(null));
2880        if (array.get(i) instanceof JsonObject) 
2881          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
2882      }
2883    };
2884    if (json.has("media"))
2885      res.setMedia(parseCoding(json.getAsJsonObject("media")));
2886    if (json.has("network"))
2887      res.setNetwork(parseAuditEventAuditEventAgentNetworkComponent(json.getAsJsonObject("network"), owner));
2888    if (json.has("purposeOfUse")) {
2889      JsonArray array = json.getAsJsonArray("purposeOfUse");
2890      for (int i = 0; i < array.size(); i++) {
2891        res.getPurposeOfUse().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2892      }
2893    };
2894  }
2895
2896  protected AuditEvent.AuditEventAgentNetworkComponent parseAuditEventAuditEventAgentNetworkComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2897    AuditEvent.AuditEventAgentNetworkComponent res = new AuditEvent.AuditEventAgentNetworkComponent();
2898    parseAuditEventAuditEventAgentNetworkComponentProperties(json, owner, res);
2899    return res;
2900  }
2901
2902  protected void parseAuditEventAuditEventAgentNetworkComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventAgentNetworkComponent res) throws IOException, FHIRFormatError {
2903    parseBackboneElementProperties(json, res);
2904    if (json.has("address"))
2905      res.setAddressElement(parseString(json.get("address").getAsString()));
2906    if (json.has("_address"))
2907      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
2908    if (json.has("type"))
2909      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AuditEvent.AuditEventAgentNetworkType.NULL, new AuditEvent.AuditEventAgentNetworkTypeEnumFactory()));
2910    if (json.has("_type"))
2911      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2912  }
2913
2914  protected AuditEvent.AuditEventSourceComponent parseAuditEventAuditEventSourceComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2915    AuditEvent.AuditEventSourceComponent res = new AuditEvent.AuditEventSourceComponent();
2916    parseAuditEventAuditEventSourceComponentProperties(json, owner, res);
2917    return res;
2918  }
2919
2920  protected void parseAuditEventAuditEventSourceComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventSourceComponent res) throws IOException, FHIRFormatError {
2921    parseBackboneElementProperties(json, res);
2922    if (json.has("site"))
2923      res.setSiteElement(parseString(json.get("site").getAsString()));
2924    if (json.has("_site"))
2925      parseElementProperties(json.getAsJsonObject("_site"), res.getSiteElement());
2926    if (json.has("observer"))
2927      res.setObserver(parseReference(json.getAsJsonObject("observer")));
2928    if (json.has("type")) {
2929      JsonArray array = json.getAsJsonArray("type");
2930      for (int i = 0; i < array.size(); i++) {
2931        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
2932      }
2933    };
2934  }
2935
2936  protected AuditEvent.AuditEventEntityComponent parseAuditEventAuditEventEntityComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2937    AuditEvent.AuditEventEntityComponent res = new AuditEvent.AuditEventEntityComponent();
2938    parseAuditEventAuditEventEntityComponentProperties(json, owner, res);
2939    return res;
2940  }
2941
2942  protected void parseAuditEventAuditEventEntityComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventEntityComponent res) throws IOException, FHIRFormatError {
2943    parseBackboneElementProperties(json, res);
2944    if (json.has("what"))
2945      res.setWhat(parseReference(json.getAsJsonObject("what")));
2946    if (json.has("type"))
2947      res.setType(parseCoding(json.getAsJsonObject("type")));
2948    if (json.has("role"))
2949      res.setRole(parseCoding(json.getAsJsonObject("role")));
2950    if (json.has("lifecycle"))
2951      res.setLifecycle(parseCoding(json.getAsJsonObject("lifecycle")));
2952    if (json.has("securityLabel")) {
2953      JsonArray array = json.getAsJsonArray("securityLabel");
2954      for (int i = 0; i < array.size(); i++) {
2955        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
2956      }
2957    };
2958    if (json.has("name"))
2959      res.setNameElement(parseString(json.get("name").getAsString()));
2960    if (json.has("_name"))
2961      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2962    if (json.has("description"))
2963      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2964    if (json.has("_description"))
2965      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2966    if (json.has("query"))
2967      res.setQueryElement(parseBase64Binary(json.get("query").getAsString()));
2968    if (json.has("_query"))
2969      parseElementProperties(json.getAsJsonObject("_query"), res.getQueryElement());
2970    if (json.has("detail")) {
2971      JsonArray array = json.getAsJsonArray("detail");
2972      for (int i = 0; i < array.size(); i++) {
2973        res.getDetail().add(parseAuditEventAuditEventEntityDetailComponent(array.get(i).getAsJsonObject(), owner));
2974      }
2975    };
2976  }
2977
2978  protected AuditEvent.AuditEventEntityDetailComponent parseAuditEventAuditEventEntityDetailComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2979    AuditEvent.AuditEventEntityDetailComponent res = new AuditEvent.AuditEventEntityDetailComponent();
2980    parseAuditEventAuditEventEntityDetailComponentProperties(json, owner, res);
2981    return res;
2982  }
2983
2984  protected void parseAuditEventAuditEventEntityDetailComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventEntityDetailComponent res) throws IOException, FHIRFormatError {
2985    parseBackboneElementProperties(json, res);
2986    if (json.has("type"))
2987      res.setTypeElement(parseString(json.get("type").getAsString()));
2988    if (json.has("_type"))
2989      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2990    Type value = parseType("value", json);
2991    if (value != null)
2992      res.setValue(value);
2993  }
2994
2995  protected Basic parseBasic(JsonObject json) throws IOException, FHIRFormatError {
2996    Basic res = new Basic();
2997    parseBasicProperties(json, res);
2998    return res;
2999  }
3000
3001  protected void parseBasicProperties(JsonObject json, Basic res) throws IOException, FHIRFormatError {
3002    parseDomainResourceProperties(json, res);
3003    if (json.has("identifier")) {
3004      JsonArray array = json.getAsJsonArray("identifier");
3005      for (int i = 0; i < array.size(); i++) {
3006        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3007      }
3008    };
3009    if (json.has("code"))
3010      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
3011    if (json.has("subject"))
3012      res.setSubject(parseReference(json.getAsJsonObject("subject")));
3013    if (json.has("created"))
3014      res.setCreatedElement(parseDate(json.get("created").getAsString()));
3015    if (json.has("_created"))
3016      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
3017    if (json.has("author"))
3018      res.setAuthor(parseReference(json.getAsJsonObject("author")));
3019  }
3020
3021  protected Binary parseBinary(JsonObject json) throws IOException, FHIRFormatError {
3022    Binary res = new Binary();
3023    parseBinaryProperties(json, res);
3024    return res;
3025  }
3026
3027  protected void parseBinaryProperties(JsonObject json, Binary res) throws IOException, FHIRFormatError {
3028    parseResourceProperties(json, res);
3029    if (json.has("contentType"))
3030      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
3031    if (json.has("_contentType"))
3032      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
3033    if (json.has("securityContext"))
3034      res.setSecurityContext(parseReference(json.getAsJsonObject("securityContext")));
3035    if (json.has("data"))
3036      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
3037    if (json.has("_data"))
3038      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
3039  }
3040
3041  protected BiologicallyDerivedProduct parseBiologicallyDerivedProduct(JsonObject json) throws IOException, FHIRFormatError {
3042    BiologicallyDerivedProduct res = new BiologicallyDerivedProduct();
3043    parseBiologicallyDerivedProductProperties(json, res);
3044    return res;
3045  }
3046
3047  protected void parseBiologicallyDerivedProductProperties(JsonObject json, BiologicallyDerivedProduct res) throws IOException, FHIRFormatError {
3048    parseDomainResourceProperties(json, res);
3049    if (json.has("identifier")) {
3050      JsonArray array = json.getAsJsonArray("identifier");
3051      for (int i = 0; i < array.size(); i++) {
3052        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3053      }
3054    };
3055    if (json.has("productCategory"))
3056      res.setProductCategoryElement(parseEnumeration(json.get("productCategory").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory()));
3057    if (json.has("_productCategory"))
3058      parseElementProperties(json.getAsJsonObject("_productCategory"), res.getProductCategoryElement());
3059    if (json.has("productCode"))
3060      res.setProductCode(parseCodeableConcept(json.getAsJsonObject("productCode")));
3061    if (json.has("status"))
3062      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductStatus.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory()));
3063    if (json.has("_status"))
3064      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3065    if (json.has("request")) {
3066      JsonArray array = json.getAsJsonArray("request");
3067      for (int i = 0; i < array.size(); i++) {
3068        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
3069      }
3070    };
3071    if (json.has("quantity"))
3072      res.setQuantityElement(parseInteger(json.get("quantity").getAsLong()));
3073    if (json.has("_quantity"))
3074      parseElementProperties(json.getAsJsonObject("_quantity"), res.getQuantityElement());
3075    if (json.has("parent")) {
3076      JsonArray array = json.getAsJsonArray("parent");
3077      for (int i = 0; i < array.size(); i++) {
3078        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
3079      }
3080    };
3081    if (json.has("collection"))
3082      res.setCollection(parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(json.getAsJsonObject("collection"), res));
3083    if (json.has("processing")) {
3084      JsonArray array = json.getAsJsonArray("processing");
3085      for (int i = 0; i < array.size(); i++) {
3086        res.getProcessing().add(parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(array.get(i).getAsJsonObject(), res));
3087      }
3088    };
3089    if (json.has("manipulation"))
3090      res.setManipulation(parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(json.getAsJsonObject("manipulation"), res));
3091    if (json.has("storage")) {
3092      JsonArray array = json.getAsJsonArray("storage");
3093      for (int i = 0; i < array.size(); i++) {
3094        res.getStorage().add(parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(array.get(i).getAsJsonObject(), res));
3095      }
3096    };
3097  }
3098
3099  protected BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3100    BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent();
3101    parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentProperties(json, owner, res);
3102    return res;
3103  }
3104
3105  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res) throws IOException, FHIRFormatError {
3106    parseBackboneElementProperties(json, res);
3107    if (json.has("collector"))
3108      res.setCollector(parseReference(json.getAsJsonObject("collector")));
3109    if (json.has("source"))
3110      res.setSource(parseReference(json.getAsJsonObject("source")));
3111    Type collected = parseType("collected", json);
3112    if (collected != null)
3113      res.setCollected(collected);
3114  }
3115
3116  protected BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3117    BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent();
3118    parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentProperties(json, owner, res);
3119    return res;
3120  }
3121
3122  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent res) throws IOException, FHIRFormatError {
3123    parseBackboneElementProperties(json, res);
3124    if (json.has("description"))
3125      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3126    if (json.has("_description"))
3127      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3128    if (json.has("procedure"))
3129      res.setProcedure(parseCodeableConcept(json.getAsJsonObject("procedure")));
3130    if (json.has("additive"))
3131      res.setAdditive(parseReference(json.getAsJsonObject("additive")));
3132    Type time = parseType("time", json);
3133    if (time != null)
3134      res.setTime(time);
3135  }
3136
3137  protected BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3138    BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent();
3139    parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentProperties(json, owner, res);
3140    return res;
3141  }
3142
3143  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent res) throws IOException, FHIRFormatError {
3144    parseBackboneElementProperties(json, res);
3145    if (json.has("description"))
3146      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3147    if (json.has("_description"))
3148      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3149    Type time = parseType("time", json);
3150    if (time != null)
3151      res.setTime(time);
3152  }
3153
3154  protected BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3155    BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent();
3156    parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentProperties(json, owner, res);
3157    return res;
3158  }
3159
3160  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent res) throws IOException, FHIRFormatError {
3161    parseBackboneElementProperties(json, res);
3162    if (json.has("description"))
3163      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3164    if (json.has("_description"))
3165      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3166    if (json.has("temperature"))
3167      res.setTemperatureElement(parseDecimal(json.get("temperature").getAsBigDecimal()));
3168    if (json.has("_temperature"))
3169      parseElementProperties(json.getAsJsonObject("_temperature"), res.getTemperatureElement());
3170    if (json.has("scale"))
3171      res.setScaleElement(parseEnumeration(json.get("scale").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScale.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory()));
3172    if (json.has("_scale"))
3173      parseElementProperties(json.getAsJsonObject("_scale"), res.getScaleElement());
3174    if (json.has("duration"))
3175      res.setDuration(parsePeriod(json.getAsJsonObject("duration")));
3176  }
3177
3178  protected BodyStructure parseBodyStructure(JsonObject json) throws IOException, FHIRFormatError {
3179    BodyStructure res = new BodyStructure();
3180    parseBodyStructureProperties(json, res);
3181    return res;
3182  }
3183
3184  protected void parseBodyStructureProperties(JsonObject json, BodyStructure res) throws IOException, FHIRFormatError {
3185    parseDomainResourceProperties(json, res);
3186    if (json.has("identifier")) {
3187      JsonArray array = json.getAsJsonArray("identifier");
3188      for (int i = 0; i < array.size(); i++) {
3189        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3190      }
3191    };
3192    if (json.has("active"))
3193      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
3194    if (json.has("_active"))
3195      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
3196    if (json.has("morphology"))
3197      res.setMorphology(parseCodeableConcept(json.getAsJsonObject("morphology")));
3198    if (json.has("location"))
3199      res.setLocation(parseCodeableConcept(json.getAsJsonObject("location")));
3200    if (json.has("locationQualifier")) {
3201      JsonArray array = json.getAsJsonArray("locationQualifier");
3202      for (int i = 0; i < array.size(); i++) {
3203        res.getLocationQualifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3204      }
3205    };
3206    if (json.has("description"))
3207      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3208    if (json.has("_description"))
3209      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3210    if (json.has("image")) {
3211      JsonArray array = json.getAsJsonArray("image");
3212      for (int i = 0; i < array.size(); i++) {
3213        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
3214      }
3215    };
3216    if (json.has("patient"))
3217      res.setPatient(parseReference(json.getAsJsonObject("patient")));
3218  }
3219
3220  protected Bundle parseBundle(JsonObject json) throws IOException, FHIRFormatError {
3221    Bundle res = new Bundle();
3222    parseBundleProperties(json, res);
3223    return res;
3224  }
3225
3226  protected void parseBundleProperties(JsonObject json, Bundle res) throws IOException, FHIRFormatError {
3227    parseResourceProperties(json, res);
3228    if (json.has("identifier"))
3229      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
3230    if (json.has("type"))
3231      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Bundle.BundleType.NULL, new Bundle.BundleTypeEnumFactory()));
3232    if (json.has("_type"))
3233      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3234    if (json.has("timestamp"))
3235      res.setTimestampElement(parseInstant(json.get("timestamp").getAsString()));
3236    if (json.has("_timestamp"))
3237      parseElementProperties(json.getAsJsonObject("_timestamp"), res.getTimestampElement());
3238    if (json.has("total"))
3239      res.setTotalElement(parseUnsignedInt(json.get("total").getAsString()));
3240    if (json.has("_total"))
3241      parseElementProperties(json.getAsJsonObject("_total"), res.getTotalElement());
3242    if (json.has("link")) {
3243      JsonArray array = json.getAsJsonArray("link");
3244      for (int i = 0; i < array.size(); i++) {
3245        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), res));
3246      }
3247    };
3248    if (json.has("entry")) {
3249      JsonArray array = json.getAsJsonArray("entry");
3250      for (int i = 0; i < array.size(); i++) {
3251        res.getEntry().add(parseBundleBundleEntryComponent(array.get(i).getAsJsonObject(), res));
3252      }
3253    };
3254    if (json.has("signature"))
3255      res.setSignature(parseSignature(json.getAsJsonObject("signature")));
3256  }
3257
3258  protected Bundle.BundleLinkComponent parseBundleBundleLinkComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3259    Bundle.BundleLinkComponent res = new Bundle.BundleLinkComponent();
3260    parseBundleBundleLinkComponentProperties(json, owner, res);
3261    return res;
3262  }
3263
3264  protected void parseBundleBundleLinkComponentProperties(JsonObject json, Bundle owner, Bundle.BundleLinkComponent res) throws IOException, FHIRFormatError {
3265    parseBackboneElementProperties(json, res);
3266    if (json.has("relation"))
3267      res.setRelationElement(parseString(json.get("relation").getAsString()));
3268    if (json.has("_relation"))
3269      parseElementProperties(json.getAsJsonObject("_relation"), res.getRelationElement());
3270    if (json.has("url"))
3271      res.setUrlElement(parseUri(json.get("url").getAsString()));
3272    if (json.has("_url"))
3273      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3274  }
3275
3276  protected Bundle.BundleEntryComponent parseBundleBundleEntryComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3277    Bundle.BundleEntryComponent res = new Bundle.BundleEntryComponent();
3278    parseBundleBundleEntryComponentProperties(json, owner, res);
3279    return res;
3280  }
3281
3282  protected void parseBundleBundleEntryComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryComponent res) throws IOException, FHIRFormatError {
3283    parseBackboneElementProperties(json, res);
3284    if (json.has("link")) {
3285      JsonArray array = json.getAsJsonArray("link");
3286      for (int i = 0; i < array.size(); i++) {
3287        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), owner));
3288      }
3289    };
3290    if (json.has("fullUrl"))
3291      res.setFullUrlElement(parseUri(json.get("fullUrl").getAsString()));
3292    if (json.has("_fullUrl"))
3293      parseElementProperties(json.getAsJsonObject("_fullUrl"), res.getFullUrlElement());
3294    if (json.has("resource"))
3295      res.setResource(parseResource(json.getAsJsonObject("resource")));
3296    if (json.has("search"))
3297      res.setSearch(parseBundleBundleEntrySearchComponent(json.getAsJsonObject("search"), owner));
3298    if (json.has("request"))
3299      res.setRequest(parseBundleBundleEntryRequestComponent(json.getAsJsonObject("request"), owner));
3300    if (json.has("response"))
3301      res.setResponse(parseBundleBundleEntryResponseComponent(json.getAsJsonObject("response"), owner));
3302  }
3303
3304  protected Bundle.BundleEntrySearchComponent parseBundleBundleEntrySearchComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3305    Bundle.BundleEntrySearchComponent res = new Bundle.BundleEntrySearchComponent();
3306    parseBundleBundleEntrySearchComponentProperties(json, owner, res);
3307    return res;
3308  }
3309
3310  protected void parseBundleBundleEntrySearchComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntrySearchComponent res) throws IOException, FHIRFormatError {
3311    parseBackboneElementProperties(json, res);
3312    if (json.has("mode"))
3313      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Bundle.SearchEntryMode.NULL, new Bundle.SearchEntryModeEnumFactory()));
3314    if (json.has("_mode"))
3315      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3316    if (json.has("score"))
3317      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
3318    if (json.has("_score"))
3319      parseElementProperties(json.getAsJsonObject("_score"), res.getScoreElement());
3320  }
3321
3322  protected Bundle.BundleEntryRequestComponent parseBundleBundleEntryRequestComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3323    Bundle.BundleEntryRequestComponent res = new Bundle.BundleEntryRequestComponent();
3324    parseBundleBundleEntryRequestComponentProperties(json, owner, res);
3325    return res;
3326  }
3327
3328  protected void parseBundleBundleEntryRequestComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryRequestComponent res) throws IOException, FHIRFormatError {
3329    parseBackboneElementProperties(json, res);
3330    if (json.has("method"))
3331      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), Bundle.HTTPVerb.NULL, new Bundle.HTTPVerbEnumFactory()));
3332    if (json.has("_method"))
3333      parseElementProperties(json.getAsJsonObject("_method"), res.getMethodElement());
3334    if (json.has("url"))
3335      res.setUrlElement(parseUri(json.get("url").getAsString()));
3336    if (json.has("_url"))
3337      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3338    if (json.has("ifNoneMatch"))
3339      res.setIfNoneMatchElement(parseString(json.get("ifNoneMatch").getAsString()));
3340    if (json.has("_ifNoneMatch"))
3341      parseElementProperties(json.getAsJsonObject("_ifNoneMatch"), res.getIfNoneMatchElement());
3342    if (json.has("ifModifiedSince"))
3343      res.setIfModifiedSinceElement(parseInstant(json.get("ifModifiedSince").getAsString()));
3344    if (json.has("_ifModifiedSince"))
3345      parseElementProperties(json.getAsJsonObject("_ifModifiedSince"), res.getIfModifiedSinceElement());
3346    if (json.has("ifMatch"))
3347      res.setIfMatchElement(parseString(json.get("ifMatch").getAsString()));
3348    if (json.has("_ifMatch"))
3349      parseElementProperties(json.getAsJsonObject("_ifMatch"), res.getIfMatchElement());
3350    if (json.has("ifNoneExist"))
3351      res.setIfNoneExistElement(parseString(json.get("ifNoneExist").getAsString()));
3352    if (json.has("_ifNoneExist"))
3353      parseElementProperties(json.getAsJsonObject("_ifNoneExist"), res.getIfNoneExistElement());
3354  }
3355
3356  protected Bundle.BundleEntryResponseComponent parseBundleBundleEntryResponseComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3357    Bundle.BundleEntryResponseComponent res = new Bundle.BundleEntryResponseComponent();
3358    parseBundleBundleEntryResponseComponentProperties(json, owner, res);
3359    return res;
3360  }
3361
3362  protected void parseBundleBundleEntryResponseComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryResponseComponent res) throws IOException, FHIRFormatError {
3363    parseBackboneElementProperties(json, res);
3364    if (json.has("status"))
3365      res.setStatusElement(parseString(json.get("status").getAsString()));
3366    if (json.has("_status"))
3367      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3368    if (json.has("location"))
3369      res.setLocationElement(parseUri(json.get("location").getAsString()));
3370    if (json.has("_location"))
3371      parseElementProperties(json.getAsJsonObject("_location"), res.getLocationElement());
3372    if (json.has("etag"))
3373      res.setEtagElement(parseString(json.get("etag").getAsString()));
3374    if (json.has("_etag"))
3375      parseElementProperties(json.getAsJsonObject("_etag"), res.getEtagElement());
3376    if (json.has("lastModified"))
3377      res.setLastModifiedElement(parseInstant(json.get("lastModified").getAsString()));
3378    if (json.has("_lastModified"))
3379      parseElementProperties(json.getAsJsonObject("_lastModified"), res.getLastModifiedElement());
3380    if (json.has("outcome"))
3381      res.setOutcome(parseResource(json.getAsJsonObject("outcome")));
3382  }
3383
3384  protected CapabilityStatement parseCapabilityStatement(JsonObject json) throws IOException, FHIRFormatError {
3385    CapabilityStatement res = new CapabilityStatement();
3386    parseCapabilityStatementProperties(json, res);
3387    return res;
3388  }
3389
3390  protected void parseCapabilityStatementProperties(JsonObject json, CapabilityStatement res) throws IOException, FHIRFormatError {
3391    parseDomainResourceProperties(json, res);
3392    if (json.has("url"))
3393      res.setUrlElement(parseUri(json.get("url").getAsString()));
3394    if (json.has("_url"))
3395      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3396    if (json.has("version"))
3397      res.setVersionElement(parseString(json.get("version").getAsString()));
3398    if (json.has("_version"))
3399      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
3400    if (json.has("name"))
3401      res.setNameElement(parseString(json.get("name").getAsString()));
3402    if (json.has("_name"))
3403      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3404    if (json.has("title"))
3405      res.setTitleElement(parseString(json.get("title").getAsString()));
3406    if (json.has("_title"))
3407      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
3408    if (json.has("status"))
3409      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
3410    if (json.has("_status"))
3411      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3412    if (json.has("experimental"))
3413      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
3414    if (json.has("_experimental"))
3415      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
3416    if (json.has("date"))
3417      res.setDateElement(parseDateTime(json.get("date").getAsString()));
3418    if (json.has("_date"))
3419      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
3420    if (json.has("publisher"))
3421      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
3422    if (json.has("_publisher"))
3423      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
3424    if (json.has("contact")) {
3425      JsonArray array = json.getAsJsonArray("contact");
3426      for (int i = 0; i < array.size(); i++) {
3427        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
3428      }
3429    };
3430    if (json.has("description"))
3431      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
3432    if (json.has("_description"))
3433      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3434    if (json.has("useContext")) {
3435      JsonArray array = json.getAsJsonArray("useContext");
3436      for (int i = 0; i < array.size(); i++) {
3437        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
3438      }
3439    };
3440    if (json.has("jurisdiction")) {
3441      JsonArray array = json.getAsJsonArray("jurisdiction");
3442      for (int i = 0; i < array.size(); i++) {
3443        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3444      }
3445    };
3446    if (json.has("purpose"))
3447      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
3448    if (json.has("_purpose"))
3449      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
3450    if (json.has("copyright"))
3451      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
3452    if (json.has("_copyright"))
3453      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
3454    if (json.has("kind"))
3455      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CapabilityStatement.CapabilityStatementKind.NULL, new CapabilityStatement.CapabilityStatementKindEnumFactory()));
3456    if (json.has("_kind"))
3457      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
3458    if (json.has("instantiates")) {
3459      JsonArray array = json.getAsJsonArray("instantiates");
3460      for (int i = 0; i < array.size(); i++) {
3461        res.getInstantiates().add(parseCanonical(array.get(i).getAsString()));
3462      }
3463    };
3464    if (json.has("_instantiates")) {
3465      JsonArray array = json.getAsJsonArray("_instantiates");
3466      for (int i = 0; i < array.size(); i++) {
3467        if (i == res.getInstantiates().size())
3468          res.getInstantiates().add(parseCanonical(null));
3469        if (array.get(i) instanceof JsonObject) 
3470          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
3471      }
3472    };
3473    if (json.has("imports")) {
3474      JsonArray array = json.getAsJsonArray("imports");
3475      for (int i = 0; i < array.size(); i++) {
3476        res.getImports().add(parseCanonical(array.get(i).getAsString()));
3477      }
3478    };
3479    if (json.has("_imports")) {
3480      JsonArray array = json.getAsJsonArray("_imports");
3481      for (int i = 0; i < array.size(); i++) {
3482        if (i == res.getImports().size())
3483          res.getImports().add(parseCanonical(null));
3484        if (array.get(i) instanceof JsonObject) 
3485          parseElementProperties(array.get(i).getAsJsonObject(), res.getImports().get(i));
3486      }
3487    };
3488    if (json.has("software"))
3489      res.setSoftware(parseCapabilityStatementCapabilityStatementSoftwareComponent(json.getAsJsonObject("software"), res));
3490    if (json.has("implementation"))
3491      res.setImplementation(parseCapabilityStatementCapabilityStatementImplementationComponent(json.getAsJsonObject("implementation"), res));
3492    if (json.has("fhirVersion"))
3493      res.setFhirVersionElement(parseEnumeration(json.get("fhirVersion").getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
3494    if (json.has("_fhirVersion"))
3495      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
3496    if (json.has("format")) {
3497      JsonArray array = json.getAsJsonArray("format");
3498      for (int i = 0; i < array.size(); i++) {
3499        res.getFormat().add(parseCode(array.get(i).getAsString()));
3500      }
3501    };
3502    if (json.has("_format")) {
3503      JsonArray array = json.getAsJsonArray("_format");
3504      for (int i = 0; i < array.size(); i++) {
3505        if (i == res.getFormat().size())
3506          res.getFormat().add(parseCode(null));
3507        if (array.get(i) instanceof JsonObject) 
3508          parseElementProperties(array.get(i).getAsJsonObject(), res.getFormat().get(i));
3509      }
3510    };
3511    if (json.has("patchFormat")) {
3512      JsonArray array = json.getAsJsonArray("patchFormat");
3513      for (int i = 0; i < array.size(); i++) {
3514        res.getPatchFormat().add(parseCode(array.get(i).getAsString()));
3515      }
3516    };
3517    if (json.has("_patchFormat")) {
3518      JsonArray array = json.getAsJsonArray("_patchFormat");
3519      for (int i = 0; i < array.size(); i++) {
3520        if (i == res.getPatchFormat().size())
3521          res.getPatchFormat().add(parseCode(null));
3522        if (array.get(i) instanceof JsonObject) 
3523          parseElementProperties(array.get(i).getAsJsonObject(), res.getPatchFormat().get(i));
3524      }
3525    };
3526    if (json.has("implementationGuide")) {
3527      JsonArray array = json.getAsJsonArray("implementationGuide");
3528      for (int i = 0; i < array.size(); i++) {
3529        res.getImplementationGuide().add(parseCanonical(array.get(i).getAsString()));
3530      }
3531    };
3532    if (json.has("_implementationGuide")) {
3533      JsonArray array = json.getAsJsonArray("_implementationGuide");
3534      for (int i = 0; i < array.size(); i++) {
3535        if (i == res.getImplementationGuide().size())
3536          res.getImplementationGuide().add(parseCanonical(null));
3537        if (array.get(i) instanceof JsonObject) 
3538          parseElementProperties(array.get(i).getAsJsonObject(), res.getImplementationGuide().get(i));
3539      }
3540    };
3541    if (json.has("rest")) {
3542      JsonArray array = json.getAsJsonArray("rest");
3543      for (int i = 0; i < array.size(); i++) {
3544        res.getRest().add(parseCapabilityStatementCapabilityStatementRestComponent(array.get(i).getAsJsonObject(), res));
3545      }
3546    };
3547    if (json.has("messaging")) {
3548      JsonArray array = json.getAsJsonArray("messaging");
3549      for (int i = 0; i < array.size(); i++) {
3550        res.getMessaging().add(parseCapabilityStatementCapabilityStatementMessagingComponent(array.get(i).getAsJsonObject(), res));
3551      }
3552    };
3553    if (json.has("document")) {
3554      JsonArray array = json.getAsJsonArray("document");
3555      for (int i = 0; i < array.size(); i++) {
3556        res.getDocument().add(parseCapabilityStatementCapabilityStatementDocumentComponent(array.get(i).getAsJsonObject(), res));
3557      }
3558    };
3559  }
3560
3561  protected CapabilityStatement.CapabilityStatementSoftwareComponent parseCapabilityStatementCapabilityStatementSoftwareComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3562    CapabilityStatement.CapabilityStatementSoftwareComponent res = new CapabilityStatement.CapabilityStatementSoftwareComponent();
3563    parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(json, owner, res);
3564    return res;
3565  }
3566
3567  protected void parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementSoftwareComponent res) throws IOException, FHIRFormatError {
3568    parseBackboneElementProperties(json, res);
3569    if (json.has("name"))
3570      res.setNameElement(parseString(json.get("name").getAsString()));
3571    if (json.has("_name"))
3572      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3573    if (json.has("version"))
3574      res.setVersionElement(parseString(json.get("version").getAsString()));
3575    if (json.has("_version"))
3576      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
3577    if (json.has("releaseDate"))
3578      res.setReleaseDateElement(parseDateTime(json.get("releaseDate").getAsString()));
3579    if (json.has("_releaseDate"))
3580      parseElementProperties(json.getAsJsonObject("_releaseDate"), res.getReleaseDateElement());
3581  }
3582
3583  protected CapabilityStatement.CapabilityStatementImplementationComponent parseCapabilityStatementCapabilityStatementImplementationComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3584    CapabilityStatement.CapabilityStatementImplementationComponent res = new CapabilityStatement.CapabilityStatementImplementationComponent();
3585    parseCapabilityStatementCapabilityStatementImplementationComponentProperties(json, owner, res);
3586    return res;
3587  }
3588
3589  protected void parseCapabilityStatementCapabilityStatementImplementationComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementImplementationComponent res) throws IOException, FHIRFormatError {
3590    parseBackboneElementProperties(json, res);
3591    if (json.has("description"))
3592      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3593    if (json.has("_description"))
3594      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3595    if (json.has("url"))
3596      res.setUrlElement(parseUrl(json.get("url").getAsString()));
3597    if (json.has("_url"))
3598      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3599    if (json.has("custodian"))
3600      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
3601  }
3602
3603  protected CapabilityStatement.CapabilityStatementRestComponent parseCapabilityStatementCapabilityStatementRestComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3604    CapabilityStatement.CapabilityStatementRestComponent res = new CapabilityStatement.CapabilityStatementRestComponent();
3605    parseCapabilityStatementCapabilityStatementRestComponentProperties(json, owner, res);
3606    return res;
3607  }
3608
3609  protected void parseCapabilityStatementCapabilityStatementRestComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestComponent res) throws IOException, FHIRFormatError {
3610    parseBackboneElementProperties(json, res);
3611    if (json.has("mode"))
3612      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.RestfulCapabilityMode.NULL, new CapabilityStatement.RestfulCapabilityModeEnumFactory()));
3613    if (json.has("_mode"))
3614      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3615    if (json.has("documentation"))
3616      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3617    if (json.has("_documentation"))
3618      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3619    if (json.has("security"))
3620      res.setSecurity(parseCapabilityStatementCapabilityStatementRestSecurityComponent(json.getAsJsonObject("security"), owner));
3621    if (json.has("resource")) {
3622      JsonArray array = json.getAsJsonArray("resource");
3623      for (int i = 0; i < array.size(); i++) {
3624        res.getResource().add(parseCapabilityStatementCapabilityStatementRestResourceComponent(array.get(i).getAsJsonObject(), owner));
3625      }
3626    };
3627    if (json.has("interaction")) {
3628      JsonArray array = json.getAsJsonArray("interaction");
3629      for (int i = 0; i < array.size(); i++) {
3630        res.getInteraction().add(parseCapabilityStatementSystemInteractionComponent(array.get(i).getAsJsonObject(), owner));
3631      }
3632    };
3633    if (json.has("searchParam")) {
3634      JsonArray array = json.getAsJsonArray("searchParam");
3635      for (int i = 0; i < array.size(); i++) {
3636        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3637      }
3638    };
3639    if (json.has("operation")) {
3640      JsonArray array = json.getAsJsonArray("operation");
3641      for (int i = 0; i < array.size(); i++) {
3642        res.getOperation().add(parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject(), owner));
3643      }
3644    };
3645    if (json.has("compartment")) {
3646      JsonArray array = json.getAsJsonArray("compartment");
3647      for (int i = 0; i < array.size(); i++) {
3648        res.getCompartment().add(parseCanonical(array.get(i).getAsString()));
3649      }
3650    };
3651    if (json.has("_compartment")) {
3652      JsonArray array = json.getAsJsonArray("_compartment");
3653      for (int i = 0; i < array.size(); i++) {
3654        if (i == res.getCompartment().size())
3655          res.getCompartment().add(parseCanonical(null));
3656        if (array.get(i) instanceof JsonObject) 
3657          parseElementProperties(array.get(i).getAsJsonObject(), res.getCompartment().get(i));
3658      }
3659    };
3660  }
3661
3662  protected CapabilityStatement.CapabilityStatementRestSecurityComponent parseCapabilityStatementCapabilityStatementRestSecurityComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3663    CapabilityStatement.CapabilityStatementRestSecurityComponent res = new CapabilityStatement.CapabilityStatementRestSecurityComponent();
3664    parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(json, owner, res);
3665    return res;
3666  }
3667
3668  protected void parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestSecurityComponent res) throws IOException, FHIRFormatError {
3669    parseBackboneElementProperties(json, res);
3670    if (json.has("cors"))
3671      res.setCorsElement(parseBoolean(json.get("cors").getAsBoolean()));
3672    if (json.has("_cors"))
3673      parseElementProperties(json.getAsJsonObject("_cors"), res.getCorsElement());
3674    if (json.has("service")) {
3675      JsonArray array = json.getAsJsonArray("service");
3676      for (int i = 0; i < array.size(); i++) {
3677        res.getService().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3678      }
3679    };
3680    if (json.has("description"))
3681      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
3682    if (json.has("_description"))
3683      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3684  }
3685
3686  protected CapabilityStatement.CapabilityStatementRestResourceComponent parseCapabilityStatementCapabilityStatementRestResourceComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3687    CapabilityStatement.CapabilityStatementRestResourceComponent res = new CapabilityStatement.CapabilityStatementRestResourceComponent();
3688    parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(json, owner, res);
3689    return res;
3690  }
3691
3692  protected void parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceComponent res) throws IOException, FHIRFormatError {
3693    parseBackboneElementProperties(json, res);
3694    if (json.has("type"))
3695      res.setTypeElement(parseCode(json.get("type").getAsString()));
3696    if (json.has("_type"))
3697      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3698    if (json.has("profile"))
3699      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
3700    if (json.has("_profile"))
3701      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
3702    if (json.has("supportedProfile")) {
3703      JsonArray array = json.getAsJsonArray("supportedProfile");
3704      for (int i = 0; i < array.size(); i++) {
3705        res.getSupportedProfile().add(parseCanonical(array.get(i).getAsString()));
3706      }
3707    };
3708    if (json.has("_supportedProfile")) {
3709      JsonArray array = json.getAsJsonArray("_supportedProfile");
3710      for (int i = 0; i < array.size(); i++) {
3711        if (i == res.getSupportedProfile().size())
3712          res.getSupportedProfile().add(parseCanonical(null));
3713        if (array.get(i) instanceof JsonObject) 
3714          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportedProfile().get(i));
3715      }
3716    };
3717    if (json.has("documentation"))
3718      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3719    if (json.has("_documentation"))
3720      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3721    if (json.has("interaction")) {
3722      JsonArray array = json.getAsJsonArray("interaction");
3723      for (int i = 0; i < array.size(); i++) {
3724        res.getInteraction().add(parseCapabilityStatementResourceInteractionComponent(array.get(i).getAsJsonObject(), owner));
3725      }
3726    };
3727    if (json.has("versioning"))
3728      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), CapabilityStatement.ResourceVersionPolicy.NULL, new CapabilityStatement.ResourceVersionPolicyEnumFactory()));
3729    if (json.has("_versioning"))
3730      parseElementProperties(json.getAsJsonObject("_versioning"), res.getVersioningElement());
3731    if (json.has("readHistory"))
3732      res.setReadHistoryElement(parseBoolean(json.get("readHistory").getAsBoolean()));
3733    if (json.has("_readHistory"))
3734      parseElementProperties(json.getAsJsonObject("_readHistory"), res.getReadHistoryElement());
3735    if (json.has("updateCreate"))
3736      res.setUpdateCreateElement(parseBoolean(json.get("updateCreate").getAsBoolean()));
3737    if (json.has("_updateCreate"))
3738      parseElementProperties(json.getAsJsonObject("_updateCreate"), res.getUpdateCreateElement());
3739    if (json.has("conditionalCreate"))
3740      res.setConditionalCreateElement(parseBoolean(json.get("conditionalCreate").getAsBoolean()));
3741    if (json.has("_conditionalCreate"))
3742      parseElementProperties(json.getAsJsonObject("_conditionalCreate"), res.getConditionalCreateElement());
3743    if (json.has("conditionalRead"))
3744      res.setConditionalReadElement(parseEnumeration(json.get("conditionalRead").getAsString(), CapabilityStatement.ConditionalReadStatus.NULL, new CapabilityStatement.ConditionalReadStatusEnumFactory()));
3745    if (json.has("_conditionalRead"))
3746      parseElementProperties(json.getAsJsonObject("_conditionalRead"), res.getConditionalReadElement());
3747    if (json.has("conditionalUpdate"))
3748      res.setConditionalUpdateElement(parseBoolean(json.get("conditionalUpdate").getAsBoolean()));
3749    if (json.has("_conditionalUpdate"))
3750      parseElementProperties(json.getAsJsonObject("_conditionalUpdate"), res.getConditionalUpdateElement());
3751    if (json.has("conditionalDelete"))
3752      res.setConditionalDeleteElement(parseEnumeration(json.get("conditionalDelete").getAsString(), CapabilityStatement.ConditionalDeleteStatus.NULL, new CapabilityStatement.ConditionalDeleteStatusEnumFactory()));
3753    if (json.has("_conditionalDelete"))
3754      parseElementProperties(json.getAsJsonObject("_conditionalDelete"), res.getConditionalDeleteElement());
3755    if (json.has("referencePolicy")) {
3756      JsonArray array = json.getAsJsonArray("referencePolicy");
3757      for (int i = 0; i < array.size(); i++) {
3758        res.getReferencePolicy().add(parseEnumeration(array.get(i).getAsString(), CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
3759      }
3760    };
3761    if (json.has("_referencePolicy")) {
3762      JsonArray array = json.getAsJsonArray("_referencePolicy");
3763      for (int i = 0; i < array.size(); i++) {
3764        if (i == res.getReferencePolicy().size())
3765          res.getReferencePolicy().add(parseEnumeration(null, CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
3766        if (array.get(i) instanceof JsonObject) 
3767          parseElementProperties(array.get(i).getAsJsonObject(), res.getReferencePolicy().get(i));
3768      }
3769    };
3770    if (json.has("searchInclude")) {
3771      JsonArray array = json.getAsJsonArray("searchInclude");
3772      for (int i = 0; i < array.size(); i++) {
3773        res.getSearchInclude().add(parseString(array.get(i).getAsString()));
3774      }
3775    };
3776    if (json.has("_searchInclude")) {
3777      JsonArray array = json.getAsJsonArray("_searchInclude");
3778      for (int i = 0; i < array.size(); i++) {
3779        if (i == res.getSearchInclude().size())
3780          res.getSearchInclude().add(parseString(null));
3781        if (array.get(i) instanceof JsonObject) 
3782          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchInclude().get(i));
3783      }
3784    };
3785    if (json.has("searchRevInclude")) {
3786      JsonArray array = json.getAsJsonArray("searchRevInclude");
3787      for (int i = 0; i < array.size(); i++) {
3788        res.getSearchRevInclude().add(parseString(array.get(i).getAsString()));
3789      }
3790    };
3791    if (json.has("_searchRevInclude")) {
3792      JsonArray array = json.getAsJsonArray("_searchRevInclude");
3793      for (int i = 0; i < array.size(); i++) {
3794        if (i == res.getSearchRevInclude().size())
3795          res.getSearchRevInclude().add(parseString(null));
3796        if (array.get(i) instanceof JsonObject) 
3797          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchRevInclude().get(i));
3798      }
3799    };
3800    if (json.has("searchParam")) {
3801      JsonArray array = json.getAsJsonArray("searchParam");
3802      for (int i = 0; i < array.size(); i++) {
3803        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3804      }
3805    };
3806    if (json.has("operation")) {
3807      JsonArray array = json.getAsJsonArray("operation");
3808      for (int i = 0; i < array.size(); i++) {
3809        res.getOperation().add(parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject(), owner));
3810      }
3811    };
3812  }
3813
3814  protected CapabilityStatement.ResourceInteractionComponent parseCapabilityStatementResourceInteractionComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3815    CapabilityStatement.ResourceInteractionComponent res = new CapabilityStatement.ResourceInteractionComponent();
3816    parseCapabilityStatementResourceInteractionComponentProperties(json, owner, res);
3817    return res;
3818  }
3819
3820  protected void parseCapabilityStatementResourceInteractionComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.ResourceInteractionComponent res) throws IOException, FHIRFormatError {
3821    parseBackboneElementProperties(json, res);
3822    if (json.has("code"))
3823      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.TypeRestfulInteraction.NULL, new CapabilityStatement.TypeRestfulInteractionEnumFactory()));
3824    if (json.has("_code"))
3825      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3826    if (json.has("documentation"))
3827      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3828    if (json.has("_documentation"))
3829      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3830  }
3831
3832  protected CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3833    CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res = new CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
3834    parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(json, owner, res);
3835    return res;
3836  }
3837
3838  protected void parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res) throws IOException, FHIRFormatError {
3839    parseBackboneElementProperties(json, res);
3840    if (json.has("name"))
3841      res.setNameElement(parseString(json.get("name").getAsString()));
3842    if (json.has("_name"))
3843      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3844    if (json.has("definition"))
3845      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
3846    if (json.has("_definition"))
3847      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
3848    if (json.has("type"))
3849      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
3850    if (json.has("_type"))
3851      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3852    if (json.has("documentation"))
3853      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3854    if (json.has("_documentation"))
3855      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3856  }
3857
3858  protected CapabilityStatement.CapabilityStatementRestResourceOperationComponent parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3859    CapabilityStatement.CapabilityStatementRestResourceOperationComponent res = new CapabilityStatement.CapabilityStatementRestResourceOperationComponent();
3860    parseCapabilityStatementCapabilityStatementRestResourceOperationComponentProperties(json, owner, res);
3861    return res;
3862  }
3863
3864  protected void parseCapabilityStatementCapabilityStatementRestResourceOperationComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceOperationComponent res) throws IOException, FHIRFormatError {
3865    parseBackboneElementProperties(json, res);
3866    if (json.has("name"))
3867      res.setNameElement(parseString(json.get("name").getAsString()));
3868    if (json.has("_name"))
3869      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3870    if (json.has("definition"))
3871      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
3872    if (json.has("_definition"))
3873      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
3874    if (json.has("documentation"))
3875      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3876    if (json.has("_documentation"))
3877      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3878  }
3879
3880  protected CapabilityStatement.SystemInteractionComponent parseCapabilityStatementSystemInteractionComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3881    CapabilityStatement.SystemInteractionComponent res = new CapabilityStatement.SystemInteractionComponent();
3882    parseCapabilityStatementSystemInteractionComponentProperties(json, owner, res);
3883    return res;
3884  }
3885
3886  protected void parseCapabilityStatementSystemInteractionComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.SystemInteractionComponent res) throws IOException, FHIRFormatError {
3887    parseBackboneElementProperties(json, res);
3888    if (json.has("code"))
3889      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.SystemRestfulInteraction.NULL, new CapabilityStatement.SystemRestfulInteractionEnumFactory()));
3890    if (json.has("_code"))
3891      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3892    if (json.has("documentation"))
3893      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3894    if (json.has("_documentation"))
3895      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3896  }
3897
3898  protected CapabilityStatement.CapabilityStatementMessagingComponent parseCapabilityStatementCapabilityStatementMessagingComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3899    CapabilityStatement.CapabilityStatementMessagingComponent res = new CapabilityStatement.CapabilityStatementMessagingComponent();
3900    parseCapabilityStatementCapabilityStatementMessagingComponentProperties(json, owner, res);
3901    return res;
3902  }
3903
3904  protected void parseCapabilityStatementCapabilityStatementMessagingComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingComponent res) throws IOException, FHIRFormatError {
3905    parseBackboneElementProperties(json, res);
3906    if (json.has("endpoint")) {
3907      JsonArray array = json.getAsJsonArray("endpoint");
3908      for (int i = 0; i < array.size(); i++) {
3909        res.getEndpoint().add(parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(array.get(i).getAsJsonObject(), owner));
3910      }
3911    };
3912    if (json.has("reliableCache"))
3913      res.setReliableCacheElement(parseUnsignedInt(json.get("reliableCache").getAsString()));
3914    if (json.has("_reliableCache"))
3915      parseElementProperties(json.getAsJsonObject("_reliableCache"), res.getReliableCacheElement());
3916    if (json.has("documentation"))
3917      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3918    if (json.has("_documentation"))
3919      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3920    if (json.has("supportedMessage")) {
3921      JsonArray array = json.getAsJsonArray("supportedMessage");
3922      for (int i = 0; i < array.size(); i++) {
3923        res.getSupportedMessage().add(parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(array.get(i).getAsJsonObject(), owner));
3924      }
3925    };
3926  }
3927
3928  protected CapabilityStatement.CapabilityStatementMessagingEndpointComponent parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3929    CapabilityStatement.CapabilityStatementMessagingEndpointComponent res = new CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
3930    parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(json, owner, res);
3931    return res;
3932  }
3933
3934  protected void parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingEndpointComponent res) throws IOException, FHIRFormatError {
3935    parseBackboneElementProperties(json, res);
3936    if (json.has("protocol"))
3937      res.setProtocol(parseCoding(json.getAsJsonObject("protocol")));
3938    if (json.has("address"))
3939      res.setAddressElement(parseUrl(json.get("address").getAsString()));
3940    if (json.has("_address"))
3941      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
3942  }
3943
3944  protected CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3945    CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res = new CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
3946    parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(json, owner, res);
3947    return res;
3948  }
3949
3950  protected void parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res) throws IOException, FHIRFormatError {
3951    parseBackboneElementProperties(json, res);
3952    if (json.has("mode"))
3953      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.EventCapabilityMode.NULL, new CapabilityStatement.EventCapabilityModeEnumFactory()));
3954    if (json.has("_mode"))
3955      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3956    if (json.has("definition"))
3957      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
3958    if (json.has("_definition"))
3959      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
3960  }
3961
3962  protected CapabilityStatement.CapabilityStatementDocumentComponent parseCapabilityStatementCapabilityStatementDocumentComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3963    CapabilityStatement.CapabilityStatementDocumentComponent res = new CapabilityStatement.CapabilityStatementDocumentComponent();
3964    parseCapabilityStatementCapabilityStatementDocumentComponentProperties(json, owner, res);
3965    return res;
3966  }
3967
3968  protected void parseCapabilityStatementCapabilityStatementDocumentComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementDocumentComponent res) throws IOException, FHIRFormatError {
3969    parseBackboneElementProperties(json, res);
3970    if (json.has("mode"))
3971      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.DocumentMode.NULL, new CapabilityStatement.DocumentModeEnumFactory()));
3972    if (json.has("_mode"))
3973      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3974    if (json.has("documentation"))
3975      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3976    if (json.has("_documentation"))
3977      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3978    if (json.has("profile"))
3979      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
3980    if (json.has("_profile"))
3981      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
3982  }
3983
3984  protected CarePlan parseCarePlan(JsonObject json) throws IOException, FHIRFormatError {
3985    CarePlan res = new CarePlan();
3986    parseCarePlanProperties(json, res);
3987    return res;
3988  }
3989
3990  protected void parseCarePlanProperties(JsonObject json, CarePlan res) throws IOException, FHIRFormatError {
3991    parseDomainResourceProperties(json, res);
3992    if (json.has("identifier")) {
3993      JsonArray array = json.getAsJsonArray("identifier");
3994      for (int i = 0; i < array.size(); i++) {
3995        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3996      }
3997    };
3998    if (json.has("instantiatesCanonical")) {
3999      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
4000      for (int i = 0; i < array.size(); i++) {
4001        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
4002      }
4003    };
4004    if (json.has("_instantiatesCanonical")) {
4005      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
4006      for (int i = 0; i < array.size(); i++) {
4007        if (i == res.getInstantiatesCanonical().size())
4008          res.getInstantiatesCanonical().add(parseCanonical(null));
4009        if (array.get(i) instanceof JsonObject) 
4010          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
4011      }
4012    };
4013    if (json.has("instantiatesUri")) {
4014      JsonArray array = json.getAsJsonArray("instantiatesUri");
4015      for (int i = 0; i < array.size(); i++) {
4016        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
4017      }
4018    };
4019    if (json.has("_instantiatesUri")) {
4020      JsonArray array = json.getAsJsonArray("_instantiatesUri");
4021      for (int i = 0; i < array.size(); i++) {
4022        if (i == res.getInstantiatesUri().size())
4023          res.getInstantiatesUri().add(parseUri(null));
4024        if (array.get(i) instanceof JsonObject) 
4025          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
4026      }
4027    };
4028    if (json.has("basedOn")) {
4029      JsonArray array = json.getAsJsonArray("basedOn");
4030      for (int i = 0; i < array.size(); i++) {
4031        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
4032      }
4033    };
4034    if (json.has("replaces")) {
4035      JsonArray array = json.getAsJsonArray("replaces");
4036      for (int i = 0; i < array.size(); i++) {
4037        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
4038      }
4039    };
4040    if (json.has("partOf")) {
4041      JsonArray array = json.getAsJsonArray("partOf");
4042      for (int i = 0; i < array.size(); i++) {
4043        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
4044      }
4045    };
4046    if (json.has("status"))
4047      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanStatus.NULL, new CarePlan.CarePlanStatusEnumFactory()));
4048    if (json.has("_status"))
4049      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4050    if (json.has("intent"))
4051      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), CarePlan.CarePlanIntent.NULL, new CarePlan.CarePlanIntentEnumFactory()));
4052    if (json.has("_intent"))
4053      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
4054    if (json.has("category")) {
4055      JsonArray array = json.getAsJsonArray("category");
4056      for (int i = 0; i < array.size(); i++) {
4057        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4058      }
4059    };
4060    if (json.has("title"))
4061      res.setTitleElement(parseString(json.get("title").getAsString()));
4062    if (json.has("_title"))
4063      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
4064    if (json.has("description"))
4065      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4066    if (json.has("_description"))
4067      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4068    if (json.has("subject"))
4069      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4070    if (json.has("encounter"))
4071      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
4072    if (json.has("period"))
4073      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
4074    if (json.has("created"))
4075      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4076    if (json.has("_created"))
4077      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
4078    if (json.has("author"))
4079      res.setAuthor(parseReference(json.getAsJsonObject("author")));
4080    if (json.has("contributor")) {
4081      JsonArray array = json.getAsJsonArray("contributor");
4082      for (int i = 0; i < array.size(); i++) {
4083        res.getContributor().add(parseReference(array.get(i).getAsJsonObject()));
4084      }
4085    };
4086    if (json.has("careTeam")) {
4087      JsonArray array = json.getAsJsonArray("careTeam");
4088      for (int i = 0; i < array.size(); i++) {
4089        res.getCareTeam().add(parseReference(array.get(i).getAsJsonObject()));
4090      }
4091    };
4092    if (json.has("addresses")) {
4093      JsonArray array = json.getAsJsonArray("addresses");
4094      for (int i = 0; i < array.size(); i++) {
4095        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
4096      }
4097    };
4098    if (json.has("supportingInfo")) {
4099      JsonArray array = json.getAsJsonArray("supportingInfo");
4100      for (int i = 0; i < array.size(); i++) {
4101        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
4102      }
4103    };
4104    if (json.has("goal")) {
4105      JsonArray array = json.getAsJsonArray("goal");
4106      for (int i = 0; i < array.size(); i++) {
4107        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
4108      }
4109    };
4110    if (json.has("activity")) {
4111      JsonArray array = json.getAsJsonArray("activity");
4112      for (int i = 0; i < array.size(); i++) {
4113        res.getActivity().add(parseCarePlanCarePlanActivityComponent(array.get(i).getAsJsonObject(), res));
4114      }
4115    };
4116    if (json.has("note")) {
4117      JsonArray array = json.getAsJsonArray("note");
4118      for (int i = 0; i < array.size(); i++) {
4119        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4120      }
4121    };
4122  }
4123
4124  protected CarePlan.CarePlanActivityComponent parseCarePlanCarePlanActivityComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
4125    CarePlan.CarePlanActivityComponent res = new CarePlan.CarePlanActivityComponent();
4126    parseCarePlanCarePlanActivityComponentProperties(json, owner, res);
4127    return res;
4128  }
4129
4130  protected void parseCarePlanCarePlanActivityComponentProperties(JsonObject json, CarePlan owner, CarePlan.CarePlanActivityComponent res) throws IOException, FHIRFormatError {
4131    parseBackboneElementProperties(json, res);
4132    if (json.has("outcomeCodeableConcept")) {
4133      JsonArray array = json.getAsJsonArray("outcomeCodeableConcept");
4134      for (int i = 0; i < array.size(); i++) {
4135        res.getOutcomeCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4136      }
4137    };
4138    if (json.has("outcomeReference")) {
4139      JsonArray array = json.getAsJsonArray("outcomeReference");
4140      for (int i = 0; i < array.size(); i++) {
4141        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
4142      }
4143    };
4144    if (json.has("progress")) {
4145      JsonArray array = json.getAsJsonArray("progress");
4146      for (int i = 0; i < array.size(); i++) {
4147        res.getProgress().add(parseAnnotation(array.get(i).getAsJsonObject()));
4148      }
4149    };
4150    if (json.has("reference"))
4151      res.setReference(parseReference(json.getAsJsonObject("reference")));
4152    if (json.has("detail"))
4153      res.setDetail(parseCarePlanCarePlanActivityDetailComponent(json.getAsJsonObject("detail"), owner));
4154  }
4155
4156  protected CarePlan.CarePlanActivityDetailComponent parseCarePlanCarePlanActivityDetailComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
4157    CarePlan.CarePlanActivityDetailComponent res = new CarePlan.CarePlanActivityDetailComponent();
4158    parseCarePlanCarePlanActivityDetailComponentProperties(json, owner, res);
4159    return res;
4160  }
4161
4162  protected void parseCarePlanCarePlanActivityDetailComponentProperties(JsonObject json, CarePlan owner, CarePlan.CarePlanActivityDetailComponent res) throws IOException, FHIRFormatError {
4163    parseBackboneElementProperties(json, res);
4164    if (json.has("kind"))
4165      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CarePlan.CarePlanActivityKind.NULL, new CarePlan.CarePlanActivityKindEnumFactory()));
4166    if (json.has("_kind"))
4167      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
4168    if (json.has("instantiatesCanonical")) {
4169      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
4170      for (int i = 0; i < array.size(); i++) {
4171        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
4172      }
4173    };
4174    if (json.has("_instantiatesCanonical")) {
4175      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
4176      for (int i = 0; i < array.size(); i++) {
4177        if (i == res.getInstantiatesCanonical().size())
4178          res.getInstantiatesCanonical().add(parseCanonical(null));
4179        if (array.get(i) instanceof JsonObject) 
4180          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
4181      }
4182    };
4183    if (json.has("instantiatesUri")) {
4184      JsonArray array = json.getAsJsonArray("instantiatesUri");
4185      for (int i = 0; i < array.size(); i++) {
4186        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
4187      }
4188    };
4189    if (json.has("_instantiatesUri")) {
4190      JsonArray array = json.getAsJsonArray("_instantiatesUri");
4191      for (int i = 0; i < array.size(); i++) {
4192        if (i == res.getInstantiatesUri().size())
4193          res.getInstantiatesUri().add(parseUri(null));
4194        if (array.get(i) instanceof JsonObject) 
4195          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
4196      }
4197    };
4198    if (json.has("code"))
4199      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4200    if (json.has("reasonCode")) {
4201      JsonArray array = json.getAsJsonArray("reasonCode");
4202      for (int i = 0; i < array.size(); i++) {
4203        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4204      }
4205    };
4206    if (json.has("reasonReference")) {
4207      JsonArray array = json.getAsJsonArray("reasonReference");
4208      for (int i = 0; i < array.size(); i++) {
4209        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
4210      }
4211    };
4212    if (json.has("goal")) {
4213      JsonArray array = json.getAsJsonArray("goal");
4214      for (int i = 0; i < array.size(); i++) {
4215        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
4216      }
4217    };
4218    if (json.has("status"))
4219      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanActivityStatus.NULL, new CarePlan.CarePlanActivityStatusEnumFactory()));
4220    if (json.has("_status"))
4221      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4222    if (json.has("statusReason"))
4223      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
4224    if (json.has("doNotPerform"))
4225      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
4226    if (json.has("_doNotPerform"))
4227      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
4228    Type scheduled = parseType("scheduled", json);
4229    if (scheduled != null)
4230      res.setScheduled(scheduled);
4231    if (json.has("location"))
4232      res.setLocation(parseReference(json.getAsJsonObject("location")));
4233    if (json.has("performer")) {
4234      JsonArray array = json.getAsJsonArray("performer");
4235      for (int i = 0; i < array.size(); i++) {
4236        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
4237      }
4238    };
4239    Type product = parseType("product", json);
4240    if (product != null)
4241      res.setProduct(product);
4242    if (json.has("dailyAmount"))
4243      res.setDailyAmount(parseQuantity(json.getAsJsonObject("dailyAmount")));
4244    if (json.has("quantity"))
4245      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
4246    if (json.has("description"))
4247      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4248    if (json.has("_description"))
4249      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4250  }
4251
4252  protected CareTeam parseCareTeam(JsonObject json) throws IOException, FHIRFormatError {
4253    CareTeam res = new CareTeam();
4254    parseCareTeamProperties(json, res);
4255    return res;
4256  }
4257
4258  protected void parseCareTeamProperties(JsonObject json, CareTeam res) throws IOException, FHIRFormatError {
4259    parseDomainResourceProperties(json, res);
4260    if (json.has("identifier")) {
4261      JsonArray array = json.getAsJsonArray("identifier");
4262      for (int i = 0; i < array.size(); i++) {
4263        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4264      }
4265    };
4266    if (json.has("status"))
4267      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CareTeam.CareTeamStatus.NULL, new CareTeam.CareTeamStatusEnumFactory()));
4268    if (json.has("_status"))
4269      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4270    if (json.has("category")) {
4271      JsonArray array = json.getAsJsonArray("category");
4272      for (int i = 0; i < array.size(); i++) {
4273        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4274      }
4275    };
4276    if (json.has("name"))
4277      res.setNameElement(parseString(json.get("name").getAsString()));
4278    if (json.has("_name"))
4279      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4280    if (json.has("subject"))
4281      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4282    if (json.has("encounter"))
4283      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
4284    if (json.has("period"))
4285      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
4286    if (json.has("participant")) {
4287      JsonArray array = json.getAsJsonArray("participant");
4288      for (int i = 0; i < array.size(); i++) {
4289        res.getParticipant().add(parseCareTeamCareTeamParticipantComponent(array.get(i).getAsJsonObject(), res));
4290      }
4291    };
4292    if (json.has("reasonCode")) {
4293      JsonArray array = json.getAsJsonArray("reasonCode");
4294      for (int i = 0; i < array.size(); i++) {
4295        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4296      }
4297    };
4298    if (json.has("reasonReference")) {
4299      JsonArray array = json.getAsJsonArray("reasonReference");
4300      for (int i = 0; i < array.size(); i++) {
4301        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
4302      }
4303    };
4304    if (json.has("managingOrganization")) {
4305      JsonArray array = json.getAsJsonArray("managingOrganization");
4306      for (int i = 0; i < array.size(); i++) {
4307        res.getManagingOrganization().add(parseReference(array.get(i).getAsJsonObject()));
4308      }
4309    };
4310    if (json.has("telecom")) {
4311      JsonArray array = json.getAsJsonArray("telecom");
4312      for (int i = 0; i < array.size(); i++) {
4313        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
4314      }
4315    };
4316    if (json.has("note")) {
4317      JsonArray array = json.getAsJsonArray("note");
4318      for (int i = 0; i < array.size(); i++) {
4319        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4320      }
4321    };
4322  }
4323
4324  protected CareTeam.CareTeamParticipantComponent parseCareTeamCareTeamParticipantComponent(JsonObject json, CareTeam owner) throws IOException, FHIRFormatError {
4325    CareTeam.CareTeamParticipantComponent res = new CareTeam.CareTeamParticipantComponent();
4326    parseCareTeamCareTeamParticipantComponentProperties(json, owner, res);
4327    return res;
4328  }
4329
4330  protected void parseCareTeamCareTeamParticipantComponentProperties(JsonObject json, CareTeam owner, CareTeam.CareTeamParticipantComponent res) throws IOException, FHIRFormatError {
4331    parseBackboneElementProperties(json, res);
4332    if (json.has("role")) {
4333      JsonArray array = json.getAsJsonArray("role");
4334      for (int i = 0; i < array.size(); i++) {
4335        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4336      }
4337    };
4338    if (json.has("member"))
4339      res.setMember(parseReference(json.getAsJsonObject("member")));
4340    if (json.has("onBehalfOf"))
4341      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
4342    if (json.has("period"))
4343      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
4344  }
4345
4346  protected CatalogEntry parseCatalogEntry(JsonObject json) throws IOException, FHIRFormatError {
4347    CatalogEntry res = new CatalogEntry();
4348    parseCatalogEntryProperties(json, res);
4349    return res;
4350  }
4351
4352  protected void parseCatalogEntryProperties(JsonObject json, CatalogEntry res) throws IOException, FHIRFormatError {
4353    parseDomainResourceProperties(json, res);
4354    if (json.has("identifier")) {
4355      JsonArray array = json.getAsJsonArray("identifier");
4356      for (int i = 0; i < array.size(); i++) {
4357        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4358      }
4359    };
4360    if (json.has("type"))
4361      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4362    if (json.has("orderable"))
4363      res.setOrderableElement(parseBoolean(json.get("orderable").getAsBoolean()));
4364    if (json.has("_orderable"))
4365      parseElementProperties(json.getAsJsonObject("_orderable"), res.getOrderableElement());
4366    if (json.has("referencedItem"))
4367      res.setReferencedItem(parseReference(json.getAsJsonObject("referencedItem")));
4368    if (json.has("additionalIdentifier")) {
4369      JsonArray array = json.getAsJsonArray("additionalIdentifier");
4370      for (int i = 0; i < array.size(); i++) {
4371        res.getAdditionalIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4372      }
4373    };
4374    if (json.has("classification")) {
4375      JsonArray array = json.getAsJsonArray("classification");
4376      for (int i = 0; i < array.size(); i++) {
4377        res.getClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4378      }
4379    };
4380    if (json.has("status"))
4381      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
4382    if (json.has("_status"))
4383      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4384    if (json.has("validityPeriod"))
4385      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
4386    if (json.has("validTo"))
4387      res.setValidToElement(parseDateTime(json.get("validTo").getAsString()));
4388    if (json.has("_validTo"))
4389      parseElementProperties(json.getAsJsonObject("_validTo"), res.getValidToElement());
4390    if (json.has("lastUpdated"))
4391      res.setLastUpdatedElement(parseDateTime(json.get("lastUpdated").getAsString()));
4392    if (json.has("_lastUpdated"))
4393      parseElementProperties(json.getAsJsonObject("_lastUpdated"), res.getLastUpdatedElement());
4394    if (json.has("additionalCharacteristic")) {
4395      JsonArray array = json.getAsJsonArray("additionalCharacteristic");
4396      for (int i = 0; i < array.size(); i++) {
4397        res.getAdditionalCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4398      }
4399    };
4400    if (json.has("additionalClassification")) {
4401      JsonArray array = json.getAsJsonArray("additionalClassification");
4402      for (int i = 0; i < array.size(); i++) {
4403        res.getAdditionalClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4404      }
4405    };
4406    if (json.has("relatedEntry")) {
4407      JsonArray array = json.getAsJsonArray("relatedEntry");
4408      for (int i = 0; i < array.size(); i++) {
4409        res.getRelatedEntry().add(parseCatalogEntryCatalogEntryRelatedEntryComponent(array.get(i).getAsJsonObject(), res));
4410      }
4411    };
4412  }
4413
4414  protected CatalogEntry.CatalogEntryRelatedEntryComponent parseCatalogEntryCatalogEntryRelatedEntryComponent(JsonObject json, CatalogEntry owner) throws IOException, FHIRFormatError {
4415    CatalogEntry.CatalogEntryRelatedEntryComponent res = new CatalogEntry.CatalogEntryRelatedEntryComponent();
4416    parseCatalogEntryCatalogEntryRelatedEntryComponentProperties(json, owner, res);
4417    return res;
4418  }
4419
4420  protected void parseCatalogEntryCatalogEntryRelatedEntryComponentProperties(JsonObject json, CatalogEntry owner, CatalogEntry.CatalogEntryRelatedEntryComponent res) throws IOException, FHIRFormatError {
4421    parseBackboneElementProperties(json, res);
4422    if (json.has("relationtype"))
4423      res.setRelationtypeElement(parseEnumeration(json.get("relationtype").getAsString(), CatalogEntry.CatalogEntryRelationType.NULL, new CatalogEntry.CatalogEntryRelationTypeEnumFactory()));
4424    if (json.has("_relationtype"))
4425      parseElementProperties(json.getAsJsonObject("_relationtype"), res.getRelationtypeElement());
4426    if (json.has("item"))
4427      res.setItem(parseReference(json.getAsJsonObject("item")));
4428  }
4429
4430  protected ChargeItem parseChargeItem(JsonObject json) throws IOException, FHIRFormatError {
4431    ChargeItem res = new ChargeItem();
4432    parseChargeItemProperties(json, res);
4433    return res;
4434  }
4435
4436  protected void parseChargeItemProperties(JsonObject json, ChargeItem res) throws IOException, FHIRFormatError {
4437    parseDomainResourceProperties(json, res);
4438    if (json.has("identifier")) {
4439      JsonArray array = json.getAsJsonArray("identifier");
4440      for (int i = 0; i < array.size(); i++) {
4441        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4442      }
4443    };
4444    if (json.has("definitionUri")) {
4445      JsonArray array = json.getAsJsonArray("definitionUri");
4446      for (int i = 0; i < array.size(); i++) {
4447        res.getDefinitionUri().add(parseUri(array.get(i).getAsString()));
4448      }
4449    };
4450    if (json.has("_definitionUri")) {
4451      JsonArray array = json.getAsJsonArray("_definitionUri");
4452      for (int i = 0; i < array.size(); i++) {
4453        if (i == res.getDefinitionUri().size())
4454          res.getDefinitionUri().add(parseUri(null));
4455        if (array.get(i) instanceof JsonObject) 
4456          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinitionUri().get(i));
4457      }
4458    };
4459    if (json.has("definitionCanonical")) {
4460      JsonArray array = json.getAsJsonArray("definitionCanonical");
4461      for (int i = 0; i < array.size(); i++) {
4462        res.getDefinitionCanonical().add(parseCanonical(array.get(i).getAsString()));
4463      }
4464    };
4465    if (json.has("_definitionCanonical")) {
4466      JsonArray array = json.getAsJsonArray("_definitionCanonical");
4467      for (int i = 0; i < array.size(); i++) {
4468        if (i == res.getDefinitionCanonical().size())
4469          res.getDefinitionCanonical().add(parseCanonical(null));
4470        if (array.get(i) instanceof JsonObject) 
4471          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinitionCanonical().get(i));
4472      }
4473    };
4474    if (json.has("status"))
4475      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ChargeItem.ChargeItemStatus.NULL, new ChargeItem.ChargeItemStatusEnumFactory()));
4476    if (json.has("_status"))
4477      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4478    if (json.has("partOf")) {
4479      JsonArray array = json.getAsJsonArray("partOf");
4480      for (int i = 0; i < array.size(); i++) {
4481        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
4482      }
4483    };
4484    if (json.has("code"))
4485      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4486    if (json.has("subject"))
4487      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4488    if (json.has("context"))
4489      res.setContext(parseReference(json.getAsJsonObject("context")));
4490    Type occurrence = parseType("occurrence", json);
4491    if (occurrence != null)
4492      res.setOccurrence(occurrence);
4493    if (json.has("performer")) {
4494      JsonArray array = json.getAsJsonArray("performer");
4495      for (int i = 0; i < array.size(); i++) {
4496        res.getPerformer().add(parseChargeItemChargeItemPerformerComponent(array.get(i).getAsJsonObject(), res));
4497      }
4498    };
4499    if (json.has("performingOrganization"))
4500      res.setPerformingOrganization(parseReference(json.getAsJsonObject("performingOrganization")));
4501    if (json.has("requestingOrganization"))
4502      res.setRequestingOrganization(parseReference(json.getAsJsonObject("requestingOrganization")));
4503    if (json.has("costCenter"))
4504      res.setCostCenter(parseReference(json.getAsJsonObject("costCenter")));
4505    if (json.has("quantity"))
4506      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
4507    if (json.has("bodysite")) {
4508      JsonArray array = json.getAsJsonArray("bodysite");
4509      for (int i = 0; i < array.size(); i++) {
4510        res.getBodysite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4511      }
4512    };
4513    if (json.has("factorOverride"))
4514      res.setFactorOverrideElement(parseDecimal(json.get("factorOverride").getAsBigDecimal()));
4515    if (json.has("_factorOverride"))
4516      parseElementProperties(json.getAsJsonObject("_factorOverride"), res.getFactorOverrideElement());
4517    if (json.has("priceOverride"))
4518      res.setPriceOverride(parseMoney(json.getAsJsonObject("priceOverride")));
4519    if (json.has("overrideReason"))
4520      res.setOverrideReasonElement(parseString(json.get("overrideReason").getAsString()));
4521    if (json.has("_overrideReason"))
4522      parseElementProperties(json.getAsJsonObject("_overrideReason"), res.getOverrideReasonElement());
4523    if (json.has("enterer"))
4524      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
4525    if (json.has("enteredDate"))
4526      res.setEnteredDateElement(parseDateTime(json.get("enteredDate").getAsString()));
4527    if (json.has("_enteredDate"))
4528      parseElementProperties(json.getAsJsonObject("_enteredDate"), res.getEnteredDateElement());
4529    if (json.has("reason")) {
4530      JsonArray array = json.getAsJsonArray("reason");
4531      for (int i = 0; i < array.size(); i++) {
4532        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4533      }
4534    };
4535    if (json.has("service")) {
4536      JsonArray array = json.getAsJsonArray("service");
4537      for (int i = 0; i < array.size(); i++) {
4538        res.getService().add(parseReference(array.get(i).getAsJsonObject()));
4539      }
4540    };
4541    Type product = parseType("product", json);
4542    if (product != null)
4543      res.setProduct(product);
4544    if (json.has("account")) {
4545      JsonArray array = json.getAsJsonArray("account");
4546      for (int i = 0; i < array.size(); i++) {
4547        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
4548      }
4549    };
4550    if (json.has("note")) {
4551      JsonArray array = json.getAsJsonArray("note");
4552      for (int i = 0; i < array.size(); i++) {
4553        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4554      }
4555    };
4556    if (json.has("supportingInformation")) {
4557      JsonArray array = json.getAsJsonArray("supportingInformation");
4558      for (int i = 0; i < array.size(); i++) {
4559        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
4560      }
4561    };
4562  }
4563
4564  protected ChargeItem.ChargeItemPerformerComponent parseChargeItemChargeItemPerformerComponent(JsonObject json, ChargeItem owner) throws IOException, FHIRFormatError {
4565    ChargeItem.ChargeItemPerformerComponent res = new ChargeItem.ChargeItemPerformerComponent();
4566    parseChargeItemChargeItemPerformerComponentProperties(json, owner, res);
4567    return res;
4568  }
4569
4570  protected void parseChargeItemChargeItemPerformerComponentProperties(JsonObject json, ChargeItem owner, ChargeItem.ChargeItemPerformerComponent res) throws IOException, FHIRFormatError {
4571    parseBackboneElementProperties(json, res);
4572    if (json.has("function"))
4573      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
4574    if (json.has("actor"))
4575      res.setActor(parseReference(json.getAsJsonObject("actor")));
4576  }
4577
4578  protected ChargeItemDefinition parseChargeItemDefinition(JsonObject json) throws IOException, FHIRFormatError {
4579    ChargeItemDefinition res = new ChargeItemDefinition();
4580    parseChargeItemDefinitionProperties(json, res);
4581    return res;
4582  }
4583
4584  protected void parseChargeItemDefinitionProperties(JsonObject json, ChargeItemDefinition res) throws IOException, FHIRFormatError {
4585    parseDomainResourceProperties(json, res);
4586    if (json.has("url"))
4587      res.setUrlElement(parseUri(json.get("url").getAsString()));
4588    if (json.has("_url"))
4589      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
4590    if (json.has("identifier")) {
4591      JsonArray array = json.getAsJsonArray("identifier");
4592      for (int i = 0; i < array.size(); i++) {
4593        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4594      }
4595    };
4596    if (json.has("version"))
4597      res.setVersionElement(parseString(json.get("version").getAsString()));
4598    if (json.has("_version"))
4599      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
4600    if (json.has("title"))
4601      res.setTitleElement(parseString(json.get("title").getAsString()));
4602    if (json.has("_title"))
4603      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
4604    if (json.has("derivedFromUri")) {
4605      JsonArray array = json.getAsJsonArray("derivedFromUri");
4606      for (int i = 0; i < array.size(); i++) {
4607        res.getDerivedFromUri().add(parseUri(array.get(i).getAsString()));
4608      }
4609    };
4610    if (json.has("_derivedFromUri")) {
4611      JsonArray array = json.getAsJsonArray("_derivedFromUri");
4612      for (int i = 0; i < array.size(); i++) {
4613        if (i == res.getDerivedFromUri().size())
4614          res.getDerivedFromUri().add(parseUri(null));
4615        if (array.get(i) instanceof JsonObject) 
4616          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromUri().get(i));
4617      }
4618    };
4619    if (json.has("partOf")) {
4620      JsonArray array = json.getAsJsonArray("partOf");
4621      for (int i = 0; i < array.size(); i++) {
4622        res.getPartOf().add(parseCanonical(array.get(i).getAsString()));
4623      }
4624    };
4625    if (json.has("_partOf")) {
4626      JsonArray array = json.getAsJsonArray("_partOf");
4627      for (int i = 0; i < array.size(); i++) {
4628        if (i == res.getPartOf().size())
4629          res.getPartOf().add(parseCanonical(null));
4630        if (array.get(i) instanceof JsonObject) 
4631          parseElementProperties(array.get(i).getAsJsonObject(), res.getPartOf().get(i));
4632      }
4633    };
4634    if (json.has("replaces")) {
4635      JsonArray array = json.getAsJsonArray("replaces");
4636      for (int i = 0; i < array.size(); i++) {
4637        res.getReplaces().add(parseCanonical(array.get(i).getAsString()));
4638      }
4639    };
4640    if (json.has("_replaces")) {
4641      JsonArray array = json.getAsJsonArray("_replaces");
4642      for (int i = 0; i < array.size(); i++) {
4643        if (i == res.getReplaces().size())
4644          res.getReplaces().add(parseCanonical(null));
4645        if (array.get(i) instanceof JsonObject) 
4646          parseElementProperties(array.get(i).getAsJsonObject(), res.getReplaces().get(i));
4647      }
4648    };
4649    if (json.has("status"))
4650      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
4651    if (json.has("_status"))
4652      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4653    if (json.has("experimental"))
4654      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
4655    if (json.has("_experimental"))
4656      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
4657    if (json.has("date"))
4658      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4659    if (json.has("_date"))
4660      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4661    if (json.has("publisher"))
4662      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
4663    if (json.has("_publisher"))
4664      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
4665    if (json.has("contact")) {
4666      JsonArray array = json.getAsJsonArray("contact");
4667      for (int i = 0; i < array.size(); i++) {
4668        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
4669      }
4670    };
4671    if (json.has("description"))
4672      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
4673    if (json.has("_description"))
4674      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4675    if (json.has("useContext")) {
4676      JsonArray array = json.getAsJsonArray("useContext");
4677      for (int i = 0; i < array.size(); i++) {
4678        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
4679      }
4680    };
4681    if (json.has("jurisdiction")) {
4682      JsonArray array = json.getAsJsonArray("jurisdiction");
4683      for (int i = 0; i < array.size(); i++) {
4684        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4685      }
4686    };
4687    if (json.has("copyright"))
4688      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
4689    if (json.has("_copyright"))
4690      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
4691    if (json.has("approvalDate"))
4692      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
4693    if (json.has("_approvalDate"))
4694      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
4695    if (json.has("lastReviewDate"))
4696      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
4697    if (json.has("_lastReviewDate"))
4698      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
4699    if (json.has("effectivePeriod"))
4700      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
4701    if (json.has("code"))
4702      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4703    if (json.has("instance")) {
4704      JsonArray array = json.getAsJsonArray("instance");
4705      for (int i = 0; i < array.size(); i++) {
4706        res.getInstance().add(parseReference(array.get(i).getAsJsonObject()));
4707      }
4708    };
4709    if (json.has("applicability")) {
4710      JsonArray array = json.getAsJsonArray("applicability");
4711      for (int i = 0; i < array.size(); i++) {
4712        res.getApplicability().add(parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject(), res));
4713      }
4714    };
4715    if (json.has("propertyGroup")) {
4716      JsonArray array = json.getAsJsonArray("propertyGroup");
4717      for (int i = 0; i < array.size(); i++) {
4718        res.getPropertyGroup().add(parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(array.get(i).getAsJsonObject(), res));
4719      }
4720    };
4721  }
4722
4723  protected ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(JsonObject json, ChargeItemDefinition owner) throws IOException, FHIRFormatError {
4724    ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res = new ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent();
4725    parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponentProperties(json, owner, res);
4726    return res;
4727  }
4728
4729  protected void parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponentProperties(JsonObject json, ChargeItemDefinition owner, ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res) throws IOException, FHIRFormatError {
4730    parseBackboneElementProperties(json, res);
4731    if (json.has("description"))
4732      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4733    if (json.has("_description"))
4734      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4735    if (json.has("language"))
4736      res.setLanguageElement(parseString(json.get("language").getAsString()));
4737    if (json.has("_language"))
4738      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
4739    if (json.has("expression"))
4740      res.setExpressionElement(parseString(json.get("expression").getAsString()));
4741    if (json.has("_expression"))
4742      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
4743  }
4744
4745  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(JsonObject json, ChargeItemDefinition owner) throws IOException, FHIRFormatError {
4746    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent();
4747    parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentProperties(json, owner, res);
4748    return res;
4749  }
4750
4751  protected void parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentProperties(JsonObject json, ChargeItemDefinition owner, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res) throws IOException, FHIRFormatError {
4752    parseBackboneElementProperties(json, res);
4753    if (json.has("applicability")) {
4754      JsonArray array = json.getAsJsonArray("applicability");
4755      for (int i = 0; i < array.size(); i++) {
4756        res.getApplicability().add(parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject(), owner));
4757      }
4758    };
4759    if (json.has("priceComponent")) {
4760      JsonArray array = json.getAsJsonArray("priceComponent");
4761      for (int i = 0; i < array.size(); i++) {
4762        res.getPriceComponent().add(parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(array.get(i).getAsJsonObject(), owner));
4763      }
4764    };
4765  }
4766
4767  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(JsonObject json, ChargeItemDefinition owner) throws IOException, FHIRFormatError {
4768    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent();
4769    parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(json, owner, res);
4770    return res;
4771  }
4772
4773  protected void parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(JsonObject json, ChargeItemDefinition owner, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent res) throws IOException, FHIRFormatError {
4774    parseBackboneElementProperties(json, res);
4775    if (json.has("type"))
4776      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ChargeItemDefinition.ChargeItemDefinitionPriceComponentType.NULL, new ChargeItemDefinition.ChargeItemDefinitionPriceComponentTypeEnumFactory()));
4777    if (json.has("_type"))
4778      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
4779    if (json.has("code"))
4780      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4781    if (json.has("factor"))
4782      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4783    if (json.has("_factor"))
4784      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
4785    if (json.has("amount"))
4786      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
4787  }
4788
4789  protected Claim parseClaim(JsonObject json) throws IOException, FHIRFormatError {
4790    Claim res = new Claim();
4791    parseClaimProperties(json, res);
4792    return res;
4793  }
4794
4795  protected void parseClaimProperties(JsonObject json, Claim res) throws IOException, FHIRFormatError {
4796    parseDomainResourceProperties(json, res);
4797    if (json.has("identifier")) {
4798      JsonArray array = json.getAsJsonArray("identifier");
4799      for (int i = 0; i < array.size(); i++) {
4800        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4801      }
4802    };
4803    if (json.has("status"))
4804      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Claim.ClaimStatus.NULL, new Claim.ClaimStatusEnumFactory()));
4805    if (json.has("_status"))
4806      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4807    if (json.has("type"))
4808      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4809    if (json.has("subType"))
4810      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
4811    if (json.has("use"))
4812      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Claim.Use.NULL, new Claim.UseEnumFactory()));
4813    if (json.has("_use"))
4814      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
4815    if (json.has("patient"))
4816      res.setPatient(parseReference(json.getAsJsonObject("patient")));
4817    if (json.has("billablePeriod"))
4818      res.setBillablePeriod(parsePeriod(json.getAsJsonObject("billablePeriod")));
4819    if (json.has("created"))
4820      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4821    if (json.has("_created"))
4822      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
4823    if (json.has("enterer"))
4824      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
4825    if (json.has("insurer"))
4826      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
4827    if (json.has("provider"))
4828      res.setProvider(parseReference(json.getAsJsonObject("provider")));
4829    if (json.has("priority"))
4830      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
4831    if (json.has("fundsReserve"))
4832      res.setFundsReserve(parseCodeableConcept(json.getAsJsonObject("fundsReserve")));
4833    if (json.has("related")) {
4834      JsonArray array = json.getAsJsonArray("related");
4835      for (int i = 0; i < array.size(); i++) {
4836        res.getRelated().add(parseClaimRelatedClaimComponent(array.get(i).getAsJsonObject(), res));
4837      }
4838    };
4839    if (json.has("prescription"))
4840      res.setPrescription(parseReference(json.getAsJsonObject("prescription")));
4841    if (json.has("originalPrescription"))
4842      res.setOriginalPrescription(parseReference(json.getAsJsonObject("originalPrescription")));
4843    if (json.has("payee"))
4844      res.setPayee(parseClaimPayeeComponent(json.getAsJsonObject("payee"), res));
4845    if (json.has("referral"))
4846      res.setReferral(parseReference(json.getAsJsonObject("referral")));
4847    if (json.has("facility"))
4848      res.setFacility(parseReference(json.getAsJsonObject("facility")));
4849    if (json.has("careTeam")) {
4850      JsonArray array = json.getAsJsonArray("careTeam");
4851      for (int i = 0; i < array.size(); i++) {
4852        res.getCareTeam().add(parseClaimCareTeamComponent(array.get(i).getAsJsonObject(), res));
4853      }
4854    };
4855    if (json.has("supportingInfo")) {
4856      JsonArray array = json.getAsJsonArray("supportingInfo");
4857      for (int i = 0; i < array.size(); i++) {
4858        res.getSupportingInfo().add(parseClaimSupportingInformationComponent(array.get(i).getAsJsonObject(), res));
4859      }
4860    };
4861    if (json.has("diagnosis")) {
4862      JsonArray array = json.getAsJsonArray("diagnosis");
4863      for (int i = 0; i < array.size(); i++) {
4864        res.getDiagnosis().add(parseClaimDiagnosisComponent(array.get(i).getAsJsonObject(), res));
4865      }
4866    };
4867    if (json.has("procedure")) {
4868      JsonArray array = json.getAsJsonArray("procedure");
4869      for (int i = 0; i < array.size(); i++) {
4870        res.getProcedure().add(parseClaimProcedureComponent(array.get(i).getAsJsonObject(), res));
4871      }
4872    };
4873    if (json.has("insurance")) {
4874      JsonArray array = json.getAsJsonArray("insurance");
4875      for (int i = 0; i < array.size(); i++) {
4876        res.getInsurance().add(parseClaimInsuranceComponent(array.get(i).getAsJsonObject(), res));
4877      }
4878    };
4879    if (json.has("accident"))
4880      res.setAccident(parseClaimAccidentComponent(json.getAsJsonObject("accident"), res));
4881    if (json.has("item")) {
4882      JsonArray array = json.getAsJsonArray("item");
4883      for (int i = 0; i < array.size(); i++) {
4884        res.getItem().add(parseClaimItemComponent(array.get(i).getAsJsonObject(), res));
4885      }
4886    };
4887    if (json.has("total"))
4888      res.setTotal(parseMoney(json.getAsJsonObject("total")));
4889  }
4890
4891  protected Claim.RelatedClaimComponent parseClaimRelatedClaimComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4892    Claim.RelatedClaimComponent res = new Claim.RelatedClaimComponent();
4893    parseClaimRelatedClaimComponentProperties(json, owner, res);
4894    return res;
4895  }
4896
4897  protected void parseClaimRelatedClaimComponentProperties(JsonObject json, Claim owner, Claim.RelatedClaimComponent res) throws IOException, FHIRFormatError {
4898    parseBackboneElementProperties(json, res);
4899    if (json.has("claim"))
4900      res.setClaim(parseReference(json.getAsJsonObject("claim")));
4901    if (json.has("relationship"))
4902      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
4903    if (json.has("reference"))
4904      res.setReference(parseIdentifier(json.getAsJsonObject("reference")));
4905  }
4906
4907  protected Claim.PayeeComponent parseClaimPayeeComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4908    Claim.PayeeComponent res = new Claim.PayeeComponent();
4909    parseClaimPayeeComponentProperties(json, owner, res);
4910    return res;
4911  }
4912
4913  protected void parseClaimPayeeComponentProperties(JsonObject json, Claim owner, Claim.PayeeComponent res) throws IOException, FHIRFormatError {
4914    parseBackboneElementProperties(json, res);
4915    if (json.has("type"))
4916      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4917    if (json.has("party"))
4918      res.setParty(parseReference(json.getAsJsonObject("party")));
4919  }
4920
4921  protected Claim.CareTeamComponent parseClaimCareTeamComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4922    Claim.CareTeamComponent res = new Claim.CareTeamComponent();
4923    parseClaimCareTeamComponentProperties(json, owner, res);
4924    return res;
4925  }
4926
4927  protected void parseClaimCareTeamComponentProperties(JsonObject json, Claim owner, Claim.CareTeamComponent res) throws IOException, FHIRFormatError {
4928    parseBackboneElementProperties(json, res);
4929    if (json.has("sequence"))
4930      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4931    if (json.has("_sequence"))
4932      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4933    if (json.has("provider"))
4934      res.setProvider(parseReference(json.getAsJsonObject("provider")));
4935    if (json.has("responsible"))
4936      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
4937    if (json.has("_responsible"))
4938      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
4939    if (json.has("role"))
4940      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
4941    if (json.has("qualification"))
4942      res.setQualification(parseCodeableConcept(json.getAsJsonObject("qualification")));
4943  }
4944
4945  protected Claim.SupportingInformationComponent parseClaimSupportingInformationComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4946    Claim.SupportingInformationComponent res = new Claim.SupportingInformationComponent();
4947    parseClaimSupportingInformationComponentProperties(json, owner, res);
4948    return res;
4949  }
4950
4951  protected void parseClaimSupportingInformationComponentProperties(JsonObject json, Claim owner, Claim.SupportingInformationComponent res) throws IOException, FHIRFormatError {
4952    parseBackboneElementProperties(json, res);
4953    if (json.has("sequence"))
4954      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4955    if (json.has("_sequence"))
4956      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4957    if (json.has("category"))
4958      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4959    if (json.has("code"))
4960      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4961    Type timing = parseType("timing", json);
4962    if (timing != null)
4963      res.setTiming(timing);
4964    Type value = parseType("value", json);
4965    if (value != null)
4966      res.setValue(value);
4967    if (json.has("reason"))
4968      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
4969  }
4970
4971  protected Claim.DiagnosisComponent parseClaimDiagnosisComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4972    Claim.DiagnosisComponent res = new Claim.DiagnosisComponent();
4973    parseClaimDiagnosisComponentProperties(json, owner, res);
4974    return res;
4975  }
4976
4977  protected void parseClaimDiagnosisComponentProperties(JsonObject json, Claim owner, Claim.DiagnosisComponent res) throws IOException, FHIRFormatError {
4978    parseBackboneElementProperties(json, res);
4979    if (json.has("sequence"))
4980      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4981    if (json.has("_sequence"))
4982      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4983    Type diagnosis = parseType("diagnosis", json);
4984    if (diagnosis != null)
4985      res.setDiagnosis(diagnosis);
4986    if (json.has("type")) {
4987      JsonArray array = json.getAsJsonArray("type");
4988      for (int i = 0; i < array.size(); i++) {
4989        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4990      }
4991    };
4992    if (json.has("onAdmission"))
4993      res.setOnAdmission(parseCodeableConcept(json.getAsJsonObject("onAdmission")));
4994    if (json.has("packageCode"))
4995      res.setPackageCode(parseCodeableConcept(json.getAsJsonObject("packageCode")));
4996  }
4997
4998  protected Claim.ProcedureComponent parseClaimProcedureComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4999    Claim.ProcedureComponent res = new Claim.ProcedureComponent();
5000    parseClaimProcedureComponentProperties(json, owner, res);
5001    return res;
5002  }
5003
5004  protected void parseClaimProcedureComponentProperties(JsonObject json, Claim owner, Claim.ProcedureComponent res) throws IOException, FHIRFormatError {
5005    parseBackboneElementProperties(json, res);
5006    if (json.has("sequence"))
5007      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5008    if (json.has("_sequence"))
5009      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5010    if (json.has("type")) {
5011      JsonArray array = json.getAsJsonArray("type");
5012      for (int i = 0; i < array.size(); i++) {
5013        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5014      }
5015    };
5016    if (json.has("date"))
5017      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5018    if (json.has("_date"))
5019      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5020    Type procedure = parseType("procedure", json);
5021    if (procedure != null)
5022      res.setProcedure(procedure);
5023    if (json.has("udi")) {
5024      JsonArray array = json.getAsJsonArray("udi");
5025      for (int i = 0; i < array.size(); i++) {
5026        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
5027      }
5028    };
5029  }
5030
5031  protected Claim.InsuranceComponent parseClaimInsuranceComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5032    Claim.InsuranceComponent res = new Claim.InsuranceComponent();
5033    parseClaimInsuranceComponentProperties(json, owner, res);
5034    return res;
5035  }
5036
5037  protected void parseClaimInsuranceComponentProperties(JsonObject json, Claim owner, Claim.InsuranceComponent res) throws IOException, FHIRFormatError {
5038    parseBackboneElementProperties(json, res);
5039    if (json.has("sequence"))
5040      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5041    if (json.has("_sequence"))
5042      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5043    if (json.has("focal"))
5044      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
5045    if (json.has("_focal"))
5046      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
5047    if (json.has("identifier"))
5048      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5049    if (json.has("coverage"))
5050      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
5051    if (json.has("businessArrangement"))
5052      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
5053    if (json.has("_businessArrangement"))
5054      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
5055    if (json.has("preAuthRef")) {
5056      JsonArray array = json.getAsJsonArray("preAuthRef");
5057      for (int i = 0; i < array.size(); i++) {
5058        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
5059      }
5060    };
5061    if (json.has("_preAuthRef")) {
5062      JsonArray array = json.getAsJsonArray("_preAuthRef");
5063      for (int i = 0; i < array.size(); i++) {
5064        if (i == res.getPreAuthRef().size())
5065          res.getPreAuthRef().add(parseString(null));
5066        if (array.get(i) instanceof JsonObject) 
5067          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
5068      }
5069    };
5070    if (json.has("claimResponse"))
5071      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
5072  }
5073
5074  protected Claim.AccidentComponent parseClaimAccidentComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5075    Claim.AccidentComponent res = new Claim.AccidentComponent();
5076    parseClaimAccidentComponentProperties(json, owner, res);
5077    return res;
5078  }
5079
5080  protected void parseClaimAccidentComponentProperties(JsonObject json, Claim owner, Claim.AccidentComponent res) throws IOException, FHIRFormatError {
5081    parseBackboneElementProperties(json, res);
5082    if (json.has("date"))
5083      res.setDateElement(parseDate(json.get("date").getAsString()));
5084    if (json.has("_date"))
5085      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5086    if (json.has("type"))
5087      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5088    Type location = parseType("location", json);
5089    if (location != null)
5090      res.setLocation(location);
5091  }
5092
5093  protected Claim.ItemComponent parseClaimItemComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5094    Claim.ItemComponent res = new Claim.ItemComponent();
5095    parseClaimItemComponentProperties(json, owner, res);
5096    return res;
5097  }
5098
5099  protected void parseClaimItemComponentProperties(JsonObject json, Claim owner, Claim.ItemComponent res) throws IOException, FHIRFormatError {
5100    parseBackboneElementProperties(json, res);
5101    if (json.has("sequence"))
5102      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5103    if (json.has("_sequence"))
5104      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5105    if (json.has("careTeamSequence")) {
5106      JsonArray array = json.getAsJsonArray("careTeamSequence");
5107      for (int i = 0; i < array.size(); i++) {
5108        res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
5109      }
5110    };
5111    if (json.has("_careTeamSequence")) {
5112      JsonArray array = json.getAsJsonArray("_careTeamSequence");
5113      for (int i = 0; i < array.size(); i++) {
5114        if (i == res.getCareTeamSequence().size())
5115          res.getCareTeamSequence().add(parsePositiveInt(null));
5116        if (array.get(i) instanceof JsonObject) 
5117          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
5118      }
5119    };
5120    if (json.has("diagnosisSequence")) {
5121      JsonArray array = json.getAsJsonArray("diagnosisSequence");
5122      for (int i = 0; i < array.size(); i++) {
5123        res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
5124      }
5125    };
5126    if (json.has("_diagnosisSequence")) {
5127      JsonArray array = json.getAsJsonArray("_diagnosisSequence");
5128      for (int i = 0; i < array.size(); i++) {
5129        if (i == res.getDiagnosisSequence().size())
5130          res.getDiagnosisSequence().add(parsePositiveInt(null));
5131        if (array.get(i) instanceof JsonObject) 
5132          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
5133      }
5134    };
5135    if (json.has("procedureSequence")) {
5136      JsonArray array = json.getAsJsonArray("procedureSequence");
5137      for (int i = 0; i < array.size(); i++) {
5138        res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
5139      }
5140    };
5141    if (json.has("_procedureSequence")) {
5142      JsonArray array = json.getAsJsonArray("_procedureSequence");
5143      for (int i = 0; i < array.size(); i++) {
5144        if (i == res.getProcedureSequence().size())
5145          res.getProcedureSequence().add(parsePositiveInt(null));
5146        if (array.get(i) instanceof JsonObject) 
5147          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
5148      }
5149    };
5150    if (json.has("informationSequence")) {
5151      JsonArray array = json.getAsJsonArray("informationSequence");
5152      for (int i = 0; i < array.size(); i++) {
5153        res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
5154      }
5155    };
5156    if (json.has("_informationSequence")) {
5157      JsonArray array = json.getAsJsonArray("_informationSequence");
5158      for (int i = 0; i < array.size(); i++) {
5159        if (i == res.getInformationSequence().size())
5160          res.getInformationSequence().add(parsePositiveInt(null));
5161        if (array.get(i) instanceof JsonObject) 
5162          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
5163      }
5164    };
5165    if (json.has("revenue"))
5166      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
5167    if (json.has("category"))
5168      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5169    if (json.has("productOrService"))
5170      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
5171    if (json.has("modifier")) {
5172      JsonArray array = json.getAsJsonArray("modifier");
5173      for (int i = 0; i < array.size(); i++) {
5174        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5175      }
5176    };
5177    if (json.has("programCode")) {
5178      JsonArray array = json.getAsJsonArray("programCode");
5179      for (int i = 0; i < array.size(); i++) {
5180        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5181      }
5182    };
5183    Type serviced = parseType("serviced", json);
5184    if (serviced != null)
5185      res.setServiced(serviced);
5186    Type location = parseType("location", json);
5187    if (location != null)
5188      res.setLocation(location);
5189    if (json.has("quantity"))
5190      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
5191    if (json.has("unitPrice"))
5192      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
5193    if (json.has("factor"))
5194      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5195    if (json.has("_factor"))
5196      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
5197    if (json.has("net"))
5198      res.setNet(parseMoney(json.getAsJsonObject("net")));
5199    if (json.has("udi")) {
5200      JsonArray array = json.getAsJsonArray("udi");
5201      for (int i = 0; i < array.size(); i++) {
5202        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
5203      }
5204    };
5205    if (json.has("bodySite"))
5206      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
5207    if (json.has("subSite")) {
5208      JsonArray array = json.getAsJsonArray("subSite");
5209      for (int i = 0; i < array.size(); i++) {
5210        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5211      }
5212    };
5213    if (json.has("encounter")) {
5214      JsonArray array = json.getAsJsonArray("encounter");
5215      for (int i = 0; i < array.size(); i++) {
5216        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
5217      }
5218    };
5219    if (json.has("detail")) {
5220      JsonArray array = json.getAsJsonArray("detail");
5221      for (int i = 0; i < array.size(); i++) {
5222        res.getDetail().add(parseClaimDetailComponent(array.get(i).getAsJsonObject(), owner));
5223      }
5224    };
5225  }
5226
5227  protected Claim.DetailComponent parseClaimDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5228    Claim.DetailComponent res = new Claim.DetailComponent();
5229    parseClaimDetailComponentProperties(json, owner, res);
5230    return res;
5231  }
5232
5233  protected void parseClaimDetailComponentProperties(JsonObject json, Claim owner, Claim.DetailComponent res) throws IOException, FHIRFormatError {
5234    parseBackboneElementProperties(json, res);
5235    if (json.has("sequence"))
5236      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5237    if (json.has("_sequence"))
5238      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5239    if (json.has("revenue"))
5240      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
5241    if (json.has("category"))
5242      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5243    if (json.has("productOrService"))
5244      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
5245    if (json.has("modifier")) {
5246      JsonArray array = json.getAsJsonArray("modifier");
5247      for (int i = 0; i < array.size(); i++) {
5248        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5249      }
5250    };
5251    if (json.has("programCode")) {
5252      JsonArray array = json.getAsJsonArray("programCode");
5253      for (int i = 0; i < array.size(); i++) {
5254        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5255      }
5256    };
5257    if (json.has("quantity"))
5258      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
5259    if (json.has("unitPrice"))
5260      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
5261    if (json.has("factor"))
5262      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5263    if (json.has("_factor"))
5264      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
5265    if (json.has("net"))
5266      res.setNet(parseMoney(json.getAsJsonObject("net")));
5267    if (json.has("udi")) {
5268      JsonArray array = json.getAsJsonArray("udi");
5269      for (int i = 0; i < array.size(); i++) {
5270        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
5271      }
5272    };
5273    if (json.has("subDetail")) {
5274      JsonArray array = json.getAsJsonArray("subDetail");
5275      for (int i = 0; i < array.size(); i++) {
5276        res.getSubDetail().add(parseClaimSubDetailComponent(array.get(i).getAsJsonObject(), owner));
5277      }
5278    };
5279  }
5280
5281  protected Claim.SubDetailComponent parseClaimSubDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5282    Claim.SubDetailComponent res = new Claim.SubDetailComponent();
5283    parseClaimSubDetailComponentProperties(json, owner, res);
5284    return res;
5285  }
5286
5287  protected void parseClaimSubDetailComponentProperties(JsonObject json, Claim owner, Claim.SubDetailComponent res) throws IOException, FHIRFormatError {
5288    parseBackboneElementProperties(json, res);
5289    if (json.has("sequence"))
5290      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5291    if (json.has("_sequence"))
5292      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5293    if (json.has("revenue"))
5294      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
5295    if (json.has("category"))
5296      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5297    if (json.has("productOrService"))
5298      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
5299    if (json.has("modifier")) {
5300      JsonArray array = json.getAsJsonArray("modifier");
5301      for (int i = 0; i < array.size(); i++) {
5302        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5303      }
5304    };
5305    if (json.has("programCode")) {
5306      JsonArray array = json.getAsJsonArray("programCode");
5307      for (int i = 0; i < array.size(); i++) {
5308        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5309      }
5310    };
5311    if (json.has("quantity"))
5312      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
5313    if (json.has("unitPrice"))
5314      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
5315    if (json.has("factor"))
5316      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5317    if (json.has("_factor"))
5318      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
5319    if (json.has("net"))
5320      res.setNet(parseMoney(json.getAsJsonObject("net")));
5321    if (json.has("udi")) {
5322      JsonArray array = json.getAsJsonArray("udi");
5323      for (int i = 0; i < array.size(); i++) {
5324        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
5325      }
5326    };
5327  }
5328
5329  protected ClaimResponse parseClaimResponse(JsonObject json) throws IOException, FHIRFormatError {
5330    ClaimResponse res = new ClaimResponse();
5331    parseClaimResponseProperties(json, res);
5332    return res;
5333  }
5334
5335  protected void parseClaimResponseProperties(JsonObject json, ClaimResponse res) throws IOException, FHIRFormatError {
5336    parseDomainResourceProperties(json, res);
5337    if (json.has("identifier")) {
5338      JsonArray array = json.getAsJsonArray("identifier");
5339      for (int i = 0; i < array.size(); i++) {
5340        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5341      }
5342    };
5343    if (json.has("status"))
5344      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClaimResponse.ClaimResponseStatus.NULL, new ClaimResponse.ClaimResponseStatusEnumFactory()));
5345    if (json.has("_status"))
5346      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5347    if (json.has("type"))
5348      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5349    if (json.has("subType"))
5350      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
5351    if (json.has("use"))
5352      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ClaimResponse.Use.NULL, new ClaimResponse.UseEnumFactory()));
5353    if (json.has("_use"))
5354      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
5355    if (json.has("patient"))
5356      res.setPatient(parseReference(json.getAsJsonObject("patient")));
5357    if (json.has("created"))
5358      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5359    if (json.has("_created"))
5360      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
5361    if (json.has("insurer"))
5362      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
5363    if (json.has("requestor"))
5364      res.setRequestor(parseReference(json.getAsJsonObject("requestor")));
5365    if (json.has("request"))
5366      res.setRequest(parseReference(json.getAsJsonObject("request")));
5367    if (json.has("outcome"))
5368      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), ClaimResponse.RemittanceOutcome.NULL, new ClaimResponse.RemittanceOutcomeEnumFactory()));
5369    if (json.has("_outcome"))
5370      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
5371    if (json.has("disposition"))
5372      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
5373    if (json.has("_disposition"))
5374      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
5375    if (json.has("preAuthRef"))
5376      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
5377    if (json.has("_preAuthRef"))
5378      parseElementProperties(json.getAsJsonObject("_preAuthRef"), res.getPreAuthRefElement());
5379    if (json.has("preAuthPeriod"))
5380      res.setPreAuthPeriod(parsePeriod(json.getAsJsonObject("preAuthPeriod")));
5381    if (json.has("payeeType"))
5382      res.setPayeeType(parseCodeableConcept(json.getAsJsonObject("payeeType")));
5383    if (json.has("item")) {
5384      JsonArray array = json.getAsJsonArray("item");
5385      for (int i = 0; i < array.size(); i++) {
5386        res.getItem().add(parseClaimResponseItemComponent(array.get(i).getAsJsonObject(), res));
5387      }
5388    };
5389    if (json.has("addItem")) {
5390      JsonArray array = json.getAsJsonArray("addItem");
5391      for (int i = 0; i < array.size(); i++) {
5392        res.getAddItem().add(parseClaimResponseAddedItemComponent(array.get(i).getAsJsonObject(), res));
5393      }
5394    };
5395    if (json.has("adjudication")) {
5396      JsonArray array = json.getAsJsonArray("adjudication");
5397      for (int i = 0; i < array.size(); i++) {
5398        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), res));
5399      }
5400    };
5401    if (json.has("total")) {
5402      JsonArray array = json.getAsJsonArray("total");
5403      for (int i = 0; i < array.size(); i++) {
5404        res.getTotal().add(parseClaimResponseTotalComponent(array.get(i).getAsJsonObject(), res));
5405      }
5406    };
5407    if (json.has("payment"))
5408      res.setPayment(parseClaimResponsePaymentComponent(json.getAsJsonObject("payment"), res));
5409    if (json.has("fundsReserve"))
5410      res.setFundsReserve(parseCodeableConcept(json.getAsJsonObject("fundsReserve")));
5411    if (json.has("formCode"))
5412      res.setFormCode(parseCodeableConcept(json.getAsJsonObject("formCode")));
5413    if (json.has("form"))
5414      res.setForm(parseAttachment(json.getAsJsonObject("form")));
5415    if (json.has("processNote")) {
5416      JsonArray array = json.getAsJsonArray("processNote");
5417      for (int i = 0; i < array.size(); i++) {
5418        res.getProcessNote().add(parseClaimResponseNoteComponent(array.get(i).getAsJsonObject(), res));
5419      }
5420    };
5421    if (json.has("communicationRequest")) {
5422      JsonArray array = json.getAsJsonArray("communicationRequest");
5423      for (int i = 0; i < array.size(); i++) {
5424        res.getCommunicationRequest().add(parseReference(array.get(i).getAsJsonObject()));
5425      }
5426    };
5427    if (json.has("insurance")) {
5428      JsonArray array = json.getAsJsonArray("insurance");
5429      for (int i = 0; i < array.size(); i++) {
5430        res.getInsurance().add(parseClaimResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
5431      }
5432    };
5433    if (json.has("error")) {
5434      JsonArray array = json.getAsJsonArray("error");
5435      for (int i = 0; i < array.size(); i++) {
5436        res.getError().add(parseClaimResponseErrorComponent(array.get(i).getAsJsonObject(), res));
5437      }
5438    };
5439  }
5440
5441  protected ClaimResponse.ItemComponent parseClaimResponseItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5442    ClaimResponse.ItemComponent res = new ClaimResponse.ItemComponent();
5443    parseClaimResponseItemComponentProperties(json, owner, res);
5444    return res;
5445  }
5446
5447  protected void parseClaimResponseItemComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ItemComponent res) throws IOException, FHIRFormatError {
5448    parseBackboneElementProperties(json, res);
5449    if (json.has("itemSequence"))
5450      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
5451    if (json.has("_itemSequence"))
5452      parseElementProperties(json.getAsJsonObject("_itemSequence"), res.getItemSequenceElement());
5453    if (json.has("noteNumber")) {
5454      JsonArray array = json.getAsJsonArray("noteNumber");
5455      for (int i = 0; i < array.size(); i++) {
5456        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5457      }
5458    };
5459    if (json.has("_noteNumber")) {
5460      JsonArray array = json.getAsJsonArray("_noteNumber");
5461      for (int i = 0; i < array.size(); i++) {
5462        if (i == res.getNoteNumber().size())
5463          res.getNoteNumber().add(parsePositiveInt(null));
5464        if (array.get(i) instanceof JsonObject) 
5465          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5466      }
5467    };
5468    if (json.has("adjudication")) {
5469      JsonArray array = json.getAsJsonArray("adjudication");
5470      for (int i = 0; i < array.size(); i++) {
5471        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5472      }
5473    };
5474    if (json.has("detail")) {
5475      JsonArray array = json.getAsJsonArray("detail");
5476      for (int i = 0; i < array.size(); i++) {
5477        res.getDetail().add(parseClaimResponseItemDetailComponent(array.get(i).getAsJsonObject(), owner));
5478      }
5479    };
5480  }
5481
5482  protected ClaimResponse.AdjudicationComponent parseClaimResponseAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5483    ClaimResponse.AdjudicationComponent res = new ClaimResponse.AdjudicationComponent();
5484    parseClaimResponseAdjudicationComponentProperties(json, owner, res);
5485    return res;
5486  }
5487
5488  protected void parseClaimResponseAdjudicationComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AdjudicationComponent res) throws IOException, FHIRFormatError {
5489    parseBackboneElementProperties(json, res);
5490    if (json.has("category"))
5491      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5492    if (json.has("reason"))
5493      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
5494    if (json.has("amount"))
5495      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
5496    if (json.has("value"))
5497      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
5498    if (json.has("_value"))
5499      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
5500  }
5501
5502  protected ClaimResponse.ItemDetailComponent parseClaimResponseItemDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5503    ClaimResponse.ItemDetailComponent res = new ClaimResponse.ItemDetailComponent();
5504    parseClaimResponseItemDetailComponentProperties(json, owner, res);
5505    return res;
5506  }
5507
5508  protected void parseClaimResponseItemDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ItemDetailComponent res) throws IOException, FHIRFormatError {
5509    parseBackboneElementProperties(json, res);
5510    if (json.has("detailSequence"))
5511      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
5512    if (json.has("_detailSequence"))
5513      parseElementProperties(json.getAsJsonObject("_detailSequence"), res.getDetailSequenceElement());
5514    if (json.has("noteNumber")) {
5515      JsonArray array = json.getAsJsonArray("noteNumber");
5516      for (int i = 0; i < array.size(); i++) {
5517        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5518      }
5519    };
5520    if (json.has("_noteNumber")) {
5521      JsonArray array = json.getAsJsonArray("_noteNumber");
5522      for (int i = 0; i < array.size(); i++) {
5523        if (i == res.getNoteNumber().size())
5524          res.getNoteNumber().add(parsePositiveInt(null));
5525        if (array.get(i) instanceof JsonObject) 
5526          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5527      }
5528    };
5529    if (json.has("adjudication")) {
5530      JsonArray array = json.getAsJsonArray("adjudication");
5531      for (int i = 0; i < array.size(); i++) {
5532        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5533      }
5534    };
5535    if (json.has("subDetail")) {
5536      JsonArray array = json.getAsJsonArray("subDetail");
5537      for (int i = 0; i < array.size(); i++) {
5538        res.getSubDetail().add(parseClaimResponseSubDetailComponent(array.get(i).getAsJsonObject(), owner));
5539      }
5540    };
5541  }
5542
5543  protected ClaimResponse.SubDetailComponent parseClaimResponseSubDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5544    ClaimResponse.SubDetailComponent res = new ClaimResponse.SubDetailComponent();
5545    parseClaimResponseSubDetailComponentProperties(json, owner, res);
5546    return res;
5547  }
5548
5549  protected void parseClaimResponseSubDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.SubDetailComponent res) throws IOException, FHIRFormatError {
5550    parseBackboneElementProperties(json, res);
5551    if (json.has("subDetailSequence"))
5552      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
5553    if (json.has("_subDetailSequence"))
5554      parseElementProperties(json.getAsJsonObject("_subDetailSequence"), res.getSubDetailSequenceElement());
5555    if (json.has("noteNumber")) {
5556      JsonArray array = json.getAsJsonArray("noteNumber");
5557      for (int i = 0; i < array.size(); i++) {
5558        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5559      }
5560    };
5561    if (json.has("_noteNumber")) {
5562      JsonArray array = json.getAsJsonArray("_noteNumber");
5563      for (int i = 0; i < array.size(); i++) {
5564        if (i == res.getNoteNumber().size())
5565          res.getNoteNumber().add(parsePositiveInt(null));
5566        if (array.get(i) instanceof JsonObject) 
5567          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5568      }
5569    };
5570    if (json.has("adjudication")) {
5571      JsonArray array = json.getAsJsonArray("adjudication");
5572      for (int i = 0; i < array.size(); i++) {
5573        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5574      }
5575    };
5576  }
5577
5578  protected ClaimResponse.AddedItemComponent parseClaimResponseAddedItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5579    ClaimResponse.AddedItemComponent res = new ClaimResponse.AddedItemComponent();
5580    parseClaimResponseAddedItemComponentProperties(json, owner, res);
5581    return res;
5582  }
5583
5584  protected void parseClaimResponseAddedItemComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemComponent res) throws IOException, FHIRFormatError {
5585    parseBackboneElementProperties(json, res);
5586    if (json.has("itemSequence")) {
5587      JsonArray array = json.getAsJsonArray("itemSequence");
5588      for (int i = 0; i < array.size(); i++) {
5589        res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
5590      }
5591    };
5592    if (json.has("_itemSequence")) {
5593      JsonArray array = json.getAsJsonArray("_itemSequence");
5594      for (int i = 0; i < array.size(); i++) {
5595        if (i == res.getItemSequence().size())
5596          res.getItemSequence().add(parsePositiveInt(null));
5597        if (array.get(i) instanceof JsonObject) 
5598          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
5599      }
5600    };
5601    if (json.has("detailSequence")) {
5602      JsonArray array = json.getAsJsonArray("detailSequence");
5603      for (int i = 0; i < array.size(); i++) {
5604        res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
5605      }
5606    };
5607    if (json.has("_detailSequence")) {
5608      JsonArray array = json.getAsJsonArray("_detailSequence");
5609      for (int i = 0; i < array.size(); i++) {
5610        if (i == res.getDetailSequence().size())
5611          res.getDetailSequence().add(parsePositiveInt(null));
5612        if (array.get(i) instanceof JsonObject) 
5613          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
5614      }
5615    };
5616    if (json.has("subdetailSequence")) {
5617      JsonArray array = json.getAsJsonArray("subdetailSequence");
5618      for (int i = 0; i < array.size(); i++) {
5619        res.getSubdetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
5620      }
5621    };
5622    if (json.has("_subdetailSequence")) {
5623      JsonArray array = json.getAsJsonArray("_subdetailSequence");
5624      for (int i = 0; i < array.size(); i++) {
5625        if (i == res.getSubdetailSequence().size())
5626          res.getSubdetailSequence().add(parsePositiveInt(null));
5627        if (array.get(i) instanceof JsonObject) 
5628          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubdetailSequence().get(i));
5629      }
5630    };
5631    if (json.has("provider")) {
5632      JsonArray array = json.getAsJsonArray("provider");
5633      for (int i = 0; i < array.size(); i++) {
5634        res.getProvider().add(parseReference(array.get(i).getAsJsonObject()));
5635      }
5636    };
5637    if (json.has("productOrService"))
5638      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
5639    if (json.has("modifier")) {
5640      JsonArray array = json.getAsJsonArray("modifier");
5641      for (int i = 0; i < array.size(); i++) {
5642        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5643      }
5644    };
5645    if (json.has("programCode")) {
5646      JsonArray array = json.getAsJsonArray("programCode");
5647      for (int i = 0; i < array.size(); i++) {
5648        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5649      }
5650    };
5651    Type serviced = parseType("serviced", json);
5652    if (serviced != null)
5653      res.setServiced(serviced);
5654    Type location = parseType("location", json);
5655    if (location != null)
5656      res.setLocation(location);
5657    if (json.has("quantity"))
5658      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
5659    if (json.has("unitPrice"))
5660      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
5661    if (json.has("factor"))
5662      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5663    if (json.has("_factor"))
5664      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
5665    if (json.has("net"))
5666      res.setNet(parseMoney(json.getAsJsonObject("net")));
5667    if (json.has("bodySite"))
5668      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
5669    if (json.has("subSite")) {
5670      JsonArray array = json.getAsJsonArray("subSite");
5671      for (int i = 0; i < array.size(); i++) {
5672        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5673      }
5674    };
5675    if (json.has("noteNumber")) {
5676      JsonArray array = json.getAsJsonArray("noteNumber");
5677      for (int i = 0; i < array.size(); i++) {
5678        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5679      }
5680    };
5681    if (json.has("_noteNumber")) {
5682      JsonArray array = json.getAsJsonArray("_noteNumber");
5683      for (int i = 0; i < array.size(); i++) {
5684        if (i == res.getNoteNumber().size())
5685          res.getNoteNumber().add(parsePositiveInt(null));
5686        if (array.get(i) instanceof JsonObject) 
5687          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5688      }
5689    };
5690    if (json.has("adjudication")) {
5691      JsonArray array = json.getAsJsonArray("adjudication");
5692      for (int i = 0; i < array.size(); i++) {
5693        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5694      }
5695    };
5696    if (json.has("detail")) {
5697      JsonArray array = json.getAsJsonArray("detail");
5698      for (int i = 0; i < array.size(); i++) {
5699        res.getDetail().add(parseClaimResponseAddedItemDetailComponent(array.get(i).getAsJsonObject(), owner));
5700      }
5701    };
5702  }
5703
5704  protected ClaimResponse.AddedItemDetailComponent parseClaimResponseAddedItemDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5705    ClaimResponse.AddedItemDetailComponent res = new ClaimResponse.AddedItemDetailComponent();
5706    parseClaimResponseAddedItemDetailComponentProperties(json, owner, res);
5707    return res;
5708  }
5709
5710  protected void parseClaimResponseAddedItemDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemDetailComponent res) throws IOException, FHIRFormatError {
5711    parseBackboneElementProperties(json, res);
5712    if (json.has("productOrService"))
5713      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
5714    if (json.has("modifier")) {
5715      JsonArray array = json.getAsJsonArray("modifier");
5716      for (int i = 0; i < array.size(); i++) {
5717        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5718      }
5719    };
5720    if (json.has("quantity"))
5721      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
5722    if (json.has("unitPrice"))
5723      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
5724    if (json.has("factor"))
5725      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5726    if (json.has("_factor"))
5727      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
5728    if (json.has("net"))
5729      res.setNet(parseMoney(json.getAsJsonObject("net")));
5730    if (json.has("noteNumber")) {
5731      JsonArray array = json.getAsJsonArray("noteNumber");
5732      for (int i = 0; i < array.size(); i++) {
5733        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5734      }
5735    };
5736    if (json.has("_noteNumber")) {
5737      JsonArray array = json.getAsJsonArray("_noteNumber");
5738      for (int i = 0; i < array.size(); i++) {
5739        if (i == res.getNoteNumber().size())
5740          res.getNoteNumber().add(parsePositiveInt(null));
5741        if (array.get(i) instanceof JsonObject) 
5742          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5743      }
5744    };
5745    if (json.has("adjudication")) {
5746      JsonArray array = json.getAsJsonArray("adjudication");
5747      for (int i = 0; i < array.size(); i++) {
5748        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5749      }
5750    };
5751    if (json.has("subDetail")) {
5752      JsonArray array = json.getAsJsonArray("subDetail");
5753      for (int i = 0; i < array.size(); i++) {
5754        res.getSubDetail().add(parseClaimResponseAddedItemSubDetailComponent(array.get(i).getAsJsonObject(), owner));
5755      }
5756    };
5757  }
5758
5759  protected ClaimResponse.AddedItemSubDetailComponent parseClaimResponseAddedItemSubDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5760    ClaimResponse.AddedItemSubDetailComponent res = new ClaimResponse.AddedItemSubDetailComponent();
5761    parseClaimResponseAddedItemSubDetailComponentProperties(json, owner, res);
5762    return res;
5763  }
5764
5765  protected void parseClaimResponseAddedItemSubDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemSubDetailComponent res) throws IOException, FHIRFormatError {
5766    parseBackboneElementProperties(json, res);
5767    if (json.has("productOrService"))
5768      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
5769    if (json.has("modifier")) {
5770      JsonArray array = json.getAsJsonArray("modifier");
5771      for (int i = 0; i < array.size(); i++) {
5772        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5773      }
5774    };
5775    if (json.has("quantity"))
5776      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
5777    if (json.has("unitPrice"))
5778      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
5779    if (json.has("factor"))
5780      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5781    if (json.has("_factor"))
5782      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
5783    if (json.has("net"))
5784      res.setNet(parseMoney(json.getAsJsonObject("net")));
5785    if (json.has("noteNumber")) {
5786      JsonArray array = json.getAsJsonArray("noteNumber");
5787      for (int i = 0; i < array.size(); i++) {
5788        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5789      }
5790    };
5791    if (json.has("_noteNumber")) {
5792      JsonArray array = json.getAsJsonArray("_noteNumber");
5793      for (int i = 0; i < array.size(); i++) {
5794        if (i == res.getNoteNumber().size())
5795          res.getNoteNumber().add(parsePositiveInt(null));
5796        if (array.get(i) instanceof JsonObject) 
5797          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5798      }
5799    };
5800    if (json.has("adjudication")) {
5801      JsonArray array = json.getAsJsonArray("adjudication");
5802      for (int i = 0; i < array.size(); i++) {
5803        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5804      }
5805    };
5806  }
5807
5808  protected ClaimResponse.TotalComponent parseClaimResponseTotalComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5809    ClaimResponse.TotalComponent res = new ClaimResponse.TotalComponent();
5810    parseClaimResponseTotalComponentProperties(json, owner, res);
5811    return res;
5812  }
5813
5814  protected void parseClaimResponseTotalComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.TotalComponent res) throws IOException, FHIRFormatError {
5815    parseBackboneElementProperties(json, res);
5816    if (json.has("category"))
5817      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5818    if (json.has("amount"))
5819      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
5820  }
5821
5822  protected ClaimResponse.PaymentComponent parseClaimResponsePaymentComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5823    ClaimResponse.PaymentComponent res = new ClaimResponse.PaymentComponent();
5824    parseClaimResponsePaymentComponentProperties(json, owner, res);
5825    return res;
5826  }
5827
5828  protected void parseClaimResponsePaymentComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.PaymentComponent res) throws IOException, FHIRFormatError {
5829    parseBackboneElementProperties(json, res);
5830    if (json.has("type"))
5831      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5832    if (json.has("adjustment"))
5833      res.setAdjustment(parseMoney(json.getAsJsonObject("adjustment")));
5834    if (json.has("adjustmentReason"))
5835      res.setAdjustmentReason(parseCodeableConcept(json.getAsJsonObject("adjustmentReason")));
5836    if (json.has("date"))
5837      res.setDateElement(parseDate(json.get("date").getAsString()));
5838    if (json.has("_date"))
5839      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5840    if (json.has("amount"))
5841      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
5842    if (json.has("identifier"))
5843      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5844  }
5845
5846  protected ClaimResponse.NoteComponent parseClaimResponseNoteComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5847    ClaimResponse.NoteComponent res = new ClaimResponse.NoteComponent();
5848    parseClaimResponseNoteComponentProperties(json, owner, res);
5849    return res;
5850  }
5851
5852  protected void parseClaimResponseNoteComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.NoteComponent res) throws IOException, FHIRFormatError {
5853    parseBackboneElementProperties(json, res);
5854    if (json.has("number"))
5855      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
5856    if (json.has("_number"))
5857      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
5858    if (json.has("type"))
5859      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
5860    if (json.has("_type"))
5861      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
5862    if (json.has("text"))
5863      res.setTextElement(parseString(json.get("text").getAsString()));
5864    if (json.has("_text"))
5865      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
5866    if (json.has("language"))
5867      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
5868  }
5869
5870  protected ClaimResponse.InsuranceComponent parseClaimResponseInsuranceComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5871    ClaimResponse.InsuranceComponent res = new ClaimResponse.InsuranceComponent();
5872    parseClaimResponseInsuranceComponentProperties(json, owner, res);
5873    return res;
5874  }
5875
5876  protected void parseClaimResponseInsuranceComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
5877    parseBackboneElementProperties(json, res);
5878    if (json.has("sequence"))
5879      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5880    if (json.has("_sequence"))
5881      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5882    if (json.has("focal"))
5883      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
5884    if (json.has("_focal"))
5885      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
5886    if (json.has("coverage"))
5887      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
5888    if (json.has("businessArrangement"))
5889      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
5890    if (json.has("_businessArrangement"))
5891      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
5892    if (json.has("claimResponse"))
5893      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
5894  }
5895
5896  protected ClaimResponse.ErrorComponent parseClaimResponseErrorComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5897    ClaimResponse.ErrorComponent res = new ClaimResponse.ErrorComponent();
5898    parseClaimResponseErrorComponentProperties(json, owner, res);
5899    return res;
5900  }
5901
5902  protected void parseClaimResponseErrorComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ErrorComponent res) throws IOException, FHIRFormatError {
5903    parseBackboneElementProperties(json, res);
5904    if (json.has("itemSequence"))
5905      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
5906    if (json.has("_itemSequence"))
5907      parseElementProperties(json.getAsJsonObject("_itemSequence"), res.getItemSequenceElement());
5908    if (json.has("detailSequence"))
5909      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
5910    if (json.has("_detailSequence"))
5911      parseElementProperties(json.getAsJsonObject("_detailSequence"), res.getDetailSequenceElement());
5912    if (json.has("subDetailSequence"))
5913      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
5914    if (json.has("_subDetailSequence"))
5915      parseElementProperties(json.getAsJsonObject("_subDetailSequence"), res.getSubDetailSequenceElement());
5916    if (json.has("code"))
5917      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5918  }
5919
5920  protected ClinicalImpression parseClinicalImpression(JsonObject json) throws IOException, FHIRFormatError {
5921    ClinicalImpression res = new ClinicalImpression();
5922    parseClinicalImpressionProperties(json, res);
5923    return res;
5924  }
5925
5926  protected void parseClinicalImpressionProperties(JsonObject json, ClinicalImpression res) throws IOException, FHIRFormatError {
5927    parseDomainResourceProperties(json, res);
5928    if (json.has("identifier")) {
5929      JsonArray array = json.getAsJsonArray("identifier");
5930      for (int i = 0; i < array.size(); i++) {
5931        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5932      }
5933    };
5934    if (json.has("status"))
5935      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClinicalImpression.ClinicalImpressionStatus.NULL, new ClinicalImpression.ClinicalImpressionStatusEnumFactory()));
5936    if (json.has("_status"))
5937      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5938    if (json.has("statusReason"))
5939      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
5940    if (json.has("code"))
5941      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5942    if (json.has("description"))
5943      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5944    if (json.has("_description"))
5945      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5946    if (json.has("subject"))
5947      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5948    if (json.has("encounter"))
5949      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
5950    Type effective = parseType("effective", json);
5951    if (effective != null)
5952      res.setEffective(effective);
5953    if (json.has("date"))
5954      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5955    if (json.has("_date"))
5956      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5957    if (json.has("assessor"))
5958      res.setAssessor(parseReference(json.getAsJsonObject("assessor")));
5959    if (json.has("previous"))
5960      res.setPrevious(parseReference(json.getAsJsonObject("previous")));
5961    if (json.has("problem")) {
5962      JsonArray array = json.getAsJsonArray("problem");
5963      for (int i = 0; i < array.size(); i++) {
5964        res.getProblem().add(parseReference(array.get(i).getAsJsonObject()));
5965      }
5966    };
5967    if (json.has("investigation")) {
5968      JsonArray array = json.getAsJsonArray("investigation");
5969      for (int i = 0; i < array.size(); i++) {
5970        res.getInvestigation().add(parseClinicalImpressionClinicalImpressionInvestigationComponent(array.get(i).getAsJsonObject(), res));
5971      }
5972    };
5973    if (json.has("protocol")) {
5974      JsonArray array = json.getAsJsonArray("protocol");
5975      for (int i = 0; i < array.size(); i++) {
5976        res.getProtocol().add(parseUri(array.get(i).getAsString()));
5977      }
5978    };
5979    if (json.has("_protocol")) {
5980      JsonArray array = json.getAsJsonArray("_protocol");
5981      for (int i = 0; i < array.size(); i++) {
5982        if (i == res.getProtocol().size())
5983          res.getProtocol().add(parseUri(null));
5984        if (array.get(i) instanceof JsonObject) 
5985          parseElementProperties(array.get(i).getAsJsonObject(), res.getProtocol().get(i));
5986      }
5987    };
5988    if (json.has("summary"))
5989      res.setSummaryElement(parseString(json.get("summary").getAsString()));
5990    if (json.has("_summary"))
5991      parseElementProperties(json.getAsJsonObject("_summary"), res.getSummaryElement());
5992    if (json.has("finding")) {
5993      JsonArray array = json.getAsJsonArray("finding");
5994      for (int i = 0; i < array.size(); i++) {
5995        res.getFinding().add(parseClinicalImpressionClinicalImpressionFindingComponent(array.get(i).getAsJsonObject(), res));
5996      }
5997    };
5998    if (json.has("prognosisCodeableConcept")) {
5999      JsonArray array = json.getAsJsonArray("prognosisCodeableConcept");
6000      for (int i = 0; i < array.size(); i++) {
6001        res.getPrognosisCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6002      }
6003    };
6004    if (json.has("prognosisReference")) {
6005      JsonArray array = json.getAsJsonArray("prognosisReference");
6006      for (int i = 0; i < array.size(); i++) {
6007        res.getPrognosisReference().add(parseReference(array.get(i).getAsJsonObject()));
6008      }
6009    };
6010    if (json.has("supportingInfo")) {
6011      JsonArray array = json.getAsJsonArray("supportingInfo");
6012      for (int i = 0; i < array.size(); i++) {
6013        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
6014      }
6015    };
6016    if (json.has("note")) {
6017      JsonArray array = json.getAsJsonArray("note");
6018      for (int i = 0; i < array.size(); i++) {
6019        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6020      }
6021    };
6022  }
6023
6024  protected ClinicalImpression.ClinicalImpressionInvestigationComponent parseClinicalImpressionClinicalImpressionInvestigationComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
6025    ClinicalImpression.ClinicalImpressionInvestigationComponent res = new ClinicalImpression.ClinicalImpressionInvestigationComponent();
6026    parseClinicalImpressionClinicalImpressionInvestigationComponentProperties(json, owner, res);
6027    return res;
6028  }
6029
6030  protected void parseClinicalImpressionClinicalImpressionInvestigationComponentProperties(JsonObject json, ClinicalImpression owner, ClinicalImpression.ClinicalImpressionInvestigationComponent res) throws IOException, FHIRFormatError {
6031    parseBackboneElementProperties(json, res);
6032    if (json.has("code"))
6033      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
6034    if (json.has("item")) {
6035      JsonArray array = json.getAsJsonArray("item");
6036      for (int i = 0; i < array.size(); i++) {
6037        res.getItem().add(parseReference(array.get(i).getAsJsonObject()));
6038      }
6039    };
6040  }
6041
6042  protected ClinicalImpression.ClinicalImpressionFindingComponent parseClinicalImpressionClinicalImpressionFindingComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
6043    ClinicalImpression.ClinicalImpressionFindingComponent res = new ClinicalImpression.ClinicalImpressionFindingComponent();
6044    parseClinicalImpressionClinicalImpressionFindingComponentProperties(json, owner, res);
6045    return res;
6046  }
6047
6048  protected void parseClinicalImpressionClinicalImpressionFindingComponentProperties(JsonObject json, ClinicalImpression owner, ClinicalImpression.ClinicalImpressionFindingComponent res) throws IOException, FHIRFormatError {
6049    parseBackboneElementProperties(json, res);
6050    if (json.has("itemCodeableConcept"))
6051      res.setItemCodeableConcept(parseCodeableConcept(json.getAsJsonObject("itemCodeableConcept")));
6052    if (json.has("itemReference"))
6053      res.setItemReference(parseReference(json.getAsJsonObject("itemReference")));
6054    if (json.has("basis"))
6055      res.setBasisElement(parseString(json.get("basis").getAsString()));
6056    if (json.has("_basis"))
6057      parseElementProperties(json.getAsJsonObject("_basis"), res.getBasisElement());
6058  }
6059
6060  protected CodeSystem parseCodeSystem(JsonObject json) throws IOException, FHIRFormatError {
6061    CodeSystem res = new CodeSystem();
6062    parseCodeSystemProperties(json, res);
6063    return res;
6064  }
6065
6066  protected void parseCodeSystemProperties(JsonObject json, CodeSystem res) throws IOException, FHIRFormatError {
6067    parseDomainResourceProperties(json, res);
6068    if (json.has("url"))
6069      res.setUrlElement(parseUri(json.get("url").getAsString()));
6070    if (json.has("_url"))
6071      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6072    if (json.has("identifier")) {
6073      JsonArray array = json.getAsJsonArray("identifier");
6074      for (int i = 0; i < array.size(); i++) {
6075        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6076      }
6077    };
6078    if (json.has("version"))
6079      res.setVersionElement(parseString(json.get("version").getAsString()));
6080    if (json.has("_version"))
6081      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
6082    if (json.has("name"))
6083      res.setNameElement(parseString(json.get("name").getAsString()));
6084    if (json.has("_name"))
6085      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6086    if (json.has("title"))
6087      res.setTitleElement(parseString(json.get("title").getAsString()));
6088    if (json.has("_title"))
6089      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
6090    if (json.has("status"))
6091      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
6092    if (json.has("_status"))
6093      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6094    if (json.has("experimental"))
6095      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
6096    if (json.has("_experimental"))
6097      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
6098    if (json.has("date"))
6099      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6100    if (json.has("_date"))
6101      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6102    if (json.has("publisher"))
6103      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6104    if (json.has("_publisher"))
6105      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
6106    if (json.has("contact")) {
6107      JsonArray array = json.getAsJsonArray("contact");
6108      for (int i = 0; i < array.size(); i++) {
6109        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
6110      }
6111    };
6112    if (json.has("description"))
6113      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
6114    if (json.has("_description"))
6115      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6116    if (json.has("useContext")) {
6117      JsonArray array = json.getAsJsonArray("useContext");
6118      for (int i = 0; i < array.size(); i++) {
6119        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
6120      }
6121    };
6122    if (json.has("jurisdiction")) {
6123      JsonArray array = json.getAsJsonArray("jurisdiction");
6124      for (int i = 0; i < array.size(); i++) {
6125        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6126      }
6127    };
6128    if (json.has("purpose"))
6129      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
6130    if (json.has("_purpose"))
6131      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
6132    if (json.has("copyright"))
6133      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
6134    if (json.has("_copyright"))
6135      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
6136    if (json.has("caseSensitive"))
6137      res.setCaseSensitiveElement(parseBoolean(json.get("caseSensitive").getAsBoolean()));
6138    if (json.has("_caseSensitive"))
6139      parseElementProperties(json.getAsJsonObject("_caseSensitive"), res.getCaseSensitiveElement());
6140    if (json.has("valueSet"))
6141      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
6142    if (json.has("_valueSet"))
6143      parseElementProperties(json.getAsJsonObject("_valueSet"), res.getValueSetElement());
6144    if (json.has("hierarchyMeaning"))
6145      res.setHierarchyMeaningElement(parseEnumeration(json.get("hierarchyMeaning").getAsString(), CodeSystem.CodeSystemHierarchyMeaning.NULL, new CodeSystem.CodeSystemHierarchyMeaningEnumFactory()));
6146    if (json.has("_hierarchyMeaning"))
6147      parseElementProperties(json.getAsJsonObject("_hierarchyMeaning"), res.getHierarchyMeaningElement());
6148    if (json.has("compositional"))
6149      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
6150    if (json.has("_compositional"))
6151      parseElementProperties(json.getAsJsonObject("_compositional"), res.getCompositionalElement());
6152    if (json.has("versionNeeded"))
6153      res.setVersionNeededElement(parseBoolean(json.get("versionNeeded").getAsBoolean()));
6154    if (json.has("_versionNeeded"))
6155      parseElementProperties(json.getAsJsonObject("_versionNeeded"), res.getVersionNeededElement());
6156    if (json.has("content"))
6157      res.setContentElement(parseEnumeration(json.get("content").getAsString(), CodeSystem.CodeSystemContentMode.NULL, new CodeSystem.CodeSystemContentModeEnumFactory()));
6158    if (json.has("_content"))
6159      parseElementProperties(json.getAsJsonObject("_content"), res.getContentElement());
6160    if (json.has("supplements"))
6161      res.setSupplementsElement(parseCanonical(json.get("supplements").getAsString()));
6162    if (json.has("_supplements"))
6163      parseElementProperties(json.getAsJsonObject("_supplements"), res.getSupplementsElement());
6164    if (json.has("count"))
6165      res.setCountElement(parseUnsignedInt(json.get("count").getAsString()));
6166    if (json.has("_count"))
6167      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
6168    if (json.has("filter")) {
6169      JsonArray array = json.getAsJsonArray("filter");
6170      for (int i = 0; i < array.size(); i++) {
6171        res.getFilter().add(parseCodeSystemCodeSystemFilterComponent(array.get(i).getAsJsonObject(), res));
6172      }
6173    };
6174    if (json.has("property")) {
6175      JsonArray array = json.getAsJsonArray("property");
6176      for (int i = 0; i < array.size(); i++) {
6177        res.getProperty().add(parseCodeSystemPropertyComponent(array.get(i).getAsJsonObject(), res));
6178      }
6179    };
6180    if (json.has("concept")) {
6181      JsonArray array = json.getAsJsonArray("concept");
6182      for (int i = 0; i < array.size(); i++) {
6183        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), res));
6184      }
6185    };
6186  }
6187
6188  protected CodeSystem.CodeSystemFilterComponent parseCodeSystemCodeSystemFilterComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6189    CodeSystem.CodeSystemFilterComponent res = new CodeSystem.CodeSystemFilterComponent();
6190    parseCodeSystemCodeSystemFilterComponentProperties(json, owner, res);
6191    return res;
6192  }
6193
6194  protected void parseCodeSystemCodeSystemFilterComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.CodeSystemFilterComponent res) throws IOException, FHIRFormatError {
6195    parseBackboneElementProperties(json, res);
6196    if (json.has("code"))
6197      res.setCodeElement(parseCode(json.get("code").getAsString()));
6198    if (json.has("_code"))
6199      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6200    if (json.has("description"))
6201      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6202    if (json.has("_description"))
6203      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6204    if (json.has("operator")) {
6205      JsonArray array = json.getAsJsonArray("operator");
6206      for (int i = 0; i < array.size(); i++) {
6207        res.getOperator().add(parseEnumeration(array.get(i).getAsString(), CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
6208      }
6209    };
6210    if (json.has("_operator")) {
6211      JsonArray array = json.getAsJsonArray("_operator");
6212      for (int i = 0; i < array.size(); i++) {
6213        if (i == res.getOperator().size())
6214          res.getOperator().add(parseEnumeration(null, CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
6215        if (array.get(i) instanceof JsonObject) 
6216          parseElementProperties(array.get(i).getAsJsonObject(), res.getOperator().get(i));
6217      }
6218    };
6219    if (json.has("value"))
6220      res.setValueElement(parseString(json.get("value").getAsString()));
6221    if (json.has("_value"))
6222      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
6223  }
6224
6225  protected CodeSystem.PropertyComponent parseCodeSystemPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6226    CodeSystem.PropertyComponent res = new CodeSystem.PropertyComponent();
6227    parseCodeSystemPropertyComponentProperties(json, owner, res);
6228    return res;
6229  }
6230
6231  protected void parseCodeSystemPropertyComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.PropertyComponent res) throws IOException, FHIRFormatError {
6232    parseBackboneElementProperties(json, res);
6233    if (json.has("code"))
6234      res.setCodeElement(parseCode(json.get("code").getAsString()));
6235    if (json.has("_code"))
6236      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6237    if (json.has("uri"))
6238      res.setUriElement(parseUri(json.get("uri").getAsString()));
6239    if (json.has("_uri"))
6240      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
6241    if (json.has("description"))
6242      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6243    if (json.has("_description"))
6244      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6245    if (json.has("type"))
6246      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), CodeSystem.PropertyType.NULL, new CodeSystem.PropertyTypeEnumFactory()));
6247    if (json.has("_type"))
6248      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
6249  }
6250
6251  protected CodeSystem.ConceptDefinitionComponent parseCodeSystemConceptDefinitionComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6252    CodeSystem.ConceptDefinitionComponent res = new CodeSystem.ConceptDefinitionComponent();
6253    parseCodeSystemConceptDefinitionComponentProperties(json, owner, res);
6254    return res;
6255  }
6256
6257  protected void parseCodeSystemConceptDefinitionComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptDefinitionComponent res) throws IOException, FHIRFormatError {
6258    parseBackboneElementProperties(json, res);
6259    if (json.has("code"))
6260      res.setCodeElement(parseCode(json.get("code").getAsString()));
6261    if (json.has("_code"))
6262      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6263    if (json.has("display"))
6264      res.setDisplayElement(parseString(json.get("display").getAsString()));
6265    if (json.has("_display"))
6266      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
6267    if (json.has("definition"))
6268      res.setDefinitionElement(parseString(json.get("definition").getAsString()));
6269    if (json.has("_definition"))
6270      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
6271    if (json.has("designation")) {
6272      JsonArray array = json.getAsJsonArray("designation");
6273      for (int i = 0; i < array.size(); i++) {
6274        res.getDesignation().add(parseCodeSystemConceptDefinitionDesignationComponent(array.get(i).getAsJsonObject(), owner));
6275      }
6276    };
6277    if (json.has("property")) {
6278      JsonArray array = json.getAsJsonArray("property");
6279      for (int i = 0; i < array.size(); i++) {
6280        res.getProperty().add(parseCodeSystemConceptPropertyComponent(array.get(i).getAsJsonObject(), owner));
6281      }
6282    };
6283    if (json.has("concept")) {
6284      JsonArray array = json.getAsJsonArray("concept");
6285      for (int i = 0; i < array.size(); i++) {
6286        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), owner));
6287      }
6288    };
6289  }
6290
6291  protected CodeSystem.ConceptDefinitionDesignationComponent parseCodeSystemConceptDefinitionDesignationComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6292    CodeSystem.ConceptDefinitionDesignationComponent res = new CodeSystem.ConceptDefinitionDesignationComponent();
6293    parseCodeSystemConceptDefinitionDesignationComponentProperties(json, owner, res);
6294    return res;
6295  }
6296
6297  protected void parseCodeSystemConceptDefinitionDesignationComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptDefinitionDesignationComponent res) throws IOException, FHIRFormatError {
6298    parseBackboneElementProperties(json, res);
6299    if (json.has("language"))
6300      res.setLanguageElement(parseCode(json.get("language").getAsString()));
6301    if (json.has("_language"))
6302      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
6303    if (json.has("use"))
6304      res.setUse(parseCoding(json.getAsJsonObject("use")));
6305    if (json.has("value"))
6306      res.setValueElement(parseString(json.get("value").getAsString()));
6307    if (json.has("_value"))
6308      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
6309  }
6310
6311  protected CodeSystem.ConceptPropertyComponent parseCodeSystemConceptPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6312    CodeSystem.ConceptPropertyComponent res = new CodeSystem.ConceptPropertyComponent();
6313    parseCodeSystemConceptPropertyComponentProperties(json, owner, res);
6314    return res;
6315  }
6316
6317  protected void parseCodeSystemConceptPropertyComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptPropertyComponent res) throws IOException, FHIRFormatError {
6318    parseBackboneElementProperties(json, res);
6319    if (json.has("code"))
6320      res.setCodeElement(parseCode(json.get("code").getAsString()));
6321    if (json.has("_code"))
6322      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6323    Type value = parseType("value", json);
6324    if (value != null)
6325      res.setValue(value);
6326  }
6327
6328  protected Communication parseCommunication(JsonObject json) throws IOException, FHIRFormatError {
6329    Communication res = new Communication();
6330    parseCommunicationProperties(json, res);
6331    return res;
6332  }
6333
6334  protected void parseCommunicationProperties(JsonObject json, Communication res) throws IOException, FHIRFormatError {
6335    parseDomainResourceProperties(json, res);
6336    if (json.has("identifier")) {
6337      JsonArray array = json.getAsJsonArray("identifier");
6338      for (int i = 0; i < array.size(); i++) {
6339        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6340      }
6341    };
6342    if (json.has("instantiatesCanonical")) {
6343      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
6344      for (int i = 0; i < array.size(); i++) {
6345        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
6346      }
6347    };
6348    if (json.has("_instantiatesCanonical")) {
6349      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
6350      for (int i = 0; i < array.size(); i++) {
6351        if (i == res.getInstantiatesCanonical().size())
6352          res.getInstantiatesCanonical().add(parseCanonical(null));
6353        if (array.get(i) instanceof JsonObject) 
6354          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
6355      }
6356    };
6357    if (json.has("instantiatesUri")) {
6358      JsonArray array = json.getAsJsonArray("instantiatesUri");
6359      for (int i = 0; i < array.size(); i++) {
6360        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
6361      }
6362    };
6363    if (json.has("_instantiatesUri")) {
6364      JsonArray array = json.getAsJsonArray("_instantiatesUri");
6365      for (int i = 0; i < array.size(); i++) {
6366        if (i == res.getInstantiatesUri().size())
6367          res.getInstantiatesUri().add(parseUri(null));
6368        if (array.get(i) instanceof JsonObject) 
6369          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
6370      }
6371    };
6372    if (json.has("basedOn")) {
6373      JsonArray array = json.getAsJsonArray("basedOn");
6374      for (int i = 0; i < array.size(); i++) {
6375        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
6376      }
6377    };
6378    if (json.has("partOf")) {
6379      JsonArray array = json.getAsJsonArray("partOf");
6380      for (int i = 0; i < array.size(); i++) {
6381        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
6382      }
6383    };
6384    if (json.has("inResponseTo")) {
6385      JsonArray array = json.getAsJsonArray("inResponseTo");
6386      for (int i = 0; i < array.size(); i++) {
6387        res.getInResponseTo().add(parseReference(array.get(i).getAsJsonObject()));
6388      }
6389    };
6390    if (json.has("status"))
6391      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Communication.CommunicationStatus.NULL, new Communication.CommunicationStatusEnumFactory()));
6392    if (json.has("_status"))
6393      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6394    if (json.has("statusReason"))
6395      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
6396    if (json.has("category")) {
6397      JsonArray array = json.getAsJsonArray("category");
6398      for (int i = 0; i < array.size(); i++) {
6399        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6400      }
6401    };
6402    if (json.has("priority"))
6403      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Communication.CommunicationPriority.NULL, new Communication.CommunicationPriorityEnumFactory()));
6404    if (json.has("_priority"))
6405      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
6406    if (json.has("medium")) {
6407      JsonArray array = json.getAsJsonArray("medium");
6408      for (int i = 0; i < array.size(); i++) {
6409        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6410      }
6411    };
6412    if (json.has("subject"))
6413      res.setSubject(parseReference(json.getAsJsonObject("subject")));
6414    if (json.has("topic"))
6415      res.setTopic(parseCodeableConcept(json.getAsJsonObject("topic")));
6416    if (json.has("about")) {
6417      JsonArray array = json.getAsJsonArray("about");
6418      for (int i = 0; i < array.size(); i++) {
6419        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
6420      }
6421    };
6422    if (json.has("encounter"))
6423      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
6424    if (json.has("sent"))
6425      res.setSentElement(parseDateTime(json.get("sent").getAsString()));
6426    if (json.has("_sent"))
6427      parseElementProperties(json.getAsJsonObject("_sent"), res.getSentElement());
6428    if (json.has("received"))
6429      res.setReceivedElement(parseDateTime(json.get("received").getAsString()));
6430    if (json.has("_received"))
6431      parseElementProperties(json.getAsJsonObject("_received"), res.getReceivedElement());
6432    if (json.has("recipient")) {
6433      JsonArray array = json.getAsJsonArray("recipient");
6434      for (int i = 0; i < array.size(); i++) {
6435        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
6436      }
6437    };
6438    if (json.has("sender"))
6439      res.setSender(parseReference(json.getAsJsonObject("sender")));
6440    if (json.has("reasonCode")) {
6441      JsonArray array = json.getAsJsonArray("reasonCode");
6442      for (int i = 0; i < array.size(); i++) {
6443        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6444      }
6445    };
6446    if (json.has("reasonReference")) {
6447      JsonArray array = json.getAsJsonArray("reasonReference");
6448      for (int i = 0; i < array.size(); i++) {
6449        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
6450      }
6451    };
6452    if (json.has("payload")) {
6453      JsonArray array = json.getAsJsonArray("payload");
6454      for (int i = 0; i < array.size(); i++) {
6455        res.getPayload().add(parseCommunicationCommunicationPayloadComponent(array.get(i).getAsJsonObject(), res));
6456      }
6457    };
6458    if (json.has("note")) {
6459      JsonArray array = json.getAsJsonArray("note");
6460      for (int i = 0; i < array.size(); i++) {
6461        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6462      }
6463    };
6464  }
6465
6466  protected Communication.CommunicationPayloadComponent parseCommunicationCommunicationPayloadComponent(JsonObject json, Communication owner) throws IOException, FHIRFormatError {
6467    Communication.CommunicationPayloadComponent res = new Communication.CommunicationPayloadComponent();
6468    parseCommunicationCommunicationPayloadComponentProperties(json, owner, res);
6469    return res;
6470  }
6471
6472  protected void parseCommunicationCommunicationPayloadComponentProperties(JsonObject json, Communication owner, Communication.CommunicationPayloadComponent res) throws IOException, FHIRFormatError {
6473    parseBackboneElementProperties(json, res);
6474    Type content = parseType("content", json);
6475    if (content != null)
6476      res.setContent(content);
6477  }
6478
6479  protected CommunicationRequest parseCommunicationRequest(JsonObject json) throws IOException, FHIRFormatError {
6480    CommunicationRequest res = new CommunicationRequest();
6481    parseCommunicationRequestProperties(json, res);
6482    return res;
6483  }
6484
6485  protected void parseCommunicationRequestProperties(JsonObject json, CommunicationRequest res) throws IOException, FHIRFormatError {
6486    parseDomainResourceProperties(json, res);
6487    if (json.has("identifier")) {
6488      JsonArray array = json.getAsJsonArray("identifier");
6489      for (int i = 0; i < array.size(); i++) {
6490        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6491      }
6492    };
6493    if (json.has("basedOn")) {
6494      JsonArray array = json.getAsJsonArray("basedOn");
6495      for (int i = 0; i < array.size(); i++) {
6496        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
6497      }
6498    };
6499    if (json.has("replaces")) {
6500      JsonArray array = json.getAsJsonArray("replaces");
6501      for (int i = 0; i < array.size(); i++) {
6502        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
6503      }
6504    };
6505    if (json.has("groupIdentifier"))
6506      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
6507    if (json.has("status"))
6508      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CommunicationRequest.CommunicationRequestStatus.NULL, new CommunicationRequest.CommunicationRequestStatusEnumFactory()));
6509    if (json.has("_status"))
6510      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6511    if (json.has("statusReason"))
6512      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
6513    if (json.has("category")) {
6514      JsonArray array = json.getAsJsonArray("category");
6515      for (int i = 0; i < array.size(); i++) {
6516        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6517      }
6518    };
6519    if (json.has("priority"))
6520      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), CommunicationRequest.CommunicationPriority.NULL, new CommunicationRequest.CommunicationPriorityEnumFactory()));
6521    if (json.has("_priority"))
6522      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
6523    if (json.has("doNotPerform"))
6524      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
6525    if (json.has("_doNotPerform"))
6526      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
6527    if (json.has("medium")) {
6528      JsonArray array = json.getAsJsonArray("medium");
6529      for (int i = 0; i < array.size(); i++) {
6530        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6531      }
6532    };
6533    if (json.has("subject"))
6534      res.setSubject(parseReference(json.getAsJsonObject("subject")));
6535    if (json.has("about")) {
6536      JsonArray array = json.getAsJsonArray("about");
6537      for (int i = 0; i < array.size(); i++) {
6538        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
6539      }
6540    };
6541    if (json.has("encounter"))
6542      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
6543    if (json.has("payload")) {
6544      JsonArray array = json.getAsJsonArray("payload");
6545      for (int i = 0; i < array.size(); i++) {
6546        res.getPayload().add(parseCommunicationRequestCommunicationRequestPayloadComponent(array.get(i).getAsJsonObject(), res));
6547      }
6548    };
6549    Type occurrence = parseType("occurrence", json);
6550    if (occurrence != null)
6551      res.setOccurrence(occurrence);
6552    if (json.has("authoredOn"))
6553      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
6554    if (json.has("_authoredOn"))
6555      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
6556    if (json.has("requester"))
6557      res.setRequester(parseReference(json.getAsJsonObject("requester")));
6558    if (json.has("recipient")) {
6559      JsonArray array = json.getAsJsonArray("recipient");
6560      for (int i = 0; i < array.size(); i++) {
6561        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
6562      }
6563    };
6564    if (json.has("sender"))
6565      res.setSender(parseReference(json.getAsJsonObject("sender")));
6566    if (json.has("reasonCode")) {
6567      JsonArray array = json.getAsJsonArray("reasonCode");
6568      for (int i = 0; i < array.size(); i++) {
6569        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6570      }
6571    };
6572    if (json.has("reasonReference")) {
6573      JsonArray array = json.getAsJsonArray("reasonReference");
6574      for (int i = 0; i < array.size(); i++) {
6575        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
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 CommunicationRequest.CommunicationRequestPayloadComponent parseCommunicationRequestCommunicationRequestPayloadComponent(JsonObject json, CommunicationRequest owner) throws IOException, FHIRFormatError {
6587    CommunicationRequest.CommunicationRequestPayloadComponent res = new CommunicationRequest.CommunicationRequestPayloadComponent();
6588    parseCommunicationRequestCommunicationRequestPayloadComponentProperties(json, owner, res);
6589    return res;
6590  }
6591
6592  protected void parseCommunicationRequestCommunicationRequestPayloadComponentProperties(JsonObject json, CommunicationRequest owner, CommunicationRequest.CommunicationRequestPayloadComponent res) throws IOException, FHIRFormatError {
6593    parseBackboneElementProperties(json, res);
6594    Type content = parseType("content", json);
6595    if (content != null)
6596      res.setContent(content);
6597  }
6598
6599  protected CompartmentDefinition parseCompartmentDefinition(JsonObject json) throws IOException, FHIRFormatError {
6600    CompartmentDefinition res = new CompartmentDefinition();
6601    parseCompartmentDefinitionProperties(json, res);
6602    return res;
6603  }
6604
6605  protected void parseCompartmentDefinitionProperties(JsonObject json, CompartmentDefinition res) throws IOException, FHIRFormatError {
6606    parseDomainResourceProperties(json, res);
6607    if (json.has("url"))
6608      res.setUrlElement(parseUri(json.get("url").getAsString()));
6609    if (json.has("_url"))
6610      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6611    if (json.has("version"))
6612      res.setVersionElement(parseString(json.get("version").getAsString()));
6613    if (json.has("_version"))
6614      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
6615    if (json.has("name"))
6616      res.setNameElement(parseString(json.get("name").getAsString()));
6617    if (json.has("_name"))
6618      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6619    if (json.has("status"))
6620      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
6621    if (json.has("_status"))
6622      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6623    if (json.has("experimental"))
6624      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
6625    if (json.has("_experimental"))
6626      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
6627    if (json.has("date"))
6628      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6629    if (json.has("_date"))
6630      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6631    if (json.has("publisher"))
6632      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6633    if (json.has("_publisher"))
6634      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
6635    if (json.has("contact")) {
6636      JsonArray array = json.getAsJsonArray("contact");
6637      for (int i = 0; i < array.size(); i++) {
6638        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
6639      }
6640    };
6641    if (json.has("description"))
6642      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
6643    if (json.has("_description"))
6644      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6645    if (json.has("useContext")) {
6646      JsonArray array = json.getAsJsonArray("useContext");
6647      for (int i = 0; i < array.size(); i++) {
6648        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
6649      }
6650    };
6651    if (json.has("purpose"))
6652      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
6653    if (json.has("_purpose"))
6654      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
6655    if (json.has("code"))
6656      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CompartmentDefinition.CompartmentType.NULL, new CompartmentDefinition.CompartmentTypeEnumFactory()));
6657    if (json.has("_code"))
6658      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6659    if (json.has("search"))
6660      res.setSearchElement(parseBoolean(json.get("search").getAsBoolean()));
6661    if (json.has("_search"))
6662      parseElementProperties(json.getAsJsonObject("_search"), res.getSearchElement());
6663    if (json.has("resource")) {
6664      JsonArray array = json.getAsJsonArray("resource");
6665      for (int i = 0; i < array.size(); i++) {
6666        res.getResource().add(parseCompartmentDefinitionCompartmentDefinitionResourceComponent(array.get(i).getAsJsonObject(), res));
6667      }
6668    };
6669  }
6670
6671  protected CompartmentDefinition.CompartmentDefinitionResourceComponent parseCompartmentDefinitionCompartmentDefinitionResourceComponent(JsonObject json, CompartmentDefinition owner) throws IOException, FHIRFormatError {
6672    CompartmentDefinition.CompartmentDefinitionResourceComponent res = new CompartmentDefinition.CompartmentDefinitionResourceComponent();
6673    parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(json, owner, res);
6674    return res;
6675  }
6676
6677  protected void parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(JsonObject json, CompartmentDefinition owner, CompartmentDefinition.CompartmentDefinitionResourceComponent res) throws IOException, FHIRFormatError {
6678    parseBackboneElementProperties(json, res);
6679    if (json.has("code"))
6680      res.setCodeElement(parseCode(json.get("code").getAsString()));
6681    if (json.has("_code"))
6682      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6683    if (json.has("param")) {
6684      JsonArray array = json.getAsJsonArray("param");
6685      for (int i = 0; i < array.size(); i++) {
6686        res.getParam().add(parseString(array.get(i).getAsString()));
6687      }
6688    };
6689    if (json.has("_param")) {
6690      JsonArray array = json.getAsJsonArray("_param");
6691      for (int i = 0; i < array.size(); i++) {
6692        if (i == res.getParam().size())
6693          res.getParam().add(parseString(null));
6694        if (array.get(i) instanceof JsonObject) 
6695          parseElementProperties(array.get(i).getAsJsonObject(), res.getParam().get(i));
6696      }
6697    };
6698    if (json.has("documentation"))
6699      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
6700    if (json.has("_documentation"))
6701      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
6702  }
6703
6704  protected Composition parseComposition(JsonObject json) throws IOException, FHIRFormatError {
6705    Composition res = new Composition();
6706    parseCompositionProperties(json, res);
6707    return res;
6708  }
6709
6710  protected void parseCompositionProperties(JsonObject json, Composition res) throws IOException, FHIRFormatError {
6711    parseDomainResourceProperties(json, res);
6712    if (json.has("identifier"))
6713      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6714    if (json.has("status"))
6715      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Composition.CompositionStatus.NULL, new Composition.CompositionStatusEnumFactory()));
6716    if (json.has("_status"))
6717      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6718    if (json.has("type"))
6719      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6720    if (json.has("category")) {
6721      JsonArray array = json.getAsJsonArray("category");
6722      for (int i = 0; i < array.size(); i++) {
6723        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6724      }
6725    };
6726    if (json.has("subject"))
6727      res.setSubject(parseReference(json.getAsJsonObject("subject")));
6728    if (json.has("encounter"))
6729      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
6730    if (json.has("date"))
6731      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6732    if (json.has("_date"))
6733      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6734    if (json.has("author")) {
6735      JsonArray array = json.getAsJsonArray("author");
6736      for (int i = 0; i < array.size(); i++) {
6737        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
6738      }
6739    };
6740    if (json.has("title"))
6741      res.setTitleElement(parseString(json.get("title").getAsString()));
6742    if (json.has("_title"))
6743      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
6744    if (json.has("confidentiality"))
6745      res.setConfidentialityElement(parseEnumeration(json.get("confidentiality").getAsString(), Composition.DocumentConfidentiality.NULL, new Composition.DocumentConfidentialityEnumFactory()));
6746    if (json.has("_confidentiality"))
6747      parseElementProperties(json.getAsJsonObject("_confidentiality"), res.getConfidentialityElement());
6748    if (json.has("attester")) {
6749      JsonArray array = json.getAsJsonArray("attester");
6750      for (int i = 0; i < array.size(); i++) {
6751        res.getAttester().add(parseCompositionCompositionAttesterComponent(array.get(i).getAsJsonObject(), res));
6752      }
6753    };
6754    if (json.has("custodian"))
6755      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
6756    if (json.has("relatesTo")) {
6757      JsonArray array = json.getAsJsonArray("relatesTo");
6758      for (int i = 0; i < array.size(); i++) {
6759        res.getRelatesTo().add(parseCompositionCompositionRelatesToComponent(array.get(i).getAsJsonObject(), res));
6760      }
6761    };
6762    if (json.has("event")) {
6763      JsonArray array = json.getAsJsonArray("event");
6764      for (int i = 0; i < array.size(); i++) {
6765        res.getEvent().add(parseCompositionCompositionEventComponent(array.get(i).getAsJsonObject(), res));
6766      }
6767    };
6768    if (json.has("section")) {
6769      JsonArray array = json.getAsJsonArray("section");
6770      for (int i = 0; i < array.size(); i++) {
6771        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), res));
6772      }
6773    };
6774  }
6775
6776  protected Composition.CompositionAttesterComponent parseCompositionCompositionAttesterComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
6777    Composition.CompositionAttesterComponent res = new Composition.CompositionAttesterComponent();
6778    parseCompositionCompositionAttesterComponentProperties(json, owner, res);
6779    return res;
6780  }
6781
6782  protected void parseCompositionCompositionAttesterComponentProperties(JsonObject json, Composition owner, Composition.CompositionAttesterComponent res) throws IOException, FHIRFormatError {
6783    parseBackboneElementProperties(json, res);
6784    if (json.has("mode"))
6785      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
6786    if (json.has("_mode"))
6787      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
6788    if (json.has("time"))
6789      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
6790    if (json.has("_time"))
6791      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
6792    if (json.has("party"))
6793      res.setParty(parseReference(json.getAsJsonObject("party")));
6794  }
6795
6796  protected Composition.CompositionRelatesToComponent parseCompositionCompositionRelatesToComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
6797    Composition.CompositionRelatesToComponent res = new Composition.CompositionRelatesToComponent();
6798    parseCompositionCompositionRelatesToComponentProperties(json, owner, res);
6799    return res;
6800  }
6801
6802  protected void parseCompositionCompositionRelatesToComponentProperties(JsonObject json, Composition owner, Composition.CompositionRelatesToComponent res) throws IOException, FHIRFormatError {
6803    parseBackboneElementProperties(json, res);
6804    if (json.has("code"))
6805      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Composition.DocumentRelationshipType.NULL, new Composition.DocumentRelationshipTypeEnumFactory()));
6806    if (json.has("_code"))
6807      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6808    Type target = parseType("target", json);
6809    if (target != null)
6810      res.setTarget(target);
6811  }
6812
6813  protected Composition.CompositionEventComponent parseCompositionCompositionEventComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
6814    Composition.CompositionEventComponent res = new Composition.CompositionEventComponent();
6815    parseCompositionCompositionEventComponentProperties(json, owner, res);
6816    return res;
6817  }
6818
6819  protected void parseCompositionCompositionEventComponentProperties(JsonObject json, Composition owner, Composition.CompositionEventComponent res) throws IOException, FHIRFormatError {
6820    parseBackboneElementProperties(json, res);
6821    if (json.has("code")) {
6822      JsonArray array = json.getAsJsonArray("code");
6823      for (int i = 0; i < array.size(); i++) {
6824        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6825      }
6826    };
6827    if (json.has("period"))
6828      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
6829    if (json.has("detail")) {
6830      JsonArray array = json.getAsJsonArray("detail");
6831      for (int i = 0; i < array.size(); i++) {
6832        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
6833      }
6834    };
6835  }
6836
6837  protected Composition.SectionComponent parseCompositionSectionComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
6838    Composition.SectionComponent res = new Composition.SectionComponent();
6839    parseCompositionSectionComponentProperties(json, owner, res);
6840    return res;
6841  }
6842
6843  protected void parseCompositionSectionComponentProperties(JsonObject json, Composition owner, Composition.SectionComponent res) throws IOException, FHIRFormatError {
6844    parseBackboneElementProperties(json, res);
6845    if (json.has("title"))
6846      res.setTitleElement(parseString(json.get("title").getAsString()));
6847    if (json.has("_title"))
6848      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
6849    if (json.has("code"))
6850      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
6851    if (json.has("author")) {
6852      JsonArray array = json.getAsJsonArray("author");
6853      for (int i = 0; i < array.size(); i++) {
6854        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
6855      }
6856    };
6857    if (json.has("focus"))
6858      res.setFocus(parseReference(json.getAsJsonObject("focus")));
6859    if (json.has("text"))
6860      res.setText(parseNarrative(json.getAsJsonObject("text")));
6861    if (json.has("mode"))
6862      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Composition.SectionMode.NULL, new Composition.SectionModeEnumFactory()));
6863    if (json.has("_mode"))
6864      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
6865    if (json.has("orderedBy"))
6866      res.setOrderedBy(parseCodeableConcept(json.getAsJsonObject("orderedBy")));
6867    if (json.has("entry")) {
6868      JsonArray array = json.getAsJsonArray("entry");
6869      for (int i = 0; i < array.size(); i++) {
6870        res.getEntry().add(parseReference(array.get(i).getAsJsonObject()));
6871      }
6872    };
6873    if (json.has("emptyReason"))
6874      res.setEmptyReason(parseCodeableConcept(json.getAsJsonObject("emptyReason")));
6875    if (json.has("section")) {
6876      JsonArray array = json.getAsJsonArray("section");
6877      for (int i = 0; i < array.size(); i++) {
6878        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), owner));
6879      }
6880    };
6881  }
6882
6883  protected ConceptMap parseConceptMap(JsonObject json) throws IOException, FHIRFormatError {
6884    ConceptMap res = new ConceptMap();
6885    parseConceptMapProperties(json, res);
6886    return res;
6887  }
6888
6889  protected void parseConceptMapProperties(JsonObject json, ConceptMap res) throws IOException, FHIRFormatError {
6890    parseDomainResourceProperties(json, res);
6891    if (json.has("url"))
6892      res.setUrlElement(parseUri(json.get("url").getAsString()));
6893    if (json.has("_url"))
6894      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6895    if (json.has("identifier"))
6896      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6897    if (json.has("version"))
6898      res.setVersionElement(parseString(json.get("version").getAsString()));
6899    if (json.has("_version"))
6900      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
6901    if (json.has("name"))
6902      res.setNameElement(parseString(json.get("name").getAsString()));
6903    if (json.has("_name"))
6904      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6905    if (json.has("title"))
6906      res.setTitleElement(parseString(json.get("title").getAsString()));
6907    if (json.has("_title"))
6908      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
6909    if (json.has("status"))
6910      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
6911    if (json.has("_status"))
6912      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6913    if (json.has("experimental"))
6914      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
6915    if (json.has("_experimental"))
6916      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
6917    if (json.has("date"))
6918      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6919    if (json.has("_date"))
6920      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6921    if (json.has("publisher"))
6922      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6923    if (json.has("_publisher"))
6924      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
6925    if (json.has("contact")) {
6926      JsonArray array = json.getAsJsonArray("contact");
6927      for (int i = 0; i < array.size(); i++) {
6928        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
6929      }
6930    };
6931    if (json.has("description"))
6932      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
6933    if (json.has("_description"))
6934      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6935    if (json.has("useContext")) {
6936      JsonArray array = json.getAsJsonArray("useContext");
6937      for (int i = 0; i < array.size(); i++) {
6938        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
6939      }
6940    };
6941    if (json.has("jurisdiction")) {
6942      JsonArray array = json.getAsJsonArray("jurisdiction");
6943      for (int i = 0; i < array.size(); i++) {
6944        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6945      }
6946    };
6947    if (json.has("purpose"))
6948      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
6949    if (json.has("_purpose"))
6950      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
6951    if (json.has("copyright"))
6952      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
6953    if (json.has("_copyright"))
6954      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
6955    Type source = parseType("source", json);
6956    if (source != null)
6957      res.setSource(source);
6958    Type target = parseType("target", json);
6959    if (target != null)
6960      res.setTarget(target);
6961    if (json.has("group")) {
6962      JsonArray array = json.getAsJsonArray("group");
6963      for (int i = 0; i < array.size(); i++) {
6964        res.getGroup().add(parseConceptMapConceptMapGroupComponent(array.get(i).getAsJsonObject(), res));
6965      }
6966    };
6967  }
6968
6969  protected ConceptMap.ConceptMapGroupComponent parseConceptMapConceptMapGroupComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6970    ConceptMap.ConceptMapGroupComponent res = new ConceptMap.ConceptMapGroupComponent();
6971    parseConceptMapConceptMapGroupComponentProperties(json, owner, res);
6972    return res;
6973  }
6974
6975  protected void parseConceptMapConceptMapGroupComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.ConceptMapGroupComponent res) throws IOException, FHIRFormatError {
6976    parseBackboneElementProperties(json, res);
6977    if (json.has("source"))
6978      res.setSourceElement(parseUri(json.get("source").getAsString()));
6979    if (json.has("_source"))
6980      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
6981    if (json.has("sourceVersion"))
6982      res.setSourceVersionElement(parseString(json.get("sourceVersion").getAsString()));
6983    if (json.has("_sourceVersion"))
6984      parseElementProperties(json.getAsJsonObject("_sourceVersion"), res.getSourceVersionElement());
6985    if (json.has("target"))
6986      res.setTargetElement(parseUri(json.get("target").getAsString()));
6987    if (json.has("_target"))
6988      parseElementProperties(json.getAsJsonObject("_target"), res.getTargetElement());
6989    if (json.has("targetVersion"))
6990      res.setTargetVersionElement(parseString(json.get("targetVersion").getAsString()));
6991    if (json.has("_targetVersion"))
6992      parseElementProperties(json.getAsJsonObject("_targetVersion"), res.getTargetVersionElement());
6993    if (json.has("element")) {
6994      JsonArray array = json.getAsJsonArray("element");
6995      for (int i = 0; i < array.size(); i++) {
6996        res.getElement().add(parseConceptMapSourceElementComponent(array.get(i).getAsJsonObject(), owner));
6997      }
6998    };
6999    if (json.has("unmapped"))
7000      res.setUnmapped(parseConceptMapConceptMapGroupUnmappedComponent(json.getAsJsonObject("unmapped"), owner));
7001  }
7002
7003  protected ConceptMap.SourceElementComponent parseConceptMapSourceElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
7004    ConceptMap.SourceElementComponent res = new ConceptMap.SourceElementComponent();
7005    parseConceptMapSourceElementComponentProperties(json, owner, res);
7006    return res;
7007  }
7008
7009  protected void parseConceptMapSourceElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.SourceElementComponent res) throws IOException, FHIRFormatError {
7010    parseBackboneElementProperties(json, res);
7011    if (json.has("code"))
7012      res.setCodeElement(parseCode(json.get("code").getAsString()));
7013    if (json.has("_code"))
7014      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7015    if (json.has("display"))
7016      res.setDisplayElement(parseString(json.get("display").getAsString()));
7017    if (json.has("_display"))
7018      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
7019    if (json.has("target")) {
7020      JsonArray array = json.getAsJsonArray("target");
7021      for (int i = 0; i < array.size(); i++) {
7022        res.getTarget().add(parseConceptMapTargetElementComponent(array.get(i).getAsJsonObject(), owner));
7023      }
7024    };
7025  }
7026
7027  protected ConceptMap.TargetElementComponent parseConceptMapTargetElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
7028    ConceptMap.TargetElementComponent res = new ConceptMap.TargetElementComponent();
7029    parseConceptMapTargetElementComponentProperties(json, owner, res);
7030    return res;
7031  }
7032
7033  protected void parseConceptMapTargetElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.TargetElementComponent res) throws IOException, FHIRFormatError {
7034    parseBackboneElementProperties(json, res);
7035    if (json.has("code"))
7036      res.setCodeElement(parseCode(json.get("code").getAsString()));
7037    if (json.has("_code"))
7038      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7039    if (json.has("display"))
7040      res.setDisplayElement(parseString(json.get("display").getAsString()));
7041    if (json.has("_display"))
7042      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
7043    if (json.has("equivalence"))
7044      res.setEquivalenceElement(parseEnumeration(json.get("equivalence").getAsString(), Enumerations.ConceptMapEquivalence.NULL, new Enumerations.ConceptMapEquivalenceEnumFactory()));
7045    if (json.has("_equivalence"))
7046      parseElementProperties(json.getAsJsonObject("_equivalence"), res.getEquivalenceElement());
7047    if (json.has("comment"))
7048      res.setCommentElement(parseString(json.get("comment").getAsString()));
7049    if (json.has("_comment"))
7050      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
7051    if (json.has("dependsOn")) {
7052      JsonArray array = json.getAsJsonArray("dependsOn");
7053      for (int i = 0; i < array.size(); i++) {
7054        res.getDependsOn().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
7055      }
7056    };
7057    if (json.has("product")) {
7058      JsonArray array = json.getAsJsonArray("product");
7059      for (int i = 0; i < array.size(); i++) {
7060        res.getProduct().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
7061      }
7062    };
7063  }
7064
7065  protected ConceptMap.OtherElementComponent parseConceptMapOtherElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
7066    ConceptMap.OtherElementComponent res = new ConceptMap.OtherElementComponent();
7067    parseConceptMapOtherElementComponentProperties(json, owner, res);
7068    return res;
7069  }
7070
7071  protected void parseConceptMapOtherElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.OtherElementComponent res) throws IOException, FHIRFormatError {
7072    parseBackboneElementProperties(json, res);
7073    if (json.has("property"))
7074      res.setPropertyElement(parseUri(json.get("property").getAsString()));
7075    if (json.has("_property"))
7076      parseElementProperties(json.getAsJsonObject("_property"), res.getPropertyElement());
7077    if (json.has("system"))
7078      res.setSystemElement(parseCanonical(json.get("system").getAsString()));
7079    if (json.has("_system"))
7080      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
7081    if (json.has("value"))
7082      res.setValueElement(parseString(json.get("value").getAsString()));
7083    if (json.has("_value"))
7084      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
7085    if (json.has("display"))
7086      res.setDisplayElement(parseString(json.get("display").getAsString()));
7087    if (json.has("_display"))
7088      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
7089  }
7090
7091  protected ConceptMap.ConceptMapGroupUnmappedComponent parseConceptMapConceptMapGroupUnmappedComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
7092    ConceptMap.ConceptMapGroupUnmappedComponent res = new ConceptMap.ConceptMapGroupUnmappedComponent();
7093    parseConceptMapConceptMapGroupUnmappedComponentProperties(json, owner, res);
7094    return res;
7095  }
7096
7097  protected void parseConceptMapConceptMapGroupUnmappedComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.ConceptMapGroupUnmappedComponent res) throws IOException, FHIRFormatError {
7098    parseBackboneElementProperties(json, res);
7099    if (json.has("mode"))
7100      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ConceptMap.ConceptMapGroupUnmappedMode.NULL, new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory()));
7101    if (json.has("_mode"))
7102      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
7103    if (json.has("code"))
7104      res.setCodeElement(parseCode(json.get("code").getAsString()));
7105    if (json.has("_code"))
7106      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7107    if (json.has("display"))
7108      res.setDisplayElement(parseString(json.get("display").getAsString()));
7109    if (json.has("_display"))
7110      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
7111    if (json.has("url"))
7112      res.setUrlElement(parseCanonical(json.get("url").getAsString()));
7113    if (json.has("_url"))
7114      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
7115  }
7116
7117  protected Condition parseCondition(JsonObject json) throws IOException, FHIRFormatError {
7118    Condition res = new Condition();
7119    parseConditionProperties(json, res);
7120    return res;
7121  }
7122
7123  protected void parseConditionProperties(JsonObject json, Condition res) throws IOException, FHIRFormatError {
7124    parseDomainResourceProperties(json, res);
7125    if (json.has("identifier")) {
7126      JsonArray array = json.getAsJsonArray("identifier");
7127      for (int i = 0; i < array.size(); i++) {
7128        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7129      }
7130    };
7131    if (json.has("clinicalStatus"))
7132      res.setClinicalStatus(parseCodeableConcept(json.getAsJsonObject("clinicalStatus")));
7133    if (json.has("verificationStatus"))
7134      res.setVerificationStatus(parseCodeableConcept(json.getAsJsonObject("verificationStatus")));
7135    if (json.has("category")) {
7136      JsonArray array = json.getAsJsonArray("category");
7137      for (int i = 0; i < array.size(); i++) {
7138        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7139      }
7140    };
7141    if (json.has("severity"))
7142      res.setSeverity(parseCodeableConcept(json.getAsJsonObject("severity")));
7143    if (json.has("code"))
7144      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
7145    if (json.has("bodySite")) {
7146      JsonArray array = json.getAsJsonArray("bodySite");
7147      for (int i = 0; i < array.size(); i++) {
7148        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7149      }
7150    };
7151    if (json.has("subject"))
7152      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7153    if (json.has("encounter"))
7154      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
7155    Type onset = parseType("onset", json);
7156    if (onset != null)
7157      res.setOnset(onset);
7158    Type abatement = parseType("abatement", json);
7159    if (abatement != null)
7160      res.setAbatement(abatement);
7161    if (json.has("recordedDate"))
7162      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
7163    if (json.has("_recordedDate"))
7164      parseElementProperties(json.getAsJsonObject("_recordedDate"), res.getRecordedDateElement());
7165    if (json.has("recorder"))
7166      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
7167    if (json.has("asserter"))
7168      res.setAsserter(parseReference(json.getAsJsonObject("asserter")));
7169    if (json.has("stage")) {
7170      JsonArray array = json.getAsJsonArray("stage");
7171      for (int i = 0; i < array.size(); i++) {
7172        res.getStage().add(parseConditionConditionStageComponent(array.get(i).getAsJsonObject(), res));
7173      }
7174    };
7175    if (json.has("evidence")) {
7176      JsonArray array = json.getAsJsonArray("evidence");
7177      for (int i = 0; i < array.size(); i++) {
7178        res.getEvidence().add(parseConditionConditionEvidenceComponent(array.get(i).getAsJsonObject(), res));
7179      }
7180    };
7181    if (json.has("note")) {
7182      JsonArray array = json.getAsJsonArray("note");
7183      for (int i = 0; i < array.size(); i++) {
7184        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7185      }
7186    };
7187  }
7188
7189  protected Condition.ConditionStageComponent parseConditionConditionStageComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
7190    Condition.ConditionStageComponent res = new Condition.ConditionStageComponent();
7191    parseConditionConditionStageComponentProperties(json, owner, res);
7192    return res;
7193  }
7194
7195  protected void parseConditionConditionStageComponentProperties(JsonObject json, Condition owner, Condition.ConditionStageComponent res) throws IOException, FHIRFormatError {
7196    parseBackboneElementProperties(json, res);
7197    if (json.has("summary"))
7198      res.setSummary(parseCodeableConcept(json.getAsJsonObject("summary")));
7199    if (json.has("assessment")) {
7200      JsonArray array = json.getAsJsonArray("assessment");
7201      for (int i = 0; i < array.size(); i++) {
7202        res.getAssessment().add(parseReference(array.get(i).getAsJsonObject()));
7203      }
7204    };
7205    if (json.has("type"))
7206      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7207  }
7208
7209  protected Condition.ConditionEvidenceComponent parseConditionConditionEvidenceComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
7210    Condition.ConditionEvidenceComponent res = new Condition.ConditionEvidenceComponent();
7211    parseConditionConditionEvidenceComponentProperties(json, owner, res);
7212    return res;
7213  }
7214
7215  protected void parseConditionConditionEvidenceComponentProperties(JsonObject json, Condition owner, Condition.ConditionEvidenceComponent res) throws IOException, FHIRFormatError {
7216    parseBackboneElementProperties(json, res);
7217    if (json.has("code")) {
7218      JsonArray array = json.getAsJsonArray("code");
7219      for (int i = 0; i < array.size(); i++) {
7220        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7221      }
7222    };
7223    if (json.has("detail")) {
7224      JsonArray array = json.getAsJsonArray("detail");
7225      for (int i = 0; i < array.size(); i++) {
7226        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
7227      }
7228    };
7229  }
7230
7231  protected Consent parseConsent(JsonObject json) throws IOException, FHIRFormatError {
7232    Consent res = new Consent();
7233    parseConsentProperties(json, res);
7234    return res;
7235  }
7236
7237  protected void parseConsentProperties(JsonObject json, Consent res) throws IOException, FHIRFormatError {
7238    parseDomainResourceProperties(json, res);
7239    if (json.has("identifier")) {
7240      JsonArray array = json.getAsJsonArray("identifier");
7241      for (int i = 0; i < array.size(); i++) {
7242        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7243      }
7244    };
7245    if (json.has("status"))
7246      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Consent.ConsentState.NULL, new Consent.ConsentStateEnumFactory()));
7247    if (json.has("_status"))
7248      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7249    if (json.has("scope"))
7250      res.setScope(parseCodeableConcept(json.getAsJsonObject("scope")));
7251    if (json.has("category")) {
7252      JsonArray array = json.getAsJsonArray("category");
7253      for (int i = 0; i < array.size(); i++) {
7254        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7255      }
7256    };
7257    if (json.has("patient"))
7258      res.setPatient(parseReference(json.getAsJsonObject("patient")));
7259    if (json.has("dateTime"))
7260      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
7261    if (json.has("_dateTime"))
7262      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
7263    if (json.has("performer")) {
7264      JsonArray array = json.getAsJsonArray("performer");
7265      for (int i = 0; i < array.size(); i++) {
7266        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
7267      }
7268    };
7269    if (json.has("organization")) {
7270      JsonArray array = json.getAsJsonArray("organization");
7271      for (int i = 0; i < array.size(); i++) {
7272        res.getOrganization().add(parseReference(array.get(i).getAsJsonObject()));
7273      }
7274    };
7275    Type source = parseType("source", json);
7276    if (source != null)
7277      res.setSource(source);
7278    if (json.has("policy")) {
7279      JsonArray array = json.getAsJsonArray("policy");
7280      for (int i = 0; i < array.size(); i++) {
7281        res.getPolicy().add(parseConsentConsentPolicyComponent(array.get(i).getAsJsonObject(), res));
7282      }
7283    };
7284    if (json.has("policyRule"))
7285      res.setPolicyRule(parseCodeableConcept(json.getAsJsonObject("policyRule")));
7286    if (json.has("verification")) {
7287      JsonArray array = json.getAsJsonArray("verification");
7288      for (int i = 0; i < array.size(); i++) {
7289        res.getVerification().add(parseConsentConsentVerificationComponent(array.get(i).getAsJsonObject(), res));
7290      }
7291    };
7292    if (json.has("provision"))
7293      res.setProvision(parseConsentprovisionComponent(json.getAsJsonObject("provision"), res));
7294  }
7295
7296  protected Consent.ConsentPolicyComponent parseConsentConsentPolicyComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7297    Consent.ConsentPolicyComponent res = new Consent.ConsentPolicyComponent();
7298    parseConsentConsentPolicyComponentProperties(json, owner, res);
7299    return res;
7300  }
7301
7302  protected void parseConsentConsentPolicyComponentProperties(JsonObject json, Consent owner, Consent.ConsentPolicyComponent res) throws IOException, FHIRFormatError {
7303    parseBackboneElementProperties(json, res);
7304    if (json.has("authority"))
7305      res.setAuthorityElement(parseUri(json.get("authority").getAsString()));
7306    if (json.has("_authority"))
7307      parseElementProperties(json.getAsJsonObject("_authority"), res.getAuthorityElement());
7308    if (json.has("uri"))
7309      res.setUriElement(parseUri(json.get("uri").getAsString()));
7310    if (json.has("_uri"))
7311      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
7312  }
7313
7314  protected Consent.ConsentVerificationComponent parseConsentConsentVerificationComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7315    Consent.ConsentVerificationComponent res = new Consent.ConsentVerificationComponent();
7316    parseConsentConsentVerificationComponentProperties(json, owner, res);
7317    return res;
7318  }
7319
7320  protected void parseConsentConsentVerificationComponentProperties(JsonObject json, Consent owner, Consent.ConsentVerificationComponent res) throws IOException, FHIRFormatError {
7321    parseBackboneElementProperties(json, res);
7322    if (json.has("verified"))
7323      res.setVerifiedElement(parseBoolean(json.get("verified").getAsBoolean()));
7324    if (json.has("_verified"))
7325      parseElementProperties(json.getAsJsonObject("_verified"), res.getVerifiedElement());
7326    if (json.has("verifiedWith"))
7327      res.setVerifiedWith(parseReference(json.getAsJsonObject("verifiedWith")));
7328    if (json.has("verificationDate"))
7329      res.setVerificationDateElement(parseDateTime(json.get("verificationDate").getAsString()));
7330    if (json.has("_verificationDate"))
7331      parseElementProperties(json.getAsJsonObject("_verificationDate"), res.getVerificationDateElement());
7332  }
7333
7334  protected Consent.provisionComponent parseConsentprovisionComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7335    Consent.provisionComponent res = new Consent.provisionComponent();
7336    parseConsentprovisionComponentProperties(json, owner, res);
7337    return res;
7338  }
7339
7340  protected void parseConsentprovisionComponentProperties(JsonObject json, Consent owner, Consent.provisionComponent res) throws IOException, FHIRFormatError {
7341    parseBackboneElementProperties(json, res);
7342    if (json.has("type"))
7343      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Consent.ConsentProvisionType.NULL, new Consent.ConsentProvisionTypeEnumFactory()));
7344    if (json.has("_type"))
7345      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
7346    if (json.has("period"))
7347      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
7348    if (json.has("actor")) {
7349      JsonArray array = json.getAsJsonArray("actor");
7350      for (int i = 0; i < array.size(); i++) {
7351        res.getActor().add(parseConsentprovisionActorComponent(array.get(i).getAsJsonObject(), owner));
7352      }
7353    };
7354    if (json.has("action")) {
7355      JsonArray array = json.getAsJsonArray("action");
7356      for (int i = 0; i < array.size(); i++) {
7357        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7358      }
7359    };
7360    if (json.has("securityLabel")) {
7361      JsonArray array = json.getAsJsonArray("securityLabel");
7362      for (int i = 0; i < array.size(); i++) {
7363        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
7364      }
7365    };
7366    if (json.has("purpose")) {
7367      JsonArray array = json.getAsJsonArray("purpose");
7368      for (int i = 0; i < array.size(); i++) {
7369        res.getPurpose().add(parseCoding(array.get(i).getAsJsonObject()));
7370      }
7371    };
7372    if (json.has("class")) {
7373      JsonArray array = json.getAsJsonArray("class");
7374      for (int i = 0; i < array.size(); i++) {
7375        res.getClass_().add(parseCoding(array.get(i).getAsJsonObject()));
7376      }
7377    };
7378    if (json.has("code")) {
7379      JsonArray array = json.getAsJsonArray("code");
7380      for (int i = 0; i < array.size(); i++) {
7381        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7382      }
7383    };
7384    if (json.has("dataPeriod"))
7385      res.setDataPeriod(parsePeriod(json.getAsJsonObject("dataPeriod")));
7386    if (json.has("data")) {
7387      JsonArray array = json.getAsJsonArray("data");
7388      for (int i = 0; i < array.size(); i++) {
7389        res.getData().add(parseConsentprovisionDataComponent(array.get(i).getAsJsonObject(), owner));
7390      }
7391    };
7392    if (json.has("provision")) {
7393      JsonArray array = json.getAsJsonArray("provision");
7394      for (int i = 0; i < array.size(); i++) {
7395        res.getProvision().add(parseConsentprovisionComponent(array.get(i).getAsJsonObject(), owner));
7396      }
7397    };
7398  }
7399
7400  protected Consent.provisionActorComponent parseConsentprovisionActorComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7401    Consent.provisionActorComponent res = new Consent.provisionActorComponent();
7402    parseConsentprovisionActorComponentProperties(json, owner, res);
7403    return res;
7404  }
7405
7406  protected void parseConsentprovisionActorComponentProperties(JsonObject json, Consent owner, Consent.provisionActorComponent res) throws IOException, FHIRFormatError {
7407    parseBackboneElementProperties(json, res);
7408    if (json.has("role"))
7409      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
7410    if (json.has("reference"))
7411      res.setReference(parseReference(json.getAsJsonObject("reference")));
7412  }
7413
7414  protected Consent.provisionDataComponent parseConsentprovisionDataComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7415    Consent.provisionDataComponent res = new Consent.provisionDataComponent();
7416    parseConsentprovisionDataComponentProperties(json, owner, res);
7417    return res;
7418  }
7419
7420  protected void parseConsentprovisionDataComponentProperties(JsonObject json, Consent owner, Consent.provisionDataComponent res) throws IOException, FHIRFormatError {
7421    parseBackboneElementProperties(json, res);
7422    if (json.has("meaning"))
7423      res.setMeaningElement(parseEnumeration(json.get("meaning").getAsString(), Consent.ConsentDataMeaning.NULL, new Consent.ConsentDataMeaningEnumFactory()));
7424    if (json.has("_meaning"))
7425      parseElementProperties(json.getAsJsonObject("_meaning"), res.getMeaningElement());
7426    if (json.has("reference"))
7427      res.setReference(parseReference(json.getAsJsonObject("reference")));
7428  }
7429
7430  protected Contract parseContract(JsonObject json) throws IOException, FHIRFormatError {
7431    Contract res = new Contract();
7432    parseContractProperties(json, res);
7433    return res;
7434  }
7435
7436  protected void parseContractProperties(JsonObject json, Contract res) throws IOException, FHIRFormatError {
7437    parseDomainResourceProperties(json, res);
7438    if (json.has("identifier")) {
7439      JsonArray array = json.getAsJsonArray("identifier");
7440      for (int i = 0; i < array.size(); i++) {
7441        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7442      }
7443    };
7444    if (json.has("url"))
7445      res.setUrlElement(parseUri(json.get("url").getAsString()));
7446    if (json.has("_url"))
7447      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
7448    if (json.has("version"))
7449      res.setVersionElement(parseString(json.get("version").getAsString()));
7450    if (json.has("_version"))
7451      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
7452    if (json.has("status"))
7453      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Contract.ContractStatus.NULL, new Contract.ContractStatusEnumFactory()));
7454    if (json.has("_status"))
7455      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7456    if (json.has("legalState"))
7457      res.setLegalState(parseCodeableConcept(json.getAsJsonObject("legalState")));
7458    if (json.has("instantiatesCanonical"))
7459      res.setInstantiatesCanonical(parseReference(json.getAsJsonObject("instantiatesCanonical")));
7460    if (json.has("instantiatesUri"))
7461      res.setInstantiatesUriElement(parseUri(json.get("instantiatesUri").getAsString()));
7462    if (json.has("_instantiatesUri"))
7463      parseElementProperties(json.getAsJsonObject("_instantiatesUri"), res.getInstantiatesUriElement());
7464    if (json.has("contentDerivative"))
7465      res.setContentDerivative(parseCodeableConcept(json.getAsJsonObject("contentDerivative")));
7466    if (json.has("issued"))
7467      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
7468    if (json.has("_issued"))
7469      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
7470    if (json.has("applies"))
7471      res.setApplies(parsePeriod(json.getAsJsonObject("applies")));
7472    if (json.has("expirationType"))
7473      res.setExpirationType(parseCodeableConcept(json.getAsJsonObject("expirationType")));
7474    if (json.has("subject")) {
7475      JsonArray array = json.getAsJsonArray("subject");
7476      for (int i = 0; i < array.size(); i++) {
7477        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
7478      }
7479    };
7480    if (json.has("authority")) {
7481      JsonArray array = json.getAsJsonArray("authority");
7482      for (int i = 0; i < array.size(); i++) {
7483        res.getAuthority().add(parseReference(array.get(i).getAsJsonObject()));
7484      }
7485    };
7486    if (json.has("domain")) {
7487      JsonArray array = json.getAsJsonArray("domain");
7488      for (int i = 0; i < array.size(); i++) {
7489        res.getDomain().add(parseReference(array.get(i).getAsJsonObject()));
7490      }
7491    };
7492    if (json.has("site")) {
7493      JsonArray array = json.getAsJsonArray("site");
7494      for (int i = 0; i < array.size(); i++) {
7495        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
7496      }
7497    };
7498    if (json.has("name"))
7499      res.setNameElement(parseString(json.get("name").getAsString()));
7500    if (json.has("_name"))
7501      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7502    if (json.has("title"))
7503      res.setTitleElement(parseString(json.get("title").getAsString()));
7504    if (json.has("_title"))
7505      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
7506    if (json.has("subtitle"))
7507      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
7508    if (json.has("_subtitle"))
7509      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
7510    if (json.has("alias")) {
7511      JsonArray array = json.getAsJsonArray("alias");
7512      for (int i = 0; i < array.size(); i++) {
7513        res.getAlias().add(parseString(array.get(i).getAsString()));
7514      }
7515    };
7516    if (json.has("_alias")) {
7517      JsonArray array = json.getAsJsonArray("_alias");
7518      for (int i = 0; i < array.size(); i++) {
7519        if (i == res.getAlias().size())
7520          res.getAlias().add(parseString(null));
7521        if (array.get(i) instanceof JsonObject) 
7522          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
7523      }
7524    };
7525    if (json.has("author"))
7526      res.setAuthor(parseReference(json.getAsJsonObject("author")));
7527    if (json.has("scope"))
7528      res.setScope(parseCodeableConcept(json.getAsJsonObject("scope")));
7529    Type topic = parseType("topic", json);
7530    if (topic != null)
7531      res.setTopic(topic);
7532    if (json.has("type"))
7533      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7534    if (json.has("subType")) {
7535      JsonArray array = json.getAsJsonArray("subType");
7536      for (int i = 0; i < array.size(); i++) {
7537        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7538      }
7539    };
7540    if (json.has("contentDefinition"))
7541      res.setContentDefinition(parseContractContentDefinitionComponent(json.getAsJsonObject("contentDefinition"), res));
7542    if (json.has("term")) {
7543      JsonArray array = json.getAsJsonArray("term");
7544      for (int i = 0; i < array.size(); i++) {
7545        res.getTerm().add(parseContractTermComponent(array.get(i).getAsJsonObject(), res));
7546      }
7547    };
7548    if (json.has("supportingInfo")) {
7549      JsonArray array = json.getAsJsonArray("supportingInfo");
7550      for (int i = 0; i < array.size(); i++) {
7551        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
7552      }
7553    };
7554    if (json.has("relevantHistory")) {
7555      JsonArray array = json.getAsJsonArray("relevantHistory");
7556      for (int i = 0; i < array.size(); i++) {
7557        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
7558      }
7559    };
7560    if (json.has("signer")) {
7561      JsonArray array = json.getAsJsonArray("signer");
7562      for (int i = 0; i < array.size(); i++) {
7563        res.getSigner().add(parseContractSignatoryComponent(array.get(i).getAsJsonObject(), res));
7564      }
7565    };
7566    if (json.has("friendly")) {
7567      JsonArray array = json.getAsJsonArray("friendly");
7568      for (int i = 0; i < array.size(); i++) {
7569        res.getFriendly().add(parseContractFriendlyLanguageComponent(array.get(i).getAsJsonObject(), res));
7570      }
7571    };
7572    if (json.has("legal")) {
7573      JsonArray array = json.getAsJsonArray("legal");
7574      for (int i = 0; i < array.size(); i++) {
7575        res.getLegal().add(parseContractLegalLanguageComponent(array.get(i).getAsJsonObject(), res));
7576      }
7577    };
7578    if (json.has("rule")) {
7579      JsonArray array = json.getAsJsonArray("rule");
7580      for (int i = 0; i < array.size(); i++) {
7581        res.getRule().add(parseContractComputableLanguageComponent(array.get(i).getAsJsonObject(), res));
7582      }
7583    };
7584    Type legallyBinding = parseType("legallyBinding", json);
7585    if (legallyBinding != null)
7586      res.setLegallyBinding(legallyBinding);
7587  }
7588
7589  protected Contract.ContentDefinitionComponent parseContractContentDefinitionComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7590    Contract.ContentDefinitionComponent res = new Contract.ContentDefinitionComponent();
7591    parseContractContentDefinitionComponentProperties(json, owner, res);
7592    return res;
7593  }
7594
7595  protected void parseContractContentDefinitionComponentProperties(JsonObject json, Contract owner, Contract.ContentDefinitionComponent res) throws IOException, FHIRFormatError {
7596    parseBackboneElementProperties(json, res);
7597    if (json.has("type"))
7598      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7599    if (json.has("subType"))
7600      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
7601    if (json.has("publisher"))
7602      res.setPublisher(parseReference(json.getAsJsonObject("publisher")));
7603    if (json.has("publicationDate"))
7604      res.setPublicationDateElement(parseDateTime(json.get("publicationDate").getAsString()));
7605    if (json.has("_publicationDate"))
7606      parseElementProperties(json.getAsJsonObject("_publicationDate"), res.getPublicationDateElement());
7607    if (json.has("publicationStatus"))
7608      res.setPublicationStatusElement(parseEnumeration(json.get("publicationStatus").getAsString(), Contract.ContractPublicationStatus.NULL, new Contract.ContractPublicationStatusEnumFactory()));
7609    if (json.has("_publicationStatus"))
7610      parseElementProperties(json.getAsJsonObject("_publicationStatus"), res.getPublicationStatusElement());
7611    if (json.has("copyright"))
7612      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
7613    if (json.has("_copyright"))
7614      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
7615  }
7616
7617  protected Contract.TermComponent parseContractTermComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7618    Contract.TermComponent res = new Contract.TermComponent();
7619    parseContractTermComponentProperties(json, owner, res);
7620    return res;
7621  }
7622
7623  protected void parseContractTermComponentProperties(JsonObject json, Contract owner, Contract.TermComponent res) throws IOException, FHIRFormatError {
7624    parseBackboneElementProperties(json, res);
7625    if (json.has("identifier"))
7626      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
7627    if (json.has("issued"))
7628      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
7629    if (json.has("_issued"))
7630      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
7631    if (json.has("applies"))
7632      res.setApplies(parsePeriod(json.getAsJsonObject("applies")));
7633    Type topic = parseType("topic", json);
7634    if (topic != null)
7635      res.setTopic(topic);
7636    if (json.has("type"))
7637      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7638    if (json.has("subType"))
7639      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
7640    if (json.has("text"))
7641      res.setTextElement(parseString(json.get("text").getAsString()));
7642    if (json.has("_text"))
7643      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
7644    if (json.has("securityLabel")) {
7645      JsonArray array = json.getAsJsonArray("securityLabel");
7646      for (int i = 0; i < array.size(); i++) {
7647        res.getSecurityLabel().add(parseContractSecurityLabelComponent(array.get(i).getAsJsonObject(), owner));
7648      }
7649    };
7650    if (json.has("offer"))
7651      res.setOffer(parseContractContractOfferComponent(json.getAsJsonObject("offer"), owner));
7652    if (json.has("asset")) {
7653      JsonArray array = json.getAsJsonArray("asset");
7654      for (int i = 0; i < array.size(); i++) {
7655        res.getAsset().add(parseContractContractAssetComponent(array.get(i).getAsJsonObject(), owner));
7656      }
7657    };
7658    if (json.has("action")) {
7659      JsonArray array = json.getAsJsonArray("action");
7660      for (int i = 0; i < array.size(); i++) {
7661        res.getAction().add(parseContractActionComponent(array.get(i).getAsJsonObject(), owner));
7662      }
7663    };
7664    if (json.has("group")) {
7665      JsonArray array = json.getAsJsonArray("group");
7666      for (int i = 0; i < array.size(); i++) {
7667        res.getGroup().add(parseContractTermComponent(array.get(i).getAsJsonObject(), owner));
7668      }
7669    };
7670  }
7671
7672  protected Contract.SecurityLabelComponent parseContractSecurityLabelComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7673    Contract.SecurityLabelComponent res = new Contract.SecurityLabelComponent();
7674    parseContractSecurityLabelComponentProperties(json, owner, res);
7675    return res;
7676  }
7677
7678  protected void parseContractSecurityLabelComponentProperties(JsonObject json, Contract owner, Contract.SecurityLabelComponent res) throws IOException, FHIRFormatError {
7679    parseBackboneElementProperties(json, res);
7680    if (json.has("number")) {
7681      JsonArray array = json.getAsJsonArray("number");
7682      for (int i = 0; i < array.size(); i++) {
7683        res.getNumber().add(parseUnsignedInt(array.get(i).getAsString()));
7684      }
7685    };
7686    if (json.has("_number")) {
7687      JsonArray array = json.getAsJsonArray("_number");
7688      for (int i = 0; i < array.size(); i++) {
7689        if (i == res.getNumber().size())
7690          res.getNumber().add(parseUnsignedInt(null));
7691        if (array.get(i) instanceof JsonObject) 
7692          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumber().get(i));
7693      }
7694    };
7695    if (json.has("classification"))
7696      res.setClassification(parseCoding(json.getAsJsonObject("classification")));
7697    if (json.has("category")) {
7698      JsonArray array = json.getAsJsonArray("category");
7699      for (int i = 0; i < array.size(); i++) {
7700        res.getCategory().add(parseCoding(array.get(i).getAsJsonObject()));
7701      }
7702    };
7703    if (json.has("control")) {
7704      JsonArray array = json.getAsJsonArray("control");
7705      for (int i = 0; i < array.size(); i++) {
7706        res.getControl().add(parseCoding(array.get(i).getAsJsonObject()));
7707      }
7708    };
7709  }
7710
7711  protected Contract.ContractOfferComponent parseContractContractOfferComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7712    Contract.ContractOfferComponent res = new Contract.ContractOfferComponent();
7713    parseContractContractOfferComponentProperties(json, owner, res);
7714    return res;
7715  }
7716
7717  protected void parseContractContractOfferComponentProperties(JsonObject json, Contract owner, Contract.ContractOfferComponent res) throws IOException, FHIRFormatError {
7718    parseBackboneElementProperties(json, res);
7719    if (json.has("identifier")) {
7720      JsonArray array = json.getAsJsonArray("identifier");
7721      for (int i = 0; i < array.size(); i++) {
7722        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7723      }
7724    };
7725    if (json.has("party")) {
7726      JsonArray array = json.getAsJsonArray("party");
7727      for (int i = 0; i < array.size(); i++) {
7728        res.getParty().add(parseContractContractPartyComponent(array.get(i).getAsJsonObject(), owner));
7729      }
7730    };
7731    if (json.has("topic"))
7732      res.setTopic(parseReference(json.getAsJsonObject("topic")));
7733    if (json.has("type"))
7734      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7735    if (json.has("decision"))
7736      res.setDecision(parseCodeableConcept(json.getAsJsonObject("decision")));
7737    if (json.has("decisionMode")) {
7738      JsonArray array = json.getAsJsonArray("decisionMode");
7739      for (int i = 0; i < array.size(); i++) {
7740        res.getDecisionMode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7741      }
7742    };
7743    if (json.has("answer")) {
7744      JsonArray array = json.getAsJsonArray("answer");
7745      for (int i = 0; i < array.size(); i++) {
7746        res.getAnswer().add(parseContractAnswerComponent(array.get(i).getAsJsonObject(), owner));
7747      }
7748    };
7749    if (json.has("text"))
7750      res.setTextElement(parseString(json.get("text").getAsString()));
7751    if (json.has("_text"))
7752      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
7753    if (json.has("linkId")) {
7754      JsonArray array = json.getAsJsonArray("linkId");
7755      for (int i = 0; i < array.size(); i++) {
7756        res.getLinkId().add(parseString(array.get(i).getAsString()));
7757      }
7758    };
7759    if (json.has("_linkId")) {
7760      JsonArray array = json.getAsJsonArray("_linkId");
7761      for (int i = 0; i < array.size(); i++) {
7762        if (i == res.getLinkId().size())
7763          res.getLinkId().add(parseString(null));
7764        if (array.get(i) instanceof JsonObject) 
7765          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
7766      }
7767    };
7768    if (json.has("securityLabelNumber")) {
7769      JsonArray array = json.getAsJsonArray("securityLabelNumber");
7770      for (int i = 0; i < array.size(); i++) {
7771        res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
7772      }
7773    };
7774    if (json.has("_securityLabelNumber")) {
7775      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
7776      for (int i = 0; i < array.size(); i++) {
7777        if (i == res.getSecurityLabelNumber().size())
7778          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
7779        if (array.get(i) instanceof JsonObject) 
7780          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
7781      }
7782    };
7783  }
7784
7785  protected Contract.ContractPartyComponent parseContractContractPartyComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7786    Contract.ContractPartyComponent res = new Contract.ContractPartyComponent();
7787    parseContractContractPartyComponentProperties(json, owner, res);
7788    return res;
7789  }
7790
7791  protected void parseContractContractPartyComponentProperties(JsonObject json, Contract owner, Contract.ContractPartyComponent res) throws IOException, FHIRFormatError {
7792    parseBackboneElementProperties(json, res);
7793    if (json.has("reference")) {
7794      JsonArray array = json.getAsJsonArray("reference");
7795      for (int i = 0; i < array.size(); i++) {
7796        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
7797      }
7798    };
7799    if (json.has("role"))
7800      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
7801  }
7802
7803  protected Contract.AnswerComponent parseContractAnswerComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7804    Contract.AnswerComponent res = new Contract.AnswerComponent();
7805    parseContractAnswerComponentProperties(json, owner, res);
7806    return res;
7807  }
7808
7809  protected void parseContractAnswerComponentProperties(JsonObject json, Contract owner, Contract.AnswerComponent res) throws IOException, FHIRFormatError {
7810    parseBackboneElementProperties(json, res);
7811    Type value = parseType("value", json);
7812    if (value != null)
7813      res.setValue(value);
7814  }
7815
7816  protected Contract.ContractAssetComponent parseContractContractAssetComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7817    Contract.ContractAssetComponent res = new Contract.ContractAssetComponent();
7818    parseContractContractAssetComponentProperties(json, owner, res);
7819    return res;
7820  }
7821
7822  protected void parseContractContractAssetComponentProperties(JsonObject json, Contract owner, Contract.ContractAssetComponent res) throws IOException, FHIRFormatError {
7823    parseBackboneElementProperties(json, res);
7824    if (json.has("scope"))
7825      res.setScope(parseCodeableConcept(json.getAsJsonObject("scope")));
7826    if (json.has("type")) {
7827      JsonArray array = json.getAsJsonArray("type");
7828      for (int i = 0; i < array.size(); i++) {
7829        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7830      }
7831    };
7832    if (json.has("typeReference")) {
7833      JsonArray array = json.getAsJsonArray("typeReference");
7834      for (int i = 0; i < array.size(); i++) {
7835        res.getTypeReference().add(parseReference(array.get(i).getAsJsonObject()));
7836      }
7837    };
7838    if (json.has("subtype")) {
7839      JsonArray array = json.getAsJsonArray("subtype");
7840      for (int i = 0; i < array.size(); i++) {
7841        res.getSubtype().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7842      }
7843    };
7844    if (json.has("relationship"))
7845      res.setRelationship(parseCoding(json.getAsJsonObject("relationship")));
7846    if (json.has("context")) {
7847      JsonArray array = json.getAsJsonArray("context");
7848      for (int i = 0; i < array.size(); i++) {
7849        res.getContext().add(parseContractAssetContextComponent(array.get(i).getAsJsonObject(), owner));
7850      }
7851    };
7852    if (json.has("condition"))
7853      res.setConditionElement(parseString(json.get("condition").getAsString()));
7854    if (json.has("_condition"))
7855      parseElementProperties(json.getAsJsonObject("_condition"), res.getConditionElement());
7856    if (json.has("periodType")) {
7857      JsonArray array = json.getAsJsonArray("periodType");
7858      for (int i = 0; i < array.size(); i++) {
7859        res.getPeriodType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7860      }
7861    };
7862    if (json.has("period")) {
7863      JsonArray array = json.getAsJsonArray("period");
7864      for (int i = 0; i < array.size(); i++) {
7865        res.getPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
7866      }
7867    };
7868    if (json.has("usePeriod")) {
7869      JsonArray array = json.getAsJsonArray("usePeriod");
7870      for (int i = 0; i < array.size(); i++) {
7871        res.getUsePeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
7872      }
7873    };
7874    if (json.has("text"))
7875      res.setTextElement(parseString(json.get("text").getAsString()));
7876    if (json.has("_text"))
7877      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
7878    if (json.has("linkId")) {
7879      JsonArray array = json.getAsJsonArray("linkId");
7880      for (int i = 0; i < array.size(); i++) {
7881        res.getLinkId().add(parseString(array.get(i).getAsString()));
7882      }
7883    };
7884    if (json.has("_linkId")) {
7885      JsonArray array = json.getAsJsonArray("_linkId");
7886      for (int i = 0; i < array.size(); i++) {
7887        if (i == res.getLinkId().size())
7888          res.getLinkId().add(parseString(null));
7889        if (array.get(i) instanceof JsonObject) 
7890          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
7891      }
7892    };
7893    if (json.has("answer")) {
7894      JsonArray array = json.getAsJsonArray("answer");
7895      for (int i = 0; i < array.size(); i++) {
7896        res.getAnswer().add(parseContractAnswerComponent(array.get(i).getAsJsonObject(), owner));
7897      }
7898    };
7899    if (json.has("securityLabelNumber")) {
7900      JsonArray array = json.getAsJsonArray("securityLabelNumber");
7901      for (int i = 0; i < array.size(); i++) {
7902        res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
7903      }
7904    };
7905    if (json.has("_securityLabelNumber")) {
7906      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
7907      for (int i = 0; i < array.size(); i++) {
7908        if (i == res.getSecurityLabelNumber().size())
7909          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
7910        if (array.get(i) instanceof JsonObject) 
7911          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
7912      }
7913    };
7914    if (json.has("valuedItem")) {
7915      JsonArray array = json.getAsJsonArray("valuedItem");
7916      for (int i = 0; i < array.size(); i++) {
7917        res.getValuedItem().add(parseContractValuedItemComponent(array.get(i).getAsJsonObject(), owner));
7918      }
7919    };
7920  }
7921
7922  protected Contract.AssetContextComponent parseContractAssetContextComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7923    Contract.AssetContextComponent res = new Contract.AssetContextComponent();
7924    parseContractAssetContextComponentProperties(json, owner, res);
7925    return res;
7926  }
7927
7928  protected void parseContractAssetContextComponentProperties(JsonObject json, Contract owner, Contract.AssetContextComponent res) throws IOException, FHIRFormatError {
7929    parseBackboneElementProperties(json, res);
7930    if (json.has("reference"))
7931      res.setReference(parseReference(json.getAsJsonObject("reference")));
7932    if (json.has("code")) {
7933      JsonArray array = json.getAsJsonArray("code");
7934      for (int i = 0; i < array.size(); i++) {
7935        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7936      }
7937    };
7938    if (json.has("text"))
7939      res.setTextElement(parseString(json.get("text").getAsString()));
7940    if (json.has("_text"))
7941      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
7942  }
7943
7944  protected Contract.ValuedItemComponent parseContractValuedItemComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7945    Contract.ValuedItemComponent res = new Contract.ValuedItemComponent();
7946    parseContractValuedItemComponentProperties(json, owner, res);
7947    return res;
7948  }
7949
7950  protected void parseContractValuedItemComponentProperties(JsonObject json, Contract owner, Contract.ValuedItemComponent res) throws IOException, FHIRFormatError {
7951    parseBackboneElementProperties(json, res);
7952    Type entity = parseType("entity", json);
7953    if (entity != null)
7954      res.setEntity(entity);
7955    if (json.has("identifier"))
7956      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
7957    if (json.has("effectiveTime"))
7958      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
7959    if (json.has("_effectiveTime"))
7960      parseElementProperties(json.getAsJsonObject("_effectiveTime"), res.getEffectiveTimeElement());
7961    if (json.has("quantity"))
7962      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
7963    if (json.has("unitPrice"))
7964      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
7965    if (json.has("factor"))
7966      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
7967    if (json.has("_factor"))
7968      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
7969    if (json.has("points"))
7970      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
7971    if (json.has("_points"))
7972      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
7973    if (json.has("net"))
7974      res.setNet(parseMoney(json.getAsJsonObject("net")));
7975    if (json.has("payment"))
7976      res.setPaymentElement(parseString(json.get("payment").getAsString()));
7977    if (json.has("_payment"))
7978      parseElementProperties(json.getAsJsonObject("_payment"), res.getPaymentElement());
7979    if (json.has("paymentDate"))
7980      res.setPaymentDateElement(parseDateTime(json.get("paymentDate").getAsString()));
7981    if (json.has("_paymentDate"))
7982      parseElementProperties(json.getAsJsonObject("_paymentDate"), res.getPaymentDateElement());
7983    if (json.has("responsible"))
7984      res.setResponsible(parseReference(json.getAsJsonObject("responsible")));
7985    if (json.has("recipient"))
7986      res.setRecipient(parseReference(json.getAsJsonObject("recipient")));
7987    if (json.has("linkId")) {
7988      JsonArray array = json.getAsJsonArray("linkId");
7989      for (int i = 0; i < array.size(); i++) {
7990        res.getLinkId().add(parseString(array.get(i).getAsString()));
7991      }
7992    };
7993    if (json.has("_linkId")) {
7994      JsonArray array = json.getAsJsonArray("_linkId");
7995      for (int i = 0; i < array.size(); i++) {
7996        if (i == res.getLinkId().size())
7997          res.getLinkId().add(parseString(null));
7998        if (array.get(i) instanceof JsonObject) 
7999          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
8000      }
8001    };
8002    if (json.has("securityLabelNumber")) {
8003      JsonArray array = json.getAsJsonArray("securityLabelNumber");
8004      for (int i = 0; i < array.size(); i++) {
8005        res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
8006      }
8007    };
8008    if (json.has("_securityLabelNumber")) {
8009      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
8010      for (int i = 0; i < array.size(); i++) {
8011        if (i == res.getSecurityLabelNumber().size())
8012          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
8013        if (array.get(i) instanceof JsonObject) 
8014          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
8015      }
8016    };
8017  }
8018
8019  protected Contract.ActionComponent parseContractActionComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8020    Contract.ActionComponent res = new Contract.ActionComponent();
8021    parseContractActionComponentProperties(json, owner, res);
8022    return res;
8023  }
8024
8025  protected void parseContractActionComponentProperties(JsonObject json, Contract owner, Contract.ActionComponent res) throws IOException, FHIRFormatError {
8026    parseBackboneElementProperties(json, res);
8027    if (json.has("doNotPerform"))
8028      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
8029    if (json.has("_doNotPerform"))
8030      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
8031    if (json.has("type"))
8032      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8033    if (json.has("subject")) {
8034      JsonArray array = json.getAsJsonArray("subject");
8035      for (int i = 0; i < array.size(); i++) {
8036        res.getSubject().add(parseContractActionSubjectComponent(array.get(i).getAsJsonObject(), owner));
8037      }
8038    };
8039    if (json.has("intent"))
8040      res.setIntent(parseCodeableConcept(json.getAsJsonObject("intent")));
8041    if (json.has("linkId")) {
8042      JsonArray array = json.getAsJsonArray("linkId");
8043      for (int i = 0; i < array.size(); i++) {
8044        res.getLinkId().add(parseString(array.get(i).getAsString()));
8045      }
8046    };
8047    if (json.has("_linkId")) {
8048      JsonArray array = json.getAsJsonArray("_linkId");
8049      for (int i = 0; i < array.size(); i++) {
8050        if (i == res.getLinkId().size())
8051          res.getLinkId().add(parseString(null));
8052        if (array.get(i) instanceof JsonObject) 
8053          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
8054      }
8055    };
8056    if (json.has("status"))
8057      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
8058    if (json.has("context"))
8059      res.setContext(parseReference(json.getAsJsonObject("context")));
8060    if (json.has("contextLinkId")) {
8061      JsonArray array = json.getAsJsonArray("contextLinkId");
8062      for (int i = 0; i < array.size(); i++) {
8063        res.getContextLinkId().add(parseString(array.get(i).getAsString()));
8064      }
8065    };
8066    if (json.has("_contextLinkId")) {
8067      JsonArray array = json.getAsJsonArray("_contextLinkId");
8068      for (int i = 0; i < array.size(); i++) {
8069        if (i == res.getContextLinkId().size())
8070          res.getContextLinkId().add(parseString(null));
8071        if (array.get(i) instanceof JsonObject) 
8072          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextLinkId().get(i));
8073      }
8074    };
8075    Type occurrence = parseType("occurrence", json);
8076    if (occurrence != null)
8077      res.setOccurrence(occurrence);
8078    if (json.has("requester")) {
8079      JsonArray array = json.getAsJsonArray("requester");
8080      for (int i = 0; i < array.size(); i++) {
8081        res.getRequester().add(parseReference(array.get(i).getAsJsonObject()));
8082      }
8083    };
8084    if (json.has("requesterLinkId")) {
8085      JsonArray array = json.getAsJsonArray("requesterLinkId");
8086      for (int i = 0; i < array.size(); i++) {
8087        res.getRequesterLinkId().add(parseString(array.get(i).getAsString()));
8088      }
8089    };
8090    if (json.has("_requesterLinkId")) {
8091      JsonArray array = json.getAsJsonArray("_requesterLinkId");
8092      for (int i = 0; i < array.size(); i++) {
8093        if (i == res.getRequesterLinkId().size())
8094          res.getRequesterLinkId().add(parseString(null));
8095        if (array.get(i) instanceof JsonObject) 
8096          parseElementProperties(array.get(i).getAsJsonObject(), res.getRequesterLinkId().get(i));
8097      }
8098    };
8099    if (json.has("performerType")) {
8100      JsonArray array = json.getAsJsonArray("performerType");
8101      for (int i = 0; i < array.size(); i++) {
8102        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8103      }
8104    };
8105    if (json.has("performerRole"))
8106      res.setPerformerRole(parseCodeableConcept(json.getAsJsonObject("performerRole")));
8107    if (json.has("performer"))
8108      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
8109    if (json.has("performerLinkId")) {
8110      JsonArray array = json.getAsJsonArray("performerLinkId");
8111      for (int i = 0; i < array.size(); i++) {
8112        res.getPerformerLinkId().add(parseString(array.get(i).getAsString()));
8113      }
8114    };
8115    if (json.has("_performerLinkId")) {
8116      JsonArray array = json.getAsJsonArray("_performerLinkId");
8117      for (int i = 0; i < array.size(); i++) {
8118        if (i == res.getPerformerLinkId().size())
8119          res.getPerformerLinkId().add(parseString(null));
8120        if (array.get(i) instanceof JsonObject) 
8121          parseElementProperties(array.get(i).getAsJsonObject(), res.getPerformerLinkId().get(i));
8122      }
8123    };
8124    if (json.has("reasonCode")) {
8125      JsonArray array = json.getAsJsonArray("reasonCode");
8126      for (int i = 0; i < array.size(); i++) {
8127        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8128      }
8129    };
8130    if (json.has("reasonReference")) {
8131      JsonArray array = json.getAsJsonArray("reasonReference");
8132      for (int i = 0; i < array.size(); i++) {
8133        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
8134      }
8135    };
8136    if (json.has("reason")) {
8137      JsonArray array = json.getAsJsonArray("reason");
8138      for (int i = 0; i < array.size(); i++) {
8139        res.getReason().add(parseString(array.get(i).getAsString()));
8140      }
8141    };
8142    if (json.has("_reason")) {
8143      JsonArray array = json.getAsJsonArray("_reason");
8144      for (int i = 0; i < array.size(); i++) {
8145        if (i == res.getReason().size())
8146          res.getReason().add(parseString(null));
8147        if (array.get(i) instanceof JsonObject) 
8148          parseElementProperties(array.get(i).getAsJsonObject(), res.getReason().get(i));
8149      }
8150    };
8151    if (json.has("reasonLinkId")) {
8152      JsonArray array = json.getAsJsonArray("reasonLinkId");
8153      for (int i = 0; i < array.size(); i++) {
8154        res.getReasonLinkId().add(parseString(array.get(i).getAsString()));
8155      }
8156    };
8157    if (json.has("_reasonLinkId")) {
8158      JsonArray array = json.getAsJsonArray("_reasonLinkId");
8159      for (int i = 0; i < array.size(); i++) {
8160        if (i == res.getReasonLinkId().size())
8161          res.getReasonLinkId().add(parseString(null));
8162        if (array.get(i) instanceof JsonObject) 
8163          parseElementProperties(array.get(i).getAsJsonObject(), res.getReasonLinkId().get(i));
8164      }
8165    };
8166    if (json.has("note")) {
8167      JsonArray array = json.getAsJsonArray("note");
8168      for (int i = 0; i < array.size(); i++) {
8169        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
8170      }
8171    };
8172    if (json.has("securityLabelNumber")) {
8173      JsonArray array = json.getAsJsonArray("securityLabelNumber");
8174      for (int i = 0; i < array.size(); i++) {
8175        res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
8176      }
8177    };
8178    if (json.has("_securityLabelNumber")) {
8179      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
8180      for (int i = 0; i < array.size(); i++) {
8181        if (i == res.getSecurityLabelNumber().size())
8182          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
8183        if (array.get(i) instanceof JsonObject) 
8184          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
8185      }
8186    };
8187  }
8188
8189  protected Contract.ActionSubjectComponent parseContractActionSubjectComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8190    Contract.ActionSubjectComponent res = new Contract.ActionSubjectComponent();
8191    parseContractActionSubjectComponentProperties(json, owner, res);
8192    return res;
8193  }
8194
8195  protected void parseContractActionSubjectComponentProperties(JsonObject json, Contract owner, Contract.ActionSubjectComponent res) throws IOException, FHIRFormatError {
8196    parseBackboneElementProperties(json, res);
8197    if (json.has("reference")) {
8198      JsonArray array = json.getAsJsonArray("reference");
8199      for (int i = 0; i < array.size(); i++) {
8200        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
8201      }
8202    };
8203    if (json.has("role"))
8204      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
8205  }
8206
8207  protected Contract.SignatoryComponent parseContractSignatoryComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8208    Contract.SignatoryComponent res = new Contract.SignatoryComponent();
8209    parseContractSignatoryComponentProperties(json, owner, res);
8210    return res;
8211  }
8212
8213  protected void parseContractSignatoryComponentProperties(JsonObject json, Contract owner, Contract.SignatoryComponent res) throws IOException, FHIRFormatError {
8214    parseBackboneElementProperties(json, res);
8215    if (json.has("type"))
8216      res.setType(parseCoding(json.getAsJsonObject("type")));
8217    if (json.has("party"))
8218      res.setParty(parseReference(json.getAsJsonObject("party")));
8219    if (json.has("signature")) {
8220      JsonArray array = json.getAsJsonArray("signature");
8221      for (int i = 0; i < array.size(); i++) {
8222        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
8223      }
8224    };
8225  }
8226
8227  protected Contract.FriendlyLanguageComponent parseContractFriendlyLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8228    Contract.FriendlyLanguageComponent res = new Contract.FriendlyLanguageComponent();
8229    parseContractFriendlyLanguageComponentProperties(json, owner, res);
8230    return res;
8231  }
8232
8233  protected void parseContractFriendlyLanguageComponentProperties(JsonObject json, Contract owner, Contract.FriendlyLanguageComponent res) throws IOException, FHIRFormatError {
8234    parseBackboneElementProperties(json, res);
8235    Type content = parseType("content", json);
8236    if (content != null)
8237      res.setContent(content);
8238  }
8239
8240  protected Contract.LegalLanguageComponent parseContractLegalLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8241    Contract.LegalLanguageComponent res = new Contract.LegalLanguageComponent();
8242    parseContractLegalLanguageComponentProperties(json, owner, res);
8243    return res;
8244  }
8245
8246  protected void parseContractLegalLanguageComponentProperties(JsonObject json, Contract owner, Contract.LegalLanguageComponent res) throws IOException, FHIRFormatError {
8247    parseBackboneElementProperties(json, res);
8248    Type content = parseType("content", json);
8249    if (content != null)
8250      res.setContent(content);
8251  }
8252
8253  protected Contract.ComputableLanguageComponent parseContractComputableLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8254    Contract.ComputableLanguageComponent res = new Contract.ComputableLanguageComponent();
8255    parseContractComputableLanguageComponentProperties(json, owner, res);
8256    return res;
8257  }
8258
8259  protected void parseContractComputableLanguageComponentProperties(JsonObject json, Contract owner, Contract.ComputableLanguageComponent res) throws IOException, FHIRFormatError {
8260    parseBackboneElementProperties(json, res);
8261    Type content = parseType("content", json);
8262    if (content != null)
8263      res.setContent(content);
8264  }
8265
8266  protected Coverage parseCoverage(JsonObject json) throws IOException, FHIRFormatError {
8267    Coverage res = new Coverage();
8268    parseCoverageProperties(json, res);
8269    return res;
8270  }
8271
8272  protected void parseCoverageProperties(JsonObject json, Coverage res) throws IOException, FHIRFormatError {
8273    parseDomainResourceProperties(json, res);
8274    if (json.has("identifier")) {
8275      JsonArray array = json.getAsJsonArray("identifier");
8276      for (int i = 0; i < array.size(); i++) {
8277        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8278      }
8279    };
8280    if (json.has("status"))
8281      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Coverage.CoverageStatus.NULL, new Coverage.CoverageStatusEnumFactory()));
8282    if (json.has("_status"))
8283      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8284    if (json.has("type"))
8285      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8286    if (json.has("policyHolder"))
8287      res.setPolicyHolder(parseReference(json.getAsJsonObject("policyHolder")));
8288    if (json.has("subscriber"))
8289      res.setSubscriber(parseReference(json.getAsJsonObject("subscriber")));
8290    if (json.has("subscriberId"))
8291      res.setSubscriberIdElement(parseString(json.get("subscriberId").getAsString()));
8292    if (json.has("_subscriberId"))
8293      parseElementProperties(json.getAsJsonObject("_subscriberId"), res.getSubscriberIdElement());
8294    if (json.has("beneficiary"))
8295      res.setBeneficiary(parseReference(json.getAsJsonObject("beneficiary")));
8296    if (json.has("dependent"))
8297      res.setDependentElement(parseString(json.get("dependent").getAsString()));
8298    if (json.has("_dependent"))
8299      parseElementProperties(json.getAsJsonObject("_dependent"), res.getDependentElement());
8300    if (json.has("relationship"))
8301      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
8302    if (json.has("period"))
8303      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8304    if (json.has("payor")) {
8305      JsonArray array = json.getAsJsonArray("payor");
8306      for (int i = 0; i < array.size(); i++) {
8307        res.getPayor().add(parseReference(array.get(i).getAsJsonObject()));
8308      }
8309    };
8310    if (json.has("class")) {
8311      JsonArray array = json.getAsJsonArray("class");
8312      for (int i = 0; i < array.size(); i++) {
8313        res.getClass_().add(parseCoverageClassComponent(array.get(i).getAsJsonObject(), res));
8314      }
8315    };
8316    if (json.has("order"))
8317      res.setOrderElement(parsePositiveInt(json.get("order").getAsString()));
8318    if (json.has("_order"))
8319      parseElementProperties(json.getAsJsonObject("_order"), res.getOrderElement());
8320    if (json.has("network"))
8321      res.setNetworkElement(parseString(json.get("network").getAsString()));
8322    if (json.has("_network"))
8323      parseElementProperties(json.getAsJsonObject("_network"), res.getNetworkElement());
8324    if (json.has("costToBeneficiary")) {
8325      JsonArray array = json.getAsJsonArray("costToBeneficiary");
8326      for (int i = 0; i < array.size(); i++) {
8327        res.getCostToBeneficiary().add(parseCoverageCostToBeneficiaryComponent(array.get(i).getAsJsonObject(), res));
8328      }
8329    };
8330    if (json.has("subrogation"))
8331      res.setSubrogationElement(parseBoolean(json.get("subrogation").getAsBoolean()));
8332    if (json.has("_subrogation"))
8333      parseElementProperties(json.getAsJsonObject("_subrogation"), res.getSubrogationElement());
8334    if (json.has("contract")) {
8335      JsonArray array = json.getAsJsonArray("contract");
8336      for (int i = 0; i < array.size(); i++) {
8337        res.getContract().add(parseReference(array.get(i).getAsJsonObject()));
8338      }
8339    };
8340  }
8341
8342  protected Coverage.ClassComponent parseCoverageClassComponent(JsonObject json, Coverage owner) throws IOException, FHIRFormatError {
8343    Coverage.ClassComponent res = new Coverage.ClassComponent();
8344    parseCoverageClassComponentProperties(json, owner, res);
8345    return res;
8346  }
8347
8348  protected void parseCoverageClassComponentProperties(JsonObject json, Coverage owner, Coverage.ClassComponent res) throws IOException, FHIRFormatError {
8349    parseBackboneElementProperties(json, res);
8350    if (json.has("type"))
8351      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8352    if (json.has("value"))
8353      res.setValueElement(parseString(json.get("value").getAsString()));
8354    if (json.has("_value"))
8355      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
8356    if (json.has("name"))
8357      res.setNameElement(parseString(json.get("name").getAsString()));
8358    if (json.has("_name"))
8359      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8360  }
8361
8362  protected Coverage.CostToBeneficiaryComponent parseCoverageCostToBeneficiaryComponent(JsonObject json, Coverage owner) throws IOException, FHIRFormatError {
8363    Coverage.CostToBeneficiaryComponent res = new Coverage.CostToBeneficiaryComponent();
8364    parseCoverageCostToBeneficiaryComponentProperties(json, owner, res);
8365    return res;
8366  }
8367
8368  protected void parseCoverageCostToBeneficiaryComponentProperties(JsonObject json, Coverage owner, Coverage.CostToBeneficiaryComponent res) throws IOException, FHIRFormatError {
8369    parseBackboneElementProperties(json, res);
8370    if (json.has("type"))
8371      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8372    Type value = parseType("value", json);
8373    if (value != null)
8374      res.setValue(value);
8375    if (json.has("exception")) {
8376      JsonArray array = json.getAsJsonArray("exception");
8377      for (int i = 0; i < array.size(); i++) {
8378        res.getException().add(parseCoverageExemptionComponent(array.get(i).getAsJsonObject(), owner));
8379      }
8380    };
8381  }
8382
8383  protected Coverage.ExemptionComponent parseCoverageExemptionComponent(JsonObject json, Coverage owner) throws IOException, FHIRFormatError {
8384    Coverage.ExemptionComponent res = new Coverage.ExemptionComponent();
8385    parseCoverageExemptionComponentProperties(json, owner, res);
8386    return res;
8387  }
8388
8389  protected void parseCoverageExemptionComponentProperties(JsonObject json, Coverage owner, Coverage.ExemptionComponent res) throws IOException, FHIRFormatError {
8390    parseBackboneElementProperties(json, res);
8391    if (json.has("type"))
8392      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8393    if (json.has("period"))
8394      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8395  }
8396
8397  protected CoverageEligibilityRequest parseCoverageEligibilityRequest(JsonObject json) throws IOException, FHIRFormatError {
8398    CoverageEligibilityRequest res = new CoverageEligibilityRequest();
8399    parseCoverageEligibilityRequestProperties(json, res);
8400    return res;
8401  }
8402
8403  protected void parseCoverageEligibilityRequestProperties(JsonObject json, CoverageEligibilityRequest res) throws IOException, FHIRFormatError {
8404    parseDomainResourceProperties(json, res);
8405    if (json.has("identifier")) {
8406      JsonArray array = json.getAsJsonArray("identifier");
8407      for (int i = 0; i < array.size(); i++) {
8408        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8409      }
8410    };
8411    if (json.has("status"))
8412      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CoverageEligibilityRequest.EligibilityRequestStatus.NULL, new CoverageEligibilityRequest.EligibilityRequestStatusEnumFactory()));
8413    if (json.has("_status"))
8414      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8415    if (json.has("priority"))
8416      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
8417    if (json.has("purpose")) {
8418      JsonArray array = json.getAsJsonArray("purpose");
8419      for (int i = 0; i < array.size(); i++) {
8420        res.getPurpose().add(parseEnumeration(array.get(i).getAsString(), CoverageEligibilityRequest.EligibilityRequestPurpose.NULL, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory()));
8421      }
8422    };
8423    if (json.has("_purpose")) {
8424      JsonArray array = json.getAsJsonArray("_purpose");
8425      for (int i = 0; i < array.size(); i++) {
8426        if (i == res.getPurpose().size())
8427          res.getPurpose().add(parseEnumeration(null, CoverageEligibilityRequest.EligibilityRequestPurpose.NULL, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory()));
8428        if (array.get(i) instanceof JsonObject) 
8429          parseElementProperties(array.get(i).getAsJsonObject(), res.getPurpose().get(i));
8430      }
8431    };
8432    if (json.has("patient"))
8433      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8434    Type serviced = parseType("serviced", json);
8435    if (serviced != null)
8436      res.setServiced(serviced);
8437    if (json.has("created"))
8438      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8439    if (json.has("_created"))
8440      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8441    if (json.has("enterer"))
8442      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
8443    if (json.has("provider"))
8444      res.setProvider(parseReference(json.getAsJsonObject("provider")));
8445    if (json.has("insurer"))
8446      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
8447    if (json.has("facility"))
8448      res.setFacility(parseReference(json.getAsJsonObject("facility")));
8449    if (json.has("supportingInfo")) {
8450      JsonArray array = json.getAsJsonArray("supportingInfo");
8451      for (int i = 0; i < array.size(); i++) {
8452        res.getSupportingInfo().add(parseCoverageEligibilityRequestSupportingInformationComponent(array.get(i).getAsJsonObject(), res));
8453      }
8454    };
8455    if (json.has("insurance")) {
8456      JsonArray array = json.getAsJsonArray("insurance");
8457      for (int i = 0; i < array.size(); i++) {
8458        res.getInsurance().add(parseCoverageEligibilityRequestInsuranceComponent(array.get(i).getAsJsonObject(), res));
8459      }
8460    };
8461    if (json.has("item")) {
8462      JsonArray array = json.getAsJsonArray("item");
8463      for (int i = 0; i < array.size(); i++) {
8464        res.getItem().add(parseCoverageEligibilityRequestDetailsComponent(array.get(i).getAsJsonObject(), res));
8465      }
8466    };
8467  }
8468
8469  protected CoverageEligibilityRequest.SupportingInformationComponent parseCoverageEligibilityRequestSupportingInformationComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
8470    CoverageEligibilityRequest.SupportingInformationComponent res = new CoverageEligibilityRequest.SupportingInformationComponent();
8471    parseCoverageEligibilityRequestSupportingInformationComponentProperties(json, owner, res);
8472    return res;
8473  }
8474
8475  protected void parseCoverageEligibilityRequestSupportingInformationComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.SupportingInformationComponent res) throws IOException, FHIRFormatError {
8476    parseBackboneElementProperties(json, res);
8477    if (json.has("sequence"))
8478      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
8479    if (json.has("_sequence"))
8480      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
8481    if (json.has("information"))
8482      res.setInformation(parseReference(json.getAsJsonObject("information")));
8483    if (json.has("appliesToAll"))
8484      res.setAppliesToAllElement(parseBoolean(json.get("appliesToAll").getAsBoolean()));
8485    if (json.has("_appliesToAll"))
8486      parseElementProperties(json.getAsJsonObject("_appliesToAll"), res.getAppliesToAllElement());
8487  }
8488
8489  protected CoverageEligibilityRequest.InsuranceComponent parseCoverageEligibilityRequestInsuranceComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
8490    CoverageEligibilityRequest.InsuranceComponent res = new CoverageEligibilityRequest.InsuranceComponent();
8491    parseCoverageEligibilityRequestInsuranceComponentProperties(json, owner, res);
8492    return res;
8493  }
8494
8495  protected void parseCoverageEligibilityRequestInsuranceComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.InsuranceComponent res) throws IOException, FHIRFormatError {
8496    parseBackboneElementProperties(json, res);
8497    if (json.has("focal"))
8498      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
8499    if (json.has("_focal"))
8500      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
8501    if (json.has("coverage"))
8502      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
8503    if (json.has("businessArrangement"))
8504      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
8505    if (json.has("_businessArrangement"))
8506      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
8507  }
8508
8509  protected CoverageEligibilityRequest.DetailsComponent parseCoverageEligibilityRequestDetailsComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
8510    CoverageEligibilityRequest.DetailsComponent res = new CoverageEligibilityRequest.DetailsComponent();
8511    parseCoverageEligibilityRequestDetailsComponentProperties(json, owner, res);
8512    return res;
8513  }
8514
8515  protected void parseCoverageEligibilityRequestDetailsComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.DetailsComponent res) throws IOException, FHIRFormatError {
8516    parseBackboneElementProperties(json, res);
8517    if (json.has("supportingInfoSequence")) {
8518      JsonArray array = json.getAsJsonArray("supportingInfoSequence");
8519      for (int i = 0; i < array.size(); i++) {
8520        res.getSupportingInfoSequence().add(parsePositiveInt(array.get(i).getAsString()));
8521      }
8522    };
8523    if (json.has("_supportingInfoSequence")) {
8524      JsonArray array = json.getAsJsonArray("_supportingInfoSequence");
8525      for (int i = 0; i < array.size(); i++) {
8526        if (i == res.getSupportingInfoSequence().size())
8527          res.getSupportingInfoSequence().add(parsePositiveInt(null));
8528        if (array.get(i) instanceof JsonObject) 
8529          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportingInfoSequence().get(i));
8530      }
8531    };
8532    if (json.has("category"))
8533      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
8534    if (json.has("productOrService"))
8535      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
8536    if (json.has("modifier")) {
8537      JsonArray array = json.getAsJsonArray("modifier");
8538      for (int i = 0; i < array.size(); i++) {
8539        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8540      }
8541    };
8542    if (json.has("provider"))
8543      res.setProvider(parseReference(json.getAsJsonObject("provider")));
8544    if (json.has("quantity"))
8545      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
8546    if (json.has("unitPrice"))
8547      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
8548    if (json.has("facility"))
8549      res.setFacility(parseReference(json.getAsJsonObject("facility")));
8550    if (json.has("diagnosis")) {
8551      JsonArray array = json.getAsJsonArray("diagnosis");
8552      for (int i = 0; i < array.size(); i++) {
8553        res.getDiagnosis().add(parseCoverageEligibilityRequestDiagnosisComponent(array.get(i).getAsJsonObject(), owner));
8554      }
8555    };
8556    if (json.has("detail")) {
8557      JsonArray array = json.getAsJsonArray("detail");
8558      for (int i = 0; i < array.size(); i++) {
8559        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
8560      }
8561    };
8562  }
8563
8564  protected CoverageEligibilityRequest.DiagnosisComponent parseCoverageEligibilityRequestDiagnosisComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
8565    CoverageEligibilityRequest.DiagnosisComponent res = new CoverageEligibilityRequest.DiagnosisComponent();
8566    parseCoverageEligibilityRequestDiagnosisComponentProperties(json, owner, res);
8567    return res;
8568  }
8569
8570  protected void parseCoverageEligibilityRequestDiagnosisComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.DiagnosisComponent res) throws IOException, FHIRFormatError {
8571    parseBackboneElementProperties(json, res);
8572    Type diagnosis = parseType("diagnosis", json);
8573    if (diagnosis != null)
8574      res.setDiagnosis(diagnosis);
8575  }
8576
8577  protected CoverageEligibilityResponse parseCoverageEligibilityResponse(JsonObject json) throws IOException, FHIRFormatError {
8578    CoverageEligibilityResponse res = new CoverageEligibilityResponse();
8579    parseCoverageEligibilityResponseProperties(json, res);
8580    return res;
8581  }
8582
8583  protected void parseCoverageEligibilityResponseProperties(JsonObject json, CoverageEligibilityResponse res) throws IOException, FHIRFormatError {
8584    parseDomainResourceProperties(json, res);
8585    if (json.has("identifier")) {
8586      JsonArray array = json.getAsJsonArray("identifier");
8587      for (int i = 0; i < array.size(); i++) {
8588        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8589      }
8590    };
8591    if (json.has("status"))
8592      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CoverageEligibilityResponse.EligibilityResponseStatus.NULL, new CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory()));
8593    if (json.has("_status"))
8594      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8595    if (json.has("purpose")) {
8596      JsonArray array = json.getAsJsonArray("purpose");
8597      for (int i = 0; i < array.size(); i++) {
8598        res.getPurpose().add(parseEnumeration(array.get(i).getAsString(), CoverageEligibilityResponse.EligibilityResponsePurpose.NULL, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory()));
8599      }
8600    };
8601    if (json.has("_purpose")) {
8602      JsonArray array = json.getAsJsonArray("_purpose");
8603      for (int i = 0; i < array.size(); i++) {
8604        if (i == res.getPurpose().size())
8605          res.getPurpose().add(parseEnumeration(null, CoverageEligibilityResponse.EligibilityResponsePurpose.NULL, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory()));
8606        if (array.get(i) instanceof JsonObject) 
8607          parseElementProperties(array.get(i).getAsJsonObject(), res.getPurpose().get(i));
8608      }
8609    };
8610    if (json.has("patient"))
8611      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8612    Type serviced = parseType("serviced", json);
8613    if (serviced != null)
8614      res.setServiced(serviced);
8615    if (json.has("created"))
8616      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8617    if (json.has("_created"))
8618      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8619    if (json.has("requestor"))
8620      res.setRequestor(parseReference(json.getAsJsonObject("requestor")));
8621    if (json.has("request"))
8622      res.setRequest(parseReference(json.getAsJsonObject("request")));
8623    if (json.has("outcome"))
8624      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
8625    if (json.has("_outcome"))
8626      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
8627    if (json.has("disposition"))
8628      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
8629    if (json.has("_disposition"))
8630      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
8631    if (json.has("insurer"))
8632      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
8633    if (json.has("insurance")) {
8634      JsonArray array = json.getAsJsonArray("insurance");
8635      for (int i = 0; i < array.size(); i++) {
8636        res.getInsurance().add(parseCoverageEligibilityResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
8637      }
8638    };
8639    if (json.has("preAuthRef"))
8640      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
8641    if (json.has("_preAuthRef"))
8642      parseElementProperties(json.getAsJsonObject("_preAuthRef"), res.getPreAuthRefElement());
8643    if (json.has("form"))
8644      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
8645    if (json.has("error")) {
8646      JsonArray array = json.getAsJsonArray("error");
8647      for (int i = 0; i < array.size(); i++) {
8648        res.getError().add(parseCoverageEligibilityResponseErrorsComponent(array.get(i).getAsJsonObject(), res));
8649      }
8650    };
8651  }
8652
8653  protected CoverageEligibilityResponse.InsuranceComponent parseCoverageEligibilityResponseInsuranceComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
8654    CoverageEligibilityResponse.InsuranceComponent res = new CoverageEligibilityResponse.InsuranceComponent();
8655    parseCoverageEligibilityResponseInsuranceComponentProperties(json, owner, res);
8656    return res;
8657  }
8658
8659  protected void parseCoverageEligibilityResponseInsuranceComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
8660    parseBackboneElementProperties(json, res);
8661    if (json.has("coverage"))
8662      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
8663    if (json.has("inforce"))
8664      res.setInforceElement(parseBoolean(json.get("inforce").getAsBoolean()));
8665    if (json.has("_inforce"))
8666      parseElementProperties(json.getAsJsonObject("_inforce"), res.getInforceElement());
8667    if (json.has("benefitPeriod"))
8668      res.setBenefitPeriod(parsePeriod(json.getAsJsonObject("benefitPeriod")));
8669    if (json.has("item")) {
8670      JsonArray array = json.getAsJsonArray("item");
8671      for (int i = 0; i < array.size(); i++) {
8672        res.getItem().add(parseCoverageEligibilityResponseItemsComponent(array.get(i).getAsJsonObject(), owner));
8673      }
8674    };
8675  }
8676
8677  protected CoverageEligibilityResponse.ItemsComponent parseCoverageEligibilityResponseItemsComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
8678    CoverageEligibilityResponse.ItemsComponent res = new CoverageEligibilityResponse.ItemsComponent();
8679    parseCoverageEligibilityResponseItemsComponentProperties(json, owner, res);
8680    return res;
8681  }
8682
8683  protected void parseCoverageEligibilityResponseItemsComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.ItemsComponent res) throws IOException, FHIRFormatError {
8684    parseBackboneElementProperties(json, res);
8685    if (json.has("category"))
8686      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
8687    if (json.has("productOrService"))
8688      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
8689    if (json.has("modifier")) {
8690      JsonArray array = json.getAsJsonArray("modifier");
8691      for (int i = 0; i < array.size(); i++) {
8692        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8693      }
8694    };
8695    if (json.has("provider"))
8696      res.setProvider(parseReference(json.getAsJsonObject("provider")));
8697    if (json.has("excluded"))
8698      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
8699    if (json.has("_excluded"))
8700      parseElementProperties(json.getAsJsonObject("_excluded"), res.getExcludedElement());
8701    if (json.has("name"))
8702      res.setNameElement(parseString(json.get("name").getAsString()));
8703    if (json.has("_name"))
8704      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8705    if (json.has("description"))
8706      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8707    if (json.has("_description"))
8708      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
8709    if (json.has("network"))
8710      res.setNetwork(parseCodeableConcept(json.getAsJsonObject("network")));
8711    if (json.has("unit"))
8712      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
8713    if (json.has("term"))
8714      res.setTerm(parseCodeableConcept(json.getAsJsonObject("term")));
8715    if (json.has("benefit")) {
8716      JsonArray array = json.getAsJsonArray("benefit");
8717      for (int i = 0; i < array.size(); i++) {
8718        res.getBenefit().add(parseCoverageEligibilityResponseBenefitComponent(array.get(i).getAsJsonObject(), owner));
8719      }
8720    };
8721    if (json.has("authorizationRequired"))
8722      res.setAuthorizationRequiredElement(parseBoolean(json.get("authorizationRequired").getAsBoolean()));
8723    if (json.has("_authorizationRequired"))
8724      parseElementProperties(json.getAsJsonObject("_authorizationRequired"), res.getAuthorizationRequiredElement());
8725    if (json.has("authorizationSupporting")) {
8726      JsonArray array = json.getAsJsonArray("authorizationSupporting");
8727      for (int i = 0; i < array.size(); i++) {
8728        res.getAuthorizationSupporting().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8729      }
8730    };
8731    if (json.has("authorizationUrl"))
8732      res.setAuthorizationUrlElement(parseUri(json.get("authorizationUrl").getAsString()));
8733    if (json.has("_authorizationUrl"))
8734      parseElementProperties(json.getAsJsonObject("_authorizationUrl"), res.getAuthorizationUrlElement());
8735  }
8736
8737  protected CoverageEligibilityResponse.BenefitComponent parseCoverageEligibilityResponseBenefitComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
8738    CoverageEligibilityResponse.BenefitComponent res = new CoverageEligibilityResponse.BenefitComponent();
8739    parseCoverageEligibilityResponseBenefitComponentProperties(json, owner, res);
8740    return res;
8741  }
8742
8743  protected void parseCoverageEligibilityResponseBenefitComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.BenefitComponent res) throws IOException, FHIRFormatError {
8744    parseBackboneElementProperties(json, res);
8745    if (json.has("type"))
8746      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8747    Type allowed = parseType("allowed", json);
8748    if (allowed != null)
8749      res.setAllowed(allowed);
8750    Type used = parseType("used", json);
8751    if (used != null)
8752      res.setUsed(used);
8753  }
8754
8755  protected CoverageEligibilityResponse.ErrorsComponent parseCoverageEligibilityResponseErrorsComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
8756    CoverageEligibilityResponse.ErrorsComponent res = new CoverageEligibilityResponse.ErrorsComponent();
8757    parseCoverageEligibilityResponseErrorsComponentProperties(json, owner, res);
8758    return res;
8759  }
8760
8761  protected void parseCoverageEligibilityResponseErrorsComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.ErrorsComponent res) throws IOException, FHIRFormatError {
8762    parseBackboneElementProperties(json, res);
8763    if (json.has("code"))
8764      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8765  }
8766
8767  protected DetectedIssue parseDetectedIssue(JsonObject json) throws IOException, FHIRFormatError {
8768    DetectedIssue res = new DetectedIssue();
8769    parseDetectedIssueProperties(json, res);
8770    return res;
8771  }
8772
8773  protected void parseDetectedIssueProperties(JsonObject json, DetectedIssue res) throws IOException, FHIRFormatError {
8774    parseDomainResourceProperties(json, res);
8775    if (json.has("identifier")) {
8776      JsonArray array = json.getAsJsonArray("identifier");
8777      for (int i = 0; i < array.size(); i++) {
8778        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8779      }
8780    };
8781    if (json.has("status"))
8782      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DetectedIssue.DetectedIssueStatus.NULL, new DetectedIssue.DetectedIssueStatusEnumFactory()));
8783    if (json.has("_status"))
8784      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8785    if (json.has("code"))
8786      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8787    if (json.has("severity"))
8788      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), DetectedIssue.DetectedIssueSeverity.NULL, new DetectedIssue.DetectedIssueSeverityEnumFactory()));
8789    if (json.has("_severity"))
8790      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
8791    if (json.has("patient"))
8792      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8793    Type identified = parseType("identified", json);
8794    if (identified != null)
8795      res.setIdentified(identified);
8796    if (json.has("author"))
8797      res.setAuthor(parseReference(json.getAsJsonObject("author")));
8798    if (json.has("implicated")) {
8799      JsonArray array = json.getAsJsonArray("implicated");
8800      for (int i = 0; i < array.size(); i++) {
8801        res.getImplicated().add(parseReference(array.get(i).getAsJsonObject()));
8802      }
8803    };
8804    if (json.has("evidence")) {
8805      JsonArray array = json.getAsJsonArray("evidence");
8806      for (int i = 0; i < array.size(); i++) {
8807        res.getEvidence().add(parseDetectedIssueDetectedIssueEvidenceComponent(array.get(i).getAsJsonObject(), res));
8808      }
8809    };
8810    if (json.has("detail"))
8811      res.setDetailElement(parseString(json.get("detail").getAsString()));
8812    if (json.has("_detail"))
8813      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
8814    if (json.has("reference"))
8815      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
8816    if (json.has("_reference"))
8817      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
8818    if (json.has("mitigation")) {
8819      JsonArray array = json.getAsJsonArray("mitigation");
8820      for (int i = 0; i < array.size(); i++) {
8821        res.getMitigation().add(parseDetectedIssueDetectedIssueMitigationComponent(array.get(i).getAsJsonObject(), res));
8822      }
8823    };
8824  }
8825
8826  protected DetectedIssue.DetectedIssueEvidenceComponent parseDetectedIssueDetectedIssueEvidenceComponent(JsonObject json, DetectedIssue owner) throws IOException, FHIRFormatError {
8827    DetectedIssue.DetectedIssueEvidenceComponent res = new DetectedIssue.DetectedIssueEvidenceComponent();
8828    parseDetectedIssueDetectedIssueEvidenceComponentProperties(json, owner, res);
8829    return res;
8830  }
8831
8832  protected void parseDetectedIssueDetectedIssueEvidenceComponentProperties(JsonObject json, DetectedIssue owner, DetectedIssue.DetectedIssueEvidenceComponent res) throws IOException, FHIRFormatError {
8833    parseBackboneElementProperties(json, res);
8834    if (json.has("code")) {
8835      JsonArray array = json.getAsJsonArray("code");
8836      for (int i = 0; i < array.size(); i++) {
8837        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8838      }
8839    };
8840    if (json.has("detail")) {
8841      JsonArray array = json.getAsJsonArray("detail");
8842      for (int i = 0; i < array.size(); i++) {
8843        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
8844      }
8845    };
8846  }
8847
8848  protected DetectedIssue.DetectedIssueMitigationComponent parseDetectedIssueDetectedIssueMitigationComponent(JsonObject json, DetectedIssue owner) throws IOException, FHIRFormatError {
8849    DetectedIssue.DetectedIssueMitigationComponent res = new DetectedIssue.DetectedIssueMitigationComponent();
8850    parseDetectedIssueDetectedIssueMitigationComponentProperties(json, owner, res);
8851    return res;
8852  }
8853
8854  protected void parseDetectedIssueDetectedIssueMitigationComponentProperties(JsonObject json, DetectedIssue owner, DetectedIssue.DetectedIssueMitigationComponent res) throws IOException, FHIRFormatError {
8855    parseBackboneElementProperties(json, res);
8856    if (json.has("action"))
8857      res.setAction(parseCodeableConcept(json.getAsJsonObject("action")));
8858    if (json.has("date"))
8859      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8860    if (json.has("_date"))
8861      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8862    if (json.has("author"))
8863      res.setAuthor(parseReference(json.getAsJsonObject("author")));
8864  }
8865
8866  protected Device parseDevice(JsonObject json) throws IOException, FHIRFormatError {
8867    Device res = new Device();
8868    parseDeviceProperties(json, res);
8869    return res;
8870  }
8871
8872  protected void parseDeviceProperties(JsonObject json, Device res) throws IOException, FHIRFormatError {
8873    parseDomainResourceProperties(json, res);
8874    if (json.has("identifier")) {
8875      JsonArray array = json.getAsJsonArray("identifier");
8876      for (int i = 0; i < array.size(); i++) {
8877        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8878      }
8879    };
8880    if (json.has("definition"))
8881      res.setDefinition(parseReference(json.getAsJsonObject("definition")));
8882    if (json.has("udiCarrier")) {
8883      JsonArray array = json.getAsJsonArray("udiCarrier");
8884      for (int i = 0; i < array.size(); i++) {
8885        res.getUdiCarrier().add(parseDeviceDeviceUdiCarrierComponent(array.get(i).getAsJsonObject(), res));
8886      }
8887    };
8888    if (json.has("status"))
8889      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Device.FHIRDeviceStatus.NULL, new Device.FHIRDeviceStatusEnumFactory()));
8890    if (json.has("_status"))
8891      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8892    if (json.has("statusReason")) {
8893      JsonArray array = json.getAsJsonArray("statusReason");
8894      for (int i = 0; i < array.size(); i++) {
8895        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8896      }
8897    };
8898    if (json.has("distinctIdentifier"))
8899      res.setDistinctIdentifierElement(parseString(json.get("distinctIdentifier").getAsString()));
8900    if (json.has("_distinctIdentifier"))
8901      parseElementProperties(json.getAsJsonObject("_distinctIdentifier"), res.getDistinctIdentifierElement());
8902    if (json.has("manufacturer"))
8903      res.setManufacturerElement(parseString(json.get("manufacturer").getAsString()));
8904    if (json.has("_manufacturer"))
8905      parseElementProperties(json.getAsJsonObject("_manufacturer"), res.getManufacturerElement());
8906    if (json.has("manufactureDate"))
8907      res.setManufactureDateElement(parseDateTime(json.get("manufactureDate").getAsString()));
8908    if (json.has("_manufactureDate"))
8909      parseElementProperties(json.getAsJsonObject("_manufactureDate"), res.getManufactureDateElement());
8910    if (json.has("expirationDate"))
8911      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
8912    if (json.has("_expirationDate"))
8913      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
8914    if (json.has("lotNumber"))
8915      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
8916    if (json.has("_lotNumber"))
8917      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
8918    if (json.has("serialNumber"))
8919      res.setSerialNumberElement(parseString(json.get("serialNumber").getAsString()));
8920    if (json.has("_serialNumber"))
8921      parseElementProperties(json.getAsJsonObject("_serialNumber"), res.getSerialNumberElement());
8922    if (json.has("deviceName")) {
8923      JsonArray array = json.getAsJsonArray("deviceName");
8924      for (int i = 0; i < array.size(); i++) {
8925        res.getDeviceName().add(parseDeviceDeviceDeviceNameComponent(array.get(i).getAsJsonObject(), res));
8926      }
8927    };
8928    if (json.has("modelNumber"))
8929      res.setModelNumberElement(parseString(json.get("modelNumber").getAsString()));
8930    if (json.has("_modelNumber"))
8931      parseElementProperties(json.getAsJsonObject("_modelNumber"), res.getModelNumberElement());
8932    if (json.has("partNumber"))
8933      res.setPartNumberElement(parseString(json.get("partNumber").getAsString()));
8934    if (json.has("_partNumber"))
8935      parseElementProperties(json.getAsJsonObject("_partNumber"), res.getPartNumberElement());
8936    if (json.has("type"))
8937      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8938    if (json.has("specialization")) {
8939      JsonArray array = json.getAsJsonArray("specialization");
8940      for (int i = 0; i < array.size(); i++) {
8941        res.getSpecialization().add(parseDeviceDeviceSpecializationComponent(array.get(i).getAsJsonObject(), res));
8942      }
8943    };
8944    if (json.has("version")) {
8945      JsonArray array = json.getAsJsonArray("version");
8946      for (int i = 0; i < array.size(); i++) {
8947        res.getVersion().add(parseDeviceDeviceVersionComponent(array.get(i).getAsJsonObject(), res));
8948      }
8949    };
8950    if (json.has("property")) {
8951      JsonArray array = json.getAsJsonArray("property");
8952      for (int i = 0; i < array.size(); i++) {
8953        res.getProperty().add(parseDeviceDevicePropertyComponent(array.get(i).getAsJsonObject(), res));
8954      }
8955    };
8956    if (json.has("patient"))
8957      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8958    if (json.has("owner"))
8959      res.setOwner(parseReference(json.getAsJsonObject("owner")));
8960    if (json.has("contact")) {
8961      JsonArray array = json.getAsJsonArray("contact");
8962      for (int i = 0; i < array.size(); i++) {
8963        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
8964      }
8965    };
8966    if (json.has("location"))
8967      res.setLocation(parseReference(json.getAsJsonObject("location")));
8968    if (json.has("url"))
8969      res.setUrlElement(parseUri(json.get("url").getAsString()));
8970    if (json.has("_url"))
8971      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8972    if (json.has("note")) {
8973      JsonArray array = json.getAsJsonArray("note");
8974      for (int i = 0; i < array.size(); i++) {
8975        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
8976      }
8977    };
8978    if (json.has("safety")) {
8979      JsonArray array = json.getAsJsonArray("safety");
8980      for (int i = 0; i < array.size(); i++) {
8981        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8982      }
8983    };
8984    if (json.has("parent"))
8985      res.setParent(parseReference(json.getAsJsonObject("parent")));
8986  }
8987
8988  protected Device.DeviceUdiCarrierComponent parseDeviceDeviceUdiCarrierComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
8989    Device.DeviceUdiCarrierComponent res = new Device.DeviceUdiCarrierComponent();
8990    parseDeviceDeviceUdiCarrierComponentProperties(json, owner, res);
8991    return res;
8992  }
8993
8994  protected void parseDeviceDeviceUdiCarrierComponentProperties(JsonObject json, Device owner, Device.DeviceUdiCarrierComponent res) throws IOException, FHIRFormatError {
8995    parseBackboneElementProperties(json, res);
8996    if (json.has("deviceIdentifier"))
8997      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
8998    if (json.has("_deviceIdentifier"))
8999      parseElementProperties(json.getAsJsonObject("_deviceIdentifier"), res.getDeviceIdentifierElement());
9000    if (json.has("issuer"))
9001      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
9002    if (json.has("_issuer"))
9003      parseElementProperties(json.getAsJsonObject("_issuer"), res.getIssuerElement());
9004    if (json.has("jurisdiction"))
9005      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
9006    if (json.has("_jurisdiction"))
9007      parseElementProperties(json.getAsJsonObject("_jurisdiction"), res.getJurisdictionElement());
9008    if (json.has("carrierAIDC"))
9009      res.setCarrierAIDCElement(parseBase64Binary(json.get("carrierAIDC").getAsString()));
9010    if (json.has("_carrierAIDC"))
9011      parseElementProperties(json.getAsJsonObject("_carrierAIDC"), res.getCarrierAIDCElement());
9012    if (json.has("carrierHRF"))
9013      res.setCarrierHRFElement(parseString(json.get("carrierHRF").getAsString()));
9014    if (json.has("_carrierHRF"))
9015      parseElementProperties(json.getAsJsonObject("_carrierHRF"), res.getCarrierHRFElement());
9016    if (json.has("entryType"))
9017      res.setEntryTypeElement(parseEnumeration(json.get("entryType").getAsString(), Device.UDIEntryType.NULL, new Device.UDIEntryTypeEnumFactory()));
9018    if (json.has("_entryType"))
9019      parseElementProperties(json.getAsJsonObject("_entryType"), res.getEntryTypeElement());
9020  }
9021
9022  protected Device.DeviceDeviceNameComponent parseDeviceDeviceDeviceNameComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
9023    Device.DeviceDeviceNameComponent res = new Device.DeviceDeviceNameComponent();
9024    parseDeviceDeviceDeviceNameComponentProperties(json, owner, res);
9025    return res;
9026  }
9027
9028  protected void parseDeviceDeviceDeviceNameComponentProperties(JsonObject json, Device owner, Device.DeviceDeviceNameComponent res) throws IOException, FHIRFormatError {
9029    parseBackboneElementProperties(json, res);
9030    if (json.has("name"))
9031      res.setNameElement(parseString(json.get("name").getAsString()));
9032    if (json.has("_name"))
9033      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9034    if (json.has("type"))
9035      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Device.DeviceNameType.NULL, new Device.DeviceNameTypeEnumFactory()));
9036    if (json.has("_type"))
9037      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9038  }
9039
9040  protected Device.DeviceSpecializationComponent parseDeviceDeviceSpecializationComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
9041    Device.DeviceSpecializationComponent res = new Device.DeviceSpecializationComponent();
9042    parseDeviceDeviceSpecializationComponentProperties(json, owner, res);
9043    return res;
9044  }
9045
9046  protected void parseDeviceDeviceSpecializationComponentProperties(JsonObject json, Device owner, Device.DeviceSpecializationComponent res) throws IOException, FHIRFormatError {
9047    parseBackboneElementProperties(json, res);
9048    if (json.has("systemType"))
9049      res.setSystemType(parseCodeableConcept(json.getAsJsonObject("systemType")));
9050    if (json.has("version"))
9051      res.setVersionElement(parseString(json.get("version").getAsString()));
9052    if (json.has("_version"))
9053      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
9054  }
9055
9056  protected Device.DeviceVersionComponent parseDeviceDeviceVersionComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
9057    Device.DeviceVersionComponent res = new Device.DeviceVersionComponent();
9058    parseDeviceDeviceVersionComponentProperties(json, owner, res);
9059    return res;
9060  }
9061
9062  protected void parseDeviceDeviceVersionComponentProperties(JsonObject json, Device owner, Device.DeviceVersionComponent res) throws IOException, FHIRFormatError {
9063    parseBackboneElementProperties(json, res);
9064    if (json.has("type"))
9065      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9066    if (json.has("component"))
9067      res.setComponent(parseIdentifier(json.getAsJsonObject("component")));
9068    if (json.has("value"))
9069      res.setValueElement(parseString(json.get("value").getAsString()));
9070    if (json.has("_value"))
9071      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
9072  }
9073
9074  protected Device.DevicePropertyComponent parseDeviceDevicePropertyComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
9075    Device.DevicePropertyComponent res = new Device.DevicePropertyComponent();
9076    parseDeviceDevicePropertyComponentProperties(json, owner, res);
9077    return res;
9078  }
9079
9080  protected void parseDeviceDevicePropertyComponentProperties(JsonObject json, Device owner, Device.DevicePropertyComponent res) throws IOException, FHIRFormatError {
9081    parseBackboneElementProperties(json, res);
9082    if (json.has("type"))
9083      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9084    if (json.has("valueQuantity")) {
9085      JsonArray array = json.getAsJsonArray("valueQuantity");
9086      for (int i = 0; i < array.size(); i++) {
9087        res.getValueQuantity().add(parseQuantity(array.get(i).getAsJsonObject()));
9088      }
9089    };
9090    if (json.has("valueCode")) {
9091      JsonArray array = json.getAsJsonArray("valueCode");
9092      for (int i = 0; i < array.size(); i++) {
9093        res.getValueCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9094      }
9095    };
9096  }
9097
9098  protected DeviceDefinition parseDeviceDefinition(JsonObject json) throws IOException, FHIRFormatError {
9099    DeviceDefinition res = new DeviceDefinition();
9100    parseDeviceDefinitionProperties(json, res);
9101    return res;
9102  }
9103
9104  protected void parseDeviceDefinitionProperties(JsonObject json, DeviceDefinition res) throws IOException, FHIRFormatError {
9105    parseDomainResourceProperties(json, res);
9106    if (json.has("identifier")) {
9107      JsonArray array = json.getAsJsonArray("identifier");
9108      for (int i = 0; i < array.size(); i++) {
9109        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9110      }
9111    };
9112    if (json.has("udiDeviceIdentifier")) {
9113      JsonArray array = json.getAsJsonArray("udiDeviceIdentifier");
9114      for (int i = 0; i < array.size(); i++) {
9115        res.getUdiDeviceIdentifier().add(parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(array.get(i).getAsJsonObject(), res));
9116      }
9117    };
9118    Type manufacturer = parseType("manufacturer", json);
9119    if (manufacturer != null)
9120      res.setManufacturer(manufacturer);
9121    if (json.has("deviceName")) {
9122      JsonArray array = json.getAsJsonArray("deviceName");
9123      for (int i = 0; i < array.size(); i++) {
9124        res.getDeviceName().add(parseDeviceDefinitionDeviceDefinitionDeviceNameComponent(array.get(i).getAsJsonObject(), res));
9125      }
9126    };
9127    if (json.has("modelNumber"))
9128      res.setModelNumberElement(parseString(json.get("modelNumber").getAsString()));
9129    if (json.has("_modelNumber"))
9130      parseElementProperties(json.getAsJsonObject("_modelNumber"), res.getModelNumberElement());
9131    if (json.has("type"))
9132      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9133    if (json.has("specialization")) {
9134      JsonArray array = json.getAsJsonArray("specialization");
9135      for (int i = 0; i < array.size(); i++) {
9136        res.getSpecialization().add(parseDeviceDefinitionDeviceDefinitionSpecializationComponent(array.get(i).getAsJsonObject(), res));
9137      }
9138    };
9139    if (json.has("version")) {
9140      JsonArray array = json.getAsJsonArray("version");
9141      for (int i = 0; i < array.size(); i++) {
9142        res.getVersion().add(parseString(array.get(i).getAsString()));
9143      }
9144    };
9145    if (json.has("_version")) {
9146      JsonArray array = json.getAsJsonArray("_version");
9147      for (int i = 0; i < array.size(); i++) {
9148        if (i == res.getVersion().size())
9149          res.getVersion().add(parseString(null));
9150        if (array.get(i) instanceof JsonObject) 
9151          parseElementProperties(array.get(i).getAsJsonObject(), res.getVersion().get(i));
9152      }
9153    };
9154    if (json.has("safety")) {
9155      JsonArray array = json.getAsJsonArray("safety");
9156      for (int i = 0; i < array.size(); i++) {
9157        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9158      }
9159    };
9160    if (json.has("shelfLifeStorage")) {
9161      JsonArray array = json.getAsJsonArray("shelfLifeStorage");
9162      for (int i = 0; i < array.size(); i++) {
9163        res.getShelfLifeStorage().add(parseProductShelfLife(array.get(i).getAsJsonObject()));
9164      }
9165    };
9166    if (json.has("physicalCharacteristics"))
9167      res.setPhysicalCharacteristics(parseProdCharacteristic(json.getAsJsonObject("physicalCharacteristics")));
9168    if (json.has("languageCode")) {
9169      JsonArray array = json.getAsJsonArray("languageCode");
9170      for (int i = 0; i < array.size(); i++) {
9171        res.getLanguageCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9172      }
9173    };
9174    if (json.has("capability")) {
9175      JsonArray array = json.getAsJsonArray("capability");
9176      for (int i = 0; i < array.size(); i++) {
9177        res.getCapability().add(parseDeviceDefinitionDeviceDefinitionCapabilityComponent(array.get(i).getAsJsonObject(), res));
9178      }
9179    };
9180    if (json.has("property")) {
9181      JsonArray array = json.getAsJsonArray("property");
9182      for (int i = 0; i < array.size(); i++) {
9183        res.getProperty().add(parseDeviceDefinitionDeviceDefinitionPropertyComponent(array.get(i).getAsJsonObject(), res));
9184      }
9185    };
9186    if (json.has("owner"))
9187      res.setOwner(parseReference(json.getAsJsonObject("owner")));
9188    if (json.has("contact")) {
9189      JsonArray array = json.getAsJsonArray("contact");
9190      for (int i = 0; i < array.size(); i++) {
9191        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
9192      }
9193    };
9194    if (json.has("url"))
9195      res.setUrlElement(parseUri(json.get("url").getAsString()));
9196    if (json.has("_url"))
9197      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
9198    if (json.has("onlineInformation"))
9199      res.setOnlineInformationElement(parseUri(json.get("onlineInformation").getAsString()));
9200    if (json.has("_onlineInformation"))
9201      parseElementProperties(json.getAsJsonObject("_onlineInformation"), res.getOnlineInformationElement());
9202    if (json.has("note")) {
9203      JsonArray array = json.getAsJsonArray("note");
9204      for (int i = 0; i < array.size(); i++) {
9205        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9206      }
9207    };
9208    if (json.has("quantity"))
9209      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
9210    if (json.has("parentDevice"))
9211      res.setParentDevice(parseReference(json.getAsJsonObject("parentDevice")));
9212    if (json.has("material")) {
9213      JsonArray array = json.getAsJsonArray("material");
9214      for (int i = 0; i < array.size(); i++) {
9215        res.getMaterial().add(parseDeviceDefinitionDeviceDefinitionMaterialComponent(array.get(i).getAsJsonObject(), res));
9216      }
9217    };
9218  }
9219
9220  protected DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9221    DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent res = new DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent();
9222    parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentProperties(json, owner, res);
9223    return res;
9224  }
9225
9226  protected void parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent res) throws IOException, FHIRFormatError {
9227    parseBackboneElementProperties(json, res);
9228    if (json.has("deviceIdentifier"))
9229      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
9230    if (json.has("_deviceIdentifier"))
9231      parseElementProperties(json.getAsJsonObject("_deviceIdentifier"), res.getDeviceIdentifierElement());
9232    if (json.has("issuer"))
9233      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
9234    if (json.has("_issuer"))
9235      parseElementProperties(json.getAsJsonObject("_issuer"), res.getIssuerElement());
9236    if (json.has("jurisdiction"))
9237      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
9238    if (json.has("_jurisdiction"))
9239      parseElementProperties(json.getAsJsonObject("_jurisdiction"), res.getJurisdictionElement());
9240  }
9241
9242  protected DeviceDefinition.DeviceDefinitionDeviceNameComponent parseDeviceDefinitionDeviceDefinitionDeviceNameComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9243    DeviceDefinition.DeviceDefinitionDeviceNameComponent res = new DeviceDefinition.DeviceDefinitionDeviceNameComponent();
9244    parseDeviceDefinitionDeviceDefinitionDeviceNameComponentProperties(json, owner, res);
9245    return res;
9246  }
9247
9248  protected void parseDeviceDefinitionDeviceDefinitionDeviceNameComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionDeviceNameComponent res) throws IOException, FHIRFormatError {
9249    parseBackboneElementProperties(json, res);
9250    if (json.has("name"))
9251      res.setNameElement(parseString(json.get("name").getAsString()));
9252    if (json.has("_name"))
9253      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9254    if (json.has("type"))
9255      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceDefinition.DeviceNameType.NULL, new DeviceDefinition.DeviceNameTypeEnumFactory()));
9256    if (json.has("_type"))
9257      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9258  }
9259
9260  protected DeviceDefinition.DeviceDefinitionSpecializationComponent parseDeviceDefinitionDeviceDefinitionSpecializationComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9261    DeviceDefinition.DeviceDefinitionSpecializationComponent res = new DeviceDefinition.DeviceDefinitionSpecializationComponent();
9262    parseDeviceDefinitionDeviceDefinitionSpecializationComponentProperties(json, owner, res);
9263    return res;
9264  }
9265
9266  protected void parseDeviceDefinitionDeviceDefinitionSpecializationComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionSpecializationComponent res) throws IOException, FHIRFormatError {
9267    parseBackboneElementProperties(json, res);
9268    if (json.has("systemType"))
9269      res.setSystemTypeElement(parseString(json.get("systemType").getAsString()));
9270    if (json.has("_systemType"))
9271      parseElementProperties(json.getAsJsonObject("_systemType"), res.getSystemTypeElement());
9272    if (json.has("version"))
9273      res.setVersionElement(parseString(json.get("version").getAsString()));
9274    if (json.has("_version"))
9275      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
9276  }
9277
9278  protected DeviceDefinition.DeviceDefinitionCapabilityComponent parseDeviceDefinitionDeviceDefinitionCapabilityComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9279    DeviceDefinition.DeviceDefinitionCapabilityComponent res = new DeviceDefinition.DeviceDefinitionCapabilityComponent();
9280    parseDeviceDefinitionDeviceDefinitionCapabilityComponentProperties(json, owner, res);
9281    return res;
9282  }
9283
9284  protected void parseDeviceDefinitionDeviceDefinitionCapabilityComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionCapabilityComponent res) throws IOException, FHIRFormatError {
9285    parseBackboneElementProperties(json, res);
9286    if (json.has("type"))
9287      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9288    if (json.has("description")) {
9289      JsonArray array = json.getAsJsonArray("description");
9290      for (int i = 0; i < array.size(); i++) {
9291        res.getDescription().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9292      }
9293    };
9294  }
9295
9296  protected DeviceDefinition.DeviceDefinitionPropertyComponent parseDeviceDefinitionDeviceDefinitionPropertyComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9297    DeviceDefinition.DeviceDefinitionPropertyComponent res = new DeviceDefinition.DeviceDefinitionPropertyComponent();
9298    parseDeviceDefinitionDeviceDefinitionPropertyComponentProperties(json, owner, res);
9299    return res;
9300  }
9301
9302  protected void parseDeviceDefinitionDeviceDefinitionPropertyComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionPropertyComponent res) throws IOException, FHIRFormatError {
9303    parseBackboneElementProperties(json, res);
9304    if (json.has("type"))
9305      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9306    if (json.has("valueQuantity")) {
9307      JsonArray array = json.getAsJsonArray("valueQuantity");
9308      for (int i = 0; i < array.size(); i++) {
9309        res.getValueQuantity().add(parseQuantity(array.get(i).getAsJsonObject()));
9310      }
9311    };
9312    if (json.has("valueCode")) {
9313      JsonArray array = json.getAsJsonArray("valueCode");
9314      for (int i = 0; i < array.size(); i++) {
9315        res.getValueCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9316      }
9317    };
9318  }
9319
9320  protected DeviceDefinition.DeviceDefinitionMaterialComponent parseDeviceDefinitionDeviceDefinitionMaterialComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9321    DeviceDefinition.DeviceDefinitionMaterialComponent res = new DeviceDefinition.DeviceDefinitionMaterialComponent();
9322    parseDeviceDefinitionDeviceDefinitionMaterialComponentProperties(json, owner, res);
9323    return res;
9324  }
9325
9326  protected void parseDeviceDefinitionDeviceDefinitionMaterialComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionMaterialComponent res) throws IOException, FHIRFormatError {
9327    parseBackboneElementProperties(json, res);
9328    if (json.has("substance"))
9329      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
9330    if (json.has("alternate"))
9331      res.setAlternateElement(parseBoolean(json.get("alternate").getAsBoolean()));
9332    if (json.has("_alternate"))
9333      parseElementProperties(json.getAsJsonObject("_alternate"), res.getAlternateElement());
9334    if (json.has("allergenicIndicator"))
9335      res.setAllergenicIndicatorElement(parseBoolean(json.get("allergenicIndicator").getAsBoolean()));
9336    if (json.has("_allergenicIndicator"))
9337      parseElementProperties(json.getAsJsonObject("_allergenicIndicator"), res.getAllergenicIndicatorElement());
9338  }
9339
9340  protected DeviceMetric parseDeviceMetric(JsonObject json) throws IOException, FHIRFormatError {
9341    DeviceMetric res = new DeviceMetric();
9342    parseDeviceMetricProperties(json, res);
9343    return res;
9344  }
9345
9346  protected void parseDeviceMetricProperties(JsonObject json, DeviceMetric res) throws IOException, FHIRFormatError {
9347    parseDomainResourceProperties(json, res);
9348    if (json.has("identifier")) {
9349      JsonArray array = json.getAsJsonArray("identifier");
9350      for (int i = 0; i < array.size(); i++) {
9351        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9352      }
9353    };
9354    if (json.has("type"))
9355      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9356    if (json.has("unit"))
9357      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
9358    if (json.has("source"))
9359      res.setSource(parseReference(json.getAsJsonObject("source")));
9360    if (json.has("parent"))
9361      res.setParent(parseReference(json.getAsJsonObject("parent")));
9362    if (json.has("operationalStatus"))
9363      res.setOperationalStatusElement(parseEnumeration(json.get("operationalStatus").getAsString(), DeviceMetric.DeviceMetricOperationalStatus.NULL, new DeviceMetric.DeviceMetricOperationalStatusEnumFactory()));
9364    if (json.has("_operationalStatus"))
9365      parseElementProperties(json.getAsJsonObject("_operationalStatus"), res.getOperationalStatusElement());
9366    if (json.has("color"))
9367      res.setColorElement(parseEnumeration(json.get("color").getAsString(), DeviceMetric.DeviceMetricColor.NULL, new DeviceMetric.DeviceMetricColorEnumFactory()));
9368    if (json.has("_color"))
9369      parseElementProperties(json.getAsJsonObject("_color"), res.getColorElement());
9370    if (json.has("category"))
9371      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), DeviceMetric.DeviceMetricCategory.NULL, new DeviceMetric.DeviceMetricCategoryEnumFactory()));
9372    if (json.has("_category"))
9373      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
9374    if (json.has("measurementPeriod"))
9375      res.setMeasurementPeriod(parseTiming(json.getAsJsonObject("measurementPeriod")));
9376    if (json.has("calibration")) {
9377      JsonArray array = json.getAsJsonArray("calibration");
9378      for (int i = 0; i < array.size(); i++) {
9379        res.getCalibration().add(parseDeviceMetricDeviceMetricCalibrationComponent(array.get(i).getAsJsonObject(), res));
9380      }
9381    };
9382  }
9383
9384  protected DeviceMetric.DeviceMetricCalibrationComponent parseDeviceMetricDeviceMetricCalibrationComponent(JsonObject json, DeviceMetric owner) throws IOException, FHIRFormatError {
9385    DeviceMetric.DeviceMetricCalibrationComponent res = new DeviceMetric.DeviceMetricCalibrationComponent();
9386    parseDeviceMetricDeviceMetricCalibrationComponentProperties(json, owner, res);
9387    return res;
9388  }
9389
9390  protected void parseDeviceMetricDeviceMetricCalibrationComponentProperties(JsonObject json, DeviceMetric owner, DeviceMetric.DeviceMetricCalibrationComponent res) throws IOException, FHIRFormatError {
9391    parseBackboneElementProperties(json, res);
9392    if (json.has("type"))
9393      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceMetric.DeviceMetricCalibrationType.NULL, new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory()));
9394    if (json.has("_type"))
9395      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9396    if (json.has("state"))
9397      res.setStateElement(parseEnumeration(json.get("state").getAsString(), DeviceMetric.DeviceMetricCalibrationState.NULL, new DeviceMetric.DeviceMetricCalibrationStateEnumFactory()));
9398    if (json.has("_state"))
9399      parseElementProperties(json.getAsJsonObject("_state"), res.getStateElement());
9400    if (json.has("time"))
9401      res.setTimeElement(parseInstant(json.get("time").getAsString()));
9402    if (json.has("_time"))
9403      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
9404  }
9405
9406  protected DeviceRequest parseDeviceRequest(JsonObject json) throws IOException, FHIRFormatError {
9407    DeviceRequest res = new DeviceRequest();
9408    parseDeviceRequestProperties(json, res);
9409    return res;
9410  }
9411
9412  protected void parseDeviceRequestProperties(JsonObject json, DeviceRequest res) throws IOException, FHIRFormatError {
9413    parseDomainResourceProperties(json, res);
9414    if (json.has("identifier")) {
9415      JsonArray array = json.getAsJsonArray("identifier");
9416      for (int i = 0; i < array.size(); i++) {
9417        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9418      }
9419    };
9420    if (json.has("instantiatesCanonical")) {
9421      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
9422      for (int i = 0; i < array.size(); i++) {
9423        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
9424      }
9425    };
9426    if (json.has("_instantiatesCanonical")) {
9427      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
9428      for (int i = 0; i < array.size(); i++) {
9429        if (i == res.getInstantiatesCanonical().size())
9430          res.getInstantiatesCanonical().add(parseCanonical(null));
9431        if (array.get(i) instanceof JsonObject) 
9432          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
9433      }
9434    };
9435    if (json.has("instantiatesUri")) {
9436      JsonArray array = json.getAsJsonArray("instantiatesUri");
9437      for (int i = 0; i < array.size(); i++) {
9438        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
9439      }
9440    };
9441    if (json.has("_instantiatesUri")) {
9442      JsonArray array = json.getAsJsonArray("_instantiatesUri");
9443      for (int i = 0; i < array.size(); i++) {
9444        if (i == res.getInstantiatesUri().size())
9445          res.getInstantiatesUri().add(parseUri(null));
9446        if (array.get(i) instanceof JsonObject) 
9447          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
9448      }
9449    };
9450    if (json.has("basedOn")) {
9451      JsonArray array = json.getAsJsonArray("basedOn");
9452      for (int i = 0; i < array.size(); i++) {
9453        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
9454      }
9455    };
9456    if (json.has("priorRequest")) {
9457      JsonArray array = json.getAsJsonArray("priorRequest");
9458      for (int i = 0; i < array.size(); i++) {
9459        res.getPriorRequest().add(parseReference(array.get(i).getAsJsonObject()));
9460      }
9461    };
9462    if (json.has("groupIdentifier"))
9463      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
9464    if (json.has("status"))
9465      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceRequest.DeviceRequestStatus.NULL, new DeviceRequest.DeviceRequestStatusEnumFactory()));
9466    if (json.has("_status"))
9467      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9468    if (json.has("intent"))
9469      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), DeviceRequest.RequestIntent.NULL, new DeviceRequest.RequestIntentEnumFactory()));
9470    if (json.has("_intent"))
9471      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
9472    if (json.has("priority"))
9473      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), DeviceRequest.RequestPriority.NULL, new DeviceRequest.RequestPriorityEnumFactory()));
9474    if (json.has("_priority"))
9475      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
9476    Type code = parseType("code", json);
9477    if (code != null)
9478      res.setCode(code);
9479    if (json.has("parameter")) {
9480      JsonArray array = json.getAsJsonArray("parameter");
9481      for (int i = 0; i < array.size(); i++) {
9482        res.getParameter().add(parseDeviceRequestDeviceRequestParameterComponent(array.get(i).getAsJsonObject(), res));
9483      }
9484    };
9485    if (json.has("subject"))
9486      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9487    if (json.has("encounter"))
9488      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
9489    Type occurrence = parseType("occurrence", json);
9490    if (occurrence != null)
9491      res.setOccurrence(occurrence);
9492    if (json.has("authoredOn"))
9493      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
9494    if (json.has("_authoredOn"))
9495      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
9496    if (json.has("requester"))
9497      res.setRequester(parseReference(json.getAsJsonObject("requester")));
9498    if (json.has("performerType"))
9499      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
9500    if (json.has("performer"))
9501      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
9502    if (json.has("reasonCode")) {
9503      JsonArray array = json.getAsJsonArray("reasonCode");
9504      for (int i = 0; i < array.size(); i++) {
9505        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9506      }
9507    };
9508    if (json.has("reasonReference")) {
9509      JsonArray array = json.getAsJsonArray("reasonReference");
9510      for (int i = 0; i < array.size(); i++) {
9511        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
9512      }
9513    };
9514    if (json.has("insurance")) {
9515      JsonArray array = json.getAsJsonArray("insurance");
9516      for (int i = 0; i < array.size(); i++) {
9517        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
9518      }
9519    };
9520    if (json.has("supportingInfo")) {
9521      JsonArray array = json.getAsJsonArray("supportingInfo");
9522      for (int i = 0; i < array.size(); i++) {
9523        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
9524      }
9525    };
9526    if (json.has("note")) {
9527      JsonArray array = json.getAsJsonArray("note");
9528      for (int i = 0; i < array.size(); i++) {
9529        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9530      }
9531    };
9532    if (json.has("relevantHistory")) {
9533      JsonArray array = json.getAsJsonArray("relevantHistory");
9534      for (int i = 0; i < array.size(); i++) {
9535        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
9536      }
9537    };
9538  }
9539
9540  protected DeviceRequest.DeviceRequestParameterComponent parseDeviceRequestDeviceRequestParameterComponent(JsonObject json, DeviceRequest owner) throws IOException, FHIRFormatError {
9541    DeviceRequest.DeviceRequestParameterComponent res = new DeviceRequest.DeviceRequestParameterComponent();
9542    parseDeviceRequestDeviceRequestParameterComponentProperties(json, owner, res);
9543    return res;
9544  }
9545
9546  protected void parseDeviceRequestDeviceRequestParameterComponentProperties(JsonObject json, DeviceRequest owner, DeviceRequest.DeviceRequestParameterComponent res) throws IOException, FHIRFormatError {
9547    parseBackboneElementProperties(json, res);
9548    if (json.has("code"))
9549      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
9550    Type value = parseType("value", json);
9551    if (value != null)
9552      res.setValue(value);
9553  }
9554
9555  protected DeviceUseStatement parseDeviceUseStatement(JsonObject json) throws IOException, FHIRFormatError {
9556    DeviceUseStatement res = new DeviceUseStatement();
9557    parseDeviceUseStatementProperties(json, res);
9558    return res;
9559  }
9560
9561  protected void parseDeviceUseStatementProperties(JsonObject json, DeviceUseStatement res) throws IOException, FHIRFormatError {
9562    parseDomainResourceProperties(json, res);
9563    if (json.has("identifier")) {
9564      JsonArray array = json.getAsJsonArray("identifier");
9565      for (int i = 0; i < array.size(); i++) {
9566        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9567      }
9568    };
9569    if (json.has("basedOn")) {
9570      JsonArray array = json.getAsJsonArray("basedOn");
9571      for (int i = 0; i < array.size(); i++) {
9572        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
9573      }
9574    };
9575    if (json.has("status"))
9576      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceUseStatement.DeviceUseStatementStatus.NULL, new DeviceUseStatement.DeviceUseStatementStatusEnumFactory()));
9577    if (json.has("_status"))
9578      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9579    if (json.has("subject"))
9580      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9581    if (json.has("derivedFrom")) {
9582      JsonArray array = json.getAsJsonArray("derivedFrom");
9583      for (int i = 0; i < array.size(); i++) {
9584        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
9585      }
9586    };
9587    Type timing = parseType("timing", json);
9588    if (timing != null)
9589      res.setTiming(timing);
9590    if (json.has("recordedOn"))
9591      res.setRecordedOnElement(parseDateTime(json.get("recordedOn").getAsString()));
9592    if (json.has("_recordedOn"))
9593      parseElementProperties(json.getAsJsonObject("_recordedOn"), res.getRecordedOnElement());
9594    if (json.has("source"))
9595      res.setSource(parseReference(json.getAsJsonObject("source")));
9596    if (json.has("device"))
9597      res.setDevice(parseReference(json.getAsJsonObject("device")));
9598    if (json.has("reasonCode")) {
9599      JsonArray array = json.getAsJsonArray("reasonCode");
9600      for (int i = 0; i < array.size(); i++) {
9601        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9602      }
9603    };
9604    if (json.has("reasonReference")) {
9605      JsonArray array = json.getAsJsonArray("reasonReference");
9606      for (int i = 0; i < array.size(); i++) {
9607        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
9608      }
9609    };
9610    if (json.has("bodySite"))
9611      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
9612    if (json.has("note")) {
9613      JsonArray array = json.getAsJsonArray("note");
9614      for (int i = 0; i < array.size(); i++) {
9615        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9616      }
9617    };
9618  }
9619
9620  protected DiagnosticReport parseDiagnosticReport(JsonObject json) throws IOException, FHIRFormatError {
9621    DiagnosticReport res = new DiagnosticReport();
9622    parseDiagnosticReportProperties(json, res);
9623    return res;
9624  }
9625
9626  protected void parseDiagnosticReportProperties(JsonObject json, DiagnosticReport res) throws IOException, FHIRFormatError {
9627    parseDomainResourceProperties(json, res);
9628    if (json.has("identifier")) {
9629      JsonArray array = json.getAsJsonArray("identifier");
9630      for (int i = 0; i < array.size(); i++) {
9631        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9632      }
9633    };
9634    if (json.has("basedOn")) {
9635      JsonArray array = json.getAsJsonArray("basedOn");
9636      for (int i = 0; i < array.size(); i++) {
9637        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
9638      }
9639    };
9640    if (json.has("status"))
9641      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticReport.DiagnosticReportStatus.NULL, new DiagnosticReport.DiagnosticReportStatusEnumFactory()));
9642    if (json.has("_status"))
9643      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9644    if (json.has("category")) {
9645      JsonArray array = json.getAsJsonArray("category");
9646      for (int i = 0; i < array.size(); i++) {
9647        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9648      }
9649    };
9650    if (json.has("code"))
9651      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
9652    if (json.has("subject"))
9653      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9654    if (json.has("encounter"))
9655      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
9656    Type effective = parseType("effective", json);
9657    if (effective != null)
9658      res.setEffective(effective);
9659    if (json.has("issued"))
9660      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
9661    if (json.has("_issued"))
9662      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
9663    if (json.has("performer")) {
9664      JsonArray array = json.getAsJsonArray("performer");
9665      for (int i = 0; i < array.size(); i++) {
9666        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
9667      }
9668    };
9669    if (json.has("resultsInterpreter")) {
9670      JsonArray array = json.getAsJsonArray("resultsInterpreter");
9671      for (int i = 0; i < array.size(); i++) {
9672        res.getResultsInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
9673      }
9674    };
9675    if (json.has("specimen")) {
9676      JsonArray array = json.getAsJsonArray("specimen");
9677      for (int i = 0; i < array.size(); i++) {
9678        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
9679      }
9680    };
9681    if (json.has("result")) {
9682      JsonArray array = json.getAsJsonArray("result");
9683      for (int i = 0; i < array.size(); i++) {
9684        res.getResult().add(parseReference(array.get(i).getAsJsonObject()));
9685      }
9686    };
9687    if (json.has("imagingStudy")) {
9688      JsonArray array = json.getAsJsonArray("imagingStudy");
9689      for (int i = 0; i < array.size(); i++) {
9690        res.getImagingStudy().add(parseReference(array.get(i).getAsJsonObject()));
9691      }
9692    };
9693    if (json.has("media")) {
9694      JsonArray array = json.getAsJsonArray("media");
9695      for (int i = 0; i < array.size(); i++) {
9696        res.getMedia().add(parseDiagnosticReportDiagnosticReportMediaComponent(array.get(i).getAsJsonObject(), res));
9697      }
9698    };
9699    if (json.has("conclusion"))
9700      res.setConclusionElement(parseString(json.get("conclusion").getAsString()));
9701    if (json.has("_conclusion"))
9702      parseElementProperties(json.getAsJsonObject("_conclusion"), res.getConclusionElement());
9703    if (json.has("conclusionCode")) {
9704      JsonArray array = json.getAsJsonArray("conclusionCode");
9705      for (int i = 0; i < array.size(); i++) {
9706        res.getConclusionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9707      }
9708    };
9709    if (json.has("presentedForm")) {
9710      JsonArray array = json.getAsJsonArray("presentedForm");
9711      for (int i = 0; i < array.size(); i++) {
9712        res.getPresentedForm().add(parseAttachment(array.get(i).getAsJsonObject()));
9713      }
9714    };
9715  }
9716
9717  protected DiagnosticReport.DiagnosticReportMediaComponent parseDiagnosticReportDiagnosticReportMediaComponent(JsonObject json, DiagnosticReport owner) throws IOException, FHIRFormatError {
9718    DiagnosticReport.DiagnosticReportMediaComponent res = new DiagnosticReport.DiagnosticReportMediaComponent();
9719    parseDiagnosticReportDiagnosticReportMediaComponentProperties(json, owner, res);
9720    return res;
9721  }
9722
9723  protected void parseDiagnosticReportDiagnosticReportMediaComponentProperties(JsonObject json, DiagnosticReport owner, DiagnosticReport.DiagnosticReportMediaComponent res) throws IOException, FHIRFormatError {
9724    parseBackboneElementProperties(json, res);
9725    if (json.has("comment"))
9726      res.setCommentElement(parseString(json.get("comment").getAsString()));
9727    if (json.has("_comment"))
9728      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
9729    if (json.has("link"))
9730      res.setLink(parseReference(json.getAsJsonObject("link")));
9731  }
9732
9733  protected DocumentManifest parseDocumentManifest(JsonObject json) throws IOException, FHIRFormatError {
9734    DocumentManifest res = new DocumentManifest();
9735    parseDocumentManifestProperties(json, res);
9736    return res;
9737  }
9738
9739  protected void parseDocumentManifestProperties(JsonObject json, DocumentManifest res) throws IOException, FHIRFormatError {
9740    parseDomainResourceProperties(json, res);
9741    if (json.has("masterIdentifier"))
9742      res.setMasterIdentifier(parseIdentifier(json.getAsJsonObject("masterIdentifier")));
9743    if (json.has("identifier")) {
9744      JsonArray array = json.getAsJsonArray("identifier");
9745      for (int i = 0; i < array.size(); i++) {
9746        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9747      }
9748    };
9749    if (json.has("status"))
9750      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
9751    if (json.has("_status"))
9752      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9753    if (json.has("type"))
9754      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9755    if (json.has("subject"))
9756      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9757    if (json.has("created"))
9758      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
9759    if (json.has("_created"))
9760      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
9761    if (json.has("author")) {
9762      JsonArray array = json.getAsJsonArray("author");
9763      for (int i = 0; i < array.size(); i++) {
9764        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
9765      }
9766    };
9767    if (json.has("recipient")) {
9768      JsonArray array = json.getAsJsonArray("recipient");
9769      for (int i = 0; i < array.size(); i++) {
9770        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
9771      }
9772    };
9773    if (json.has("source"))
9774      res.setSourceElement(parseUri(json.get("source").getAsString()));
9775    if (json.has("_source"))
9776      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
9777    if (json.has("description"))
9778      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9779    if (json.has("_description"))
9780      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9781    if (json.has("content")) {
9782      JsonArray array = json.getAsJsonArray("content");
9783      for (int i = 0; i < array.size(); i++) {
9784        res.getContent().add(parseReference(array.get(i).getAsJsonObject()));
9785      }
9786    };
9787    if (json.has("related")) {
9788      JsonArray array = json.getAsJsonArray("related");
9789      for (int i = 0; i < array.size(); i++) {
9790        res.getRelated().add(parseDocumentManifestDocumentManifestRelatedComponent(array.get(i).getAsJsonObject(), res));
9791      }
9792    };
9793  }
9794
9795  protected DocumentManifest.DocumentManifestRelatedComponent parseDocumentManifestDocumentManifestRelatedComponent(JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
9796    DocumentManifest.DocumentManifestRelatedComponent res = new DocumentManifest.DocumentManifestRelatedComponent();
9797    parseDocumentManifestDocumentManifestRelatedComponentProperties(json, owner, res);
9798    return res;
9799  }
9800
9801  protected void parseDocumentManifestDocumentManifestRelatedComponentProperties(JsonObject json, DocumentManifest owner, DocumentManifest.DocumentManifestRelatedComponent res) throws IOException, FHIRFormatError {
9802    parseBackboneElementProperties(json, res);
9803    if (json.has("identifier"))
9804      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
9805    if (json.has("ref"))
9806      res.setRef(parseReference(json.getAsJsonObject("ref")));
9807  }
9808
9809  protected DocumentReference parseDocumentReference(JsonObject json) throws IOException, FHIRFormatError {
9810    DocumentReference res = new DocumentReference();
9811    parseDocumentReferenceProperties(json, res);
9812    return res;
9813  }
9814
9815  protected void parseDocumentReferenceProperties(JsonObject json, DocumentReference res) throws IOException, FHIRFormatError {
9816    parseDomainResourceProperties(json, res);
9817    if (json.has("masterIdentifier"))
9818      res.setMasterIdentifier(parseIdentifier(json.getAsJsonObject("masterIdentifier")));
9819    if (json.has("identifier")) {
9820      JsonArray array = json.getAsJsonArray("identifier");
9821      for (int i = 0; i < array.size(); i++) {
9822        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9823      }
9824    };
9825    if (json.has("status"))
9826      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
9827    if (json.has("_status"))
9828      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9829    if (json.has("docStatus"))
9830      res.setDocStatusElement(parseEnumeration(json.get("docStatus").getAsString(), DocumentReference.ReferredDocumentStatus.NULL, new DocumentReference.ReferredDocumentStatusEnumFactory()));
9831    if (json.has("_docStatus"))
9832      parseElementProperties(json.getAsJsonObject("_docStatus"), res.getDocStatusElement());
9833    if (json.has("type"))
9834      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9835    if (json.has("category")) {
9836      JsonArray array = json.getAsJsonArray("category");
9837      for (int i = 0; i < array.size(); i++) {
9838        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9839      }
9840    };
9841    if (json.has("subject"))
9842      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9843    if (json.has("date"))
9844      res.setDateElement(parseInstant(json.get("date").getAsString()));
9845    if (json.has("_date"))
9846      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9847    if (json.has("author")) {
9848      JsonArray array = json.getAsJsonArray("author");
9849      for (int i = 0; i < array.size(); i++) {
9850        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
9851      }
9852    };
9853    if (json.has("authenticator"))
9854      res.setAuthenticator(parseReference(json.getAsJsonObject("authenticator")));
9855    if (json.has("custodian"))
9856      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
9857    if (json.has("relatesTo")) {
9858      JsonArray array = json.getAsJsonArray("relatesTo");
9859      for (int i = 0; i < array.size(); i++) {
9860        res.getRelatesTo().add(parseDocumentReferenceDocumentReferenceRelatesToComponent(array.get(i).getAsJsonObject(), res));
9861      }
9862    };
9863    if (json.has("description"))
9864      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9865    if (json.has("_description"))
9866      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9867    if (json.has("securityLabel")) {
9868      JsonArray array = json.getAsJsonArray("securityLabel");
9869      for (int i = 0; i < array.size(); i++) {
9870        res.getSecurityLabel().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9871      }
9872    };
9873    if (json.has("content")) {
9874      JsonArray array = json.getAsJsonArray("content");
9875      for (int i = 0; i < array.size(); i++) {
9876        res.getContent().add(parseDocumentReferenceDocumentReferenceContentComponent(array.get(i).getAsJsonObject(), res));
9877      }
9878    };
9879    if (json.has("context"))
9880      res.setContext(parseDocumentReferenceDocumentReferenceContextComponent(json.getAsJsonObject("context"), res));
9881  }
9882
9883  protected DocumentReference.DocumentReferenceRelatesToComponent parseDocumentReferenceDocumentReferenceRelatesToComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
9884    DocumentReference.DocumentReferenceRelatesToComponent res = new DocumentReference.DocumentReferenceRelatesToComponent();
9885    parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(json, owner, res);
9886    return res;
9887  }
9888
9889  protected void parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceRelatesToComponent res) throws IOException, FHIRFormatError {
9890    parseBackboneElementProperties(json, res);
9891    if (json.has("code"))
9892      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), DocumentReference.DocumentRelationshipType.NULL, new DocumentReference.DocumentRelationshipTypeEnumFactory()));
9893    if (json.has("_code"))
9894      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
9895    if (json.has("target"))
9896      res.setTarget(parseReference(json.getAsJsonObject("target")));
9897  }
9898
9899  protected DocumentReference.DocumentReferenceContentComponent parseDocumentReferenceDocumentReferenceContentComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
9900    DocumentReference.DocumentReferenceContentComponent res = new DocumentReference.DocumentReferenceContentComponent();
9901    parseDocumentReferenceDocumentReferenceContentComponentProperties(json, owner, res);
9902    return res;
9903  }
9904
9905  protected void parseDocumentReferenceDocumentReferenceContentComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContentComponent res) throws IOException, FHIRFormatError {
9906    parseBackboneElementProperties(json, res);
9907    if (json.has("attachment"))
9908      res.setAttachment(parseAttachment(json.getAsJsonObject("attachment")));
9909    if (json.has("format"))
9910      res.setFormat(parseCoding(json.getAsJsonObject("format")));
9911  }
9912
9913  protected DocumentReference.DocumentReferenceContextComponent parseDocumentReferenceDocumentReferenceContextComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
9914    DocumentReference.DocumentReferenceContextComponent res = new DocumentReference.DocumentReferenceContextComponent();
9915    parseDocumentReferenceDocumentReferenceContextComponentProperties(json, owner, res);
9916    return res;
9917  }
9918
9919  protected void parseDocumentReferenceDocumentReferenceContextComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContextComponent res) throws IOException, FHIRFormatError {
9920    parseBackboneElementProperties(json, res);
9921    if (json.has("encounter")) {
9922      JsonArray array = json.getAsJsonArray("encounter");
9923      for (int i = 0; i < array.size(); i++) {
9924        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
9925      }
9926    };
9927    if (json.has("event")) {
9928      JsonArray array = json.getAsJsonArray("event");
9929      for (int i = 0; i < array.size(); i++) {
9930        res.getEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9931      }
9932    };
9933    if (json.has("period"))
9934      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
9935    if (json.has("facilityType"))
9936      res.setFacilityType(parseCodeableConcept(json.getAsJsonObject("facilityType")));
9937    if (json.has("practiceSetting"))
9938      res.setPracticeSetting(parseCodeableConcept(json.getAsJsonObject("practiceSetting")));
9939    if (json.has("sourcePatientInfo"))
9940      res.setSourcePatientInfo(parseReference(json.getAsJsonObject("sourcePatientInfo")));
9941    if (json.has("related")) {
9942      JsonArray array = json.getAsJsonArray("related");
9943      for (int i = 0; i < array.size(); i++) {
9944        res.getRelated().add(parseReference(array.get(i).getAsJsonObject()));
9945      }
9946    };
9947  }
9948
9949  protected EffectEvidenceSynthesis parseEffectEvidenceSynthesis(JsonObject json) throws IOException, FHIRFormatError {
9950    EffectEvidenceSynthesis res = new EffectEvidenceSynthesis();
9951    parseEffectEvidenceSynthesisProperties(json, res);
9952    return res;
9953  }
9954
9955  protected void parseEffectEvidenceSynthesisProperties(JsonObject json, EffectEvidenceSynthesis res) throws IOException, FHIRFormatError {
9956    parseDomainResourceProperties(json, res);
9957    if (json.has("url"))
9958      res.setUrlElement(parseUri(json.get("url").getAsString()));
9959    if (json.has("_url"))
9960      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
9961    if (json.has("identifier")) {
9962      JsonArray array = json.getAsJsonArray("identifier");
9963      for (int i = 0; i < array.size(); i++) {
9964        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9965      }
9966    };
9967    if (json.has("version"))
9968      res.setVersionElement(parseString(json.get("version").getAsString()));
9969    if (json.has("_version"))
9970      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
9971    if (json.has("name"))
9972      res.setNameElement(parseString(json.get("name").getAsString()));
9973    if (json.has("_name"))
9974      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9975    if (json.has("title"))
9976      res.setTitleElement(parseString(json.get("title").getAsString()));
9977    if (json.has("_title"))
9978      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
9979    if (json.has("status"))
9980      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
9981    if (json.has("_status"))
9982      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9983    if (json.has("date"))
9984      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9985    if (json.has("_date"))
9986      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9987    if (json.has("publisher"))
9988      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
9989    if (json.has("_publisher"))
9990      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
9991    if (json.has("contact")) {
9992      JsonArray array = json.getAsJsonArray("contact");
9993      for (int i = 0; i < array.size(); i++) {
9994        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
9995      }
9996    };
9997    if (json.has("description"))
9998      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
9999    if (json.has("_description"))
10000      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10001    if (json.has("note")) {
10002      JsonArray array = json.getAsJsonArray("note");
10003      for (int i = 0; i < array.size(); i++) {
10004        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10005      }
10006    };
10007    if (json.has("useContext")) {
10008      JsonArray array = json.getAsJsonArray("useContext");
10009      for (int i = 0; i < array.size(); i++) {
10010        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
10011      }
10012    };
10013    if (json.has("jurisdiction")) {
10014      JsonArray array = json.getAsJsonArray("jurisdiction");
10015      for (int i = 0; i < array.size(); i++) {
10016        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10017      }
10018    };
10019    if (json.has("copyright"))
10020      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
10021    if (json.has("_copyright"))
10022      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
10023    if (json.has("approvalDate"))
10024      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
10025    if (json.has("_approvalDate"))
10026      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
10027    if (json.has("lastReviewDate"))
10028      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
10029    if (json.has("_lastReviewDate"))
10030      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
10031    if (json.has("effectivePeriod"))
10032      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
10033    if (json.has("topic")) {
10034      JsonArray array = json.getAsJsonArray("topic");
10035      for (int i = 0; i < array.size(); i++) {
10036        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10037      }
10038    };
10039    if (json.has("author")) {
10040      JsonArray array = json.getAsJsonArray("author");
10041      for (int i = 0; i < array.size(); i++) {
10042        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
10043      }
10044    };
10045    if (json.has("editor")) {
10046      JsonArray array = json.getAsJsonArray("editor");
10047      for (int i = 0; i < array.size(); i++) {
10048        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
10049      }
10050    };
10051    if (json.has("reviewer")) {
10052      JsonArray array = json.getAsJsonArray("reviewer");
10053      for (int i = 0; i < array.size(); i++) {
10054        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
10055      }
10056    };
10057    if (json.has("endorser")) {
10058      JsonArray array = json.getAsJsonArray("endorser");
10059      for (int i = 0; i < array.size(); i++) {
10060        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
10061      }
10062    };
10063    if (json.has("relatedArtifact")) {
10064      JsonArray array = json.getAsJsonArray("relatedArtifact");
10065      for (int i = 0; i < array.size(); i++) {
10066        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
10067      }
10068    };
10069    if (json.has("synthesisType"))
10070      res.setSynthesisType(parseCodeableConcept(json.getAsJsonObject("synthesisType")));
10071    if (json.has("studyType"))
10072      res.setStudyType(parseCodeableConcept(json.getAsJsonObject("studyType")));
10073    if (json.has("population"))
10074      res.setPopulation(parseReference(json.getAsJsonObject("population")));
10075    if (json.has("exposure"))
10076      res.setExposure(parseReference(json.getAsJsonObject("exposure")));
10077    if (json.has("exposureAlternative"))
10078      res.setExposureAlternative(parseReference(json.getAsJsonObject("exposureAlternative")));
10079    if (json.has("outcome"))
10080      res.setOutcome(parseReference(json.getAsJsonObject("outcome")));
10081    if (json.has("sampleSize"))
10082      res.setSampleSize(parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent(json.getAsJsonObject("sampleSize"), res));
10083    if (json.has("resultsByExposure")) {
10084      JsonArray array = json.getAsJsonArray("resultsByExposure");
10085      for (int i = 0; i < array.size(); i++) {
10086        res.getResultsByExposure().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(array.get(i).getAsJsonObject(), res));
10087      }
10088    };
10089    if (json.has("effectEstimate")) {
10090      JsonArray array = json.getAsJsonArray("effectEstimate");
10091      for (int i = 0; i < array.size(); i++) {
10092        res.getEffectEstimate().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(array.get(i).getAsJsonObject(), res));
10093      }
10094    };
10095    if (json.has("certainty")) {
10096      JsonArray array = json.getAsJsonArray("certainty");
10097      for (int i = 0; i < array.size(); i++) {
10098        res.getCertainty().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(array.get(i).getAsJsonObject(), res));
10099      }
10100    };
10101  }
10102
10103  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10104    EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent();
10105    parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentProperties(json, owner, res);
10106    return res;
10107  }
10108
10109  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent res) throws IOException, FHIRFormatError {
10110    parseBackboneElementProperties(json, res);
10111    if (json.has("description"))
10112      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10113    if (json.has("_description"))
10114      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10115    if (json.has("numberOfStudies"))
10116      res.setNumberOfStudiesElement(parseInteger(json.get("numberOfStudies").getAsLong()));
10117    if (json.has("_numberOfStudies"))
10118      parseElementProperties(json.getAsJsonObject("_numberOfStudies"), res.getNumberOfStudiesElement());
10119    if (json.has("numberOfParticipants"))
10120      res.setNumberOfParticipantsElement(parseInteger(json.get("numberOfParticipants").getAsLong()));
10121    if (json.has("_numberOfParticipants"))
10122      parseElementProperties(json.getAsJsonObject("_numberOfParticipants"), res.getNumberOfParticipantsElement());
10123  }
10124
10125  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10126    EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent();
10127    parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentProperties(json, owner, res);
10128    return res;
10129  }
10130
10131  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent res) throws IOException, FHIRFormatError {
10132    parseBackboneElementProperties(json, res);
10133    if (json.has("description"))
10134      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10135    if (json.has("_description"))
10136      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10137    if (json.has("exposureState"))
10138      res.setExposureStateElement(parseEnumeration(json.get("exposureState").getAsString(), EffectEvidenceSynthesis.ExposureState.NULL, new EffectEvidenceSynthesis.ExposureStateEnumFactory()));
10139    if (json.has("_exposureState"))
10140      parseElementProperties(json.getAsJsonObject("_exposureState"), res.getExposureStateElement());
10141    if (json.has("variantState"))
10142      res.setVariantState(parseCodeableConcept(json.getAsJsonObject("variantState")));
10143    if (json.has("riskEvidenceSynthesis"))
10144      res.setRiskEvidenceSynthesis(parseReference(json.getAsJsonObject("riskEvidenceSynthesis")));
10145  }
10146
10147  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10148    EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent();
10149    parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentProperties(json, owner, res);
10150    return res;
10151  }
10152
10153  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent res) throws IOException, FHIRFormatError {
10154    parseBackboneElementProperties(json, res);
10155    if (json.has("description"))
10156      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10157    if (json.has("_description"))
10158      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10159    if (json.has("type"))
10160      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10161    if (json.has("variantState"))
10162      res.setVariantState(parseCodeableConcept(json.getAsJsonObject("variantState")));
10163    if (json.has("value"))
10164      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
10165    if (json.has("_value"))
10166      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
10167    if (json.has("unitOfMeasure"))
10168      res.setUnitOfMeasure(parseCodeableConcept(json.getAsJsonObject("unitOfMeasure")));
10169    if (json.has("precisionEstimate")) {
10170      JsonArray array = json.getAsJsonArray("precisionEstimate");
10171      for (int i = 0; i < array.size(); i++) {
10172        res.getPrecisionEstimate().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(array.get(i).getAsJsonObject(), owner));
10173      }
10174    };
10175  }
10176
10177  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10178    EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent();
10179    parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentProperties(json, owner, res);
10180    return res;
10181  }
10182
10183  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent res) throws IOException, FHIRFormatError {
10184    parseBackboneElementProperties(json, res);
10185    if (json.has("type"))
10186      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10187    if (json.has("level"))
10188      res.setLevelElement(parseDecimal(json.get("level").getAsBigDecimal()));
10189    if (json.has("_level"))
10190      parseElementProperties(json.getAsJsonObject("_level"), res.getLevelElement());
10191    if (json.has("from"))
10192      res.setFromElement(parseDecimal(json.get("from").getAsBigDecimal()));
10193    if (json.has("_from"))
10194      parseElementProperties(json.getAsJsonObject("_from"), res.getFromElement());
10195    if (json.has("to"))
10196      res.setToElement(parseDecimal(json.get("to").getAsBigDecimal()));
10197    if (json.has("_to"))
10198      parseElementProperties(json.getAsJsonObject("_to"), res.getToElement());
10199  }
10200
10201  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10202    EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent();
10203    parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentProperties(json, owner, res);
10204    return res;
10205  }
10206
10207  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent res) throws IOException, FHIRFormatError {
10208    parseBackboneElementProperties(json, res);
10209    if (json.has("rating")) {
10210      JsonArray array = json.getAsJsonArray("rating");
10211      for (int i = 0; i < array.size(); i++) {
10212        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10213      }
10214    };
10215    if (json.has("note")) {
10216      JsonArray array = json.getAsJsonArray("note");
10217      for (int i = 0; i < array.size(); i++) {
10218        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10219      }
10220    };
10221    if (json.has("certaintySubcomponent")) {
10222      JsonArray array = json.getAsJsonArray("certaintySubcomponent");
10223      for (int i = 0; i < array.size(); i++) {
10224        res.getCertaintySubcomponent().add(parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(array.get(i).getAsJsonObject(), owner));
10225      }
10226    };
10227  }
10228
10229  protected EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(JsonObject json, EffectEvidenceSynthesis owner) throws IOException, FHIRFormatError {
10230    EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent res = new EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent();
10231    parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentProperties(json, owner, res);
10232    return res;
10233  }
10234
10235  protected void parseEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentProperties(JsonObject json, EffectEvidenceSynthesis owner, EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent res) throws IOException, FHIRFormatError {
10236    parseBackboneElementProperties(json, res);
10237    if (json.has("type"))
10238      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10239    if (json.has("rating")) {
10240      JsonArray array = json.getAsJsonArray("rating");
10241      for (int i = 0; i < array.size(); i++) {
10242        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10243      }
10244    };
10245    if (json.has("note")) {
10246      JsonArray array = json.getAsJsonArray("note");
10247      for (int i = 0; i < array.size(); i++) {
10248        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10249      }
10250    };
10251  }
10252
10253  protected Encounter parseEncounter(JsonObject json) throws IOException, FHIRFormatError {
10254    Encounter res = new Encounter();
10255    parseEncounterProperties(json, res);
10256    return res;
10257  }
10258
10259  protected void parseEncounterProperties(JsonObject json, Encounter res) throws IOException, FHIRFormatError {
10260    parseDomainResourceProperties(json, res);
10261    if (json.has("identifier")) {
10262      JsonArray array = json.getAsJsonArray("identifier");
10263      for (int i = 0; i < array.size(); i++) {
10264        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10265      }
10266    };
10267    if (json.has("status"))
10268      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
10269    if (json.has("_status"))
10270      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10271    if (json.has("statusHistory")) {
10272      JsonArray array = json.getAsJsonArray("statusHistory");
10273      for (int i = 0; i < array.size(); i++) {
10274        res.getStatusHistory().add(parseEncounterStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
10275      }
10276    };
10277    if (json.has("class"))
10278      res.setClass_(parseCoding(json.getAsJsonObject("class")));
10279    if (json.has("classHistory")) {
10280      JsonArray array = json.getAsJsonArray("classHistory");
10281      for (int i = 0; i < array.size(); i++) {
10282        res.getClassHistory().add(parseEncounterClassHistoryComponent(array.get(i).getAsJsonObject(), res));
10283      }
10284    };
10285    if (json.has("type")) {
10286      JsonArray array = json.getAsJsonArray("type");
10287      for (int i = 0; i < array.size(); i++) {
10288        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10289      }
10290    };
10291    if (json.has("serviceType"))
10292      res.setServiceType(parseCodeableConcept(json.getAsJsonObject("serviceType")));
10293    if (json.has("priority"))
10294      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
10295    if (json.has("subject"))
10296      res.setSubject(parseReference(json.getAsJsonObject("subject")));
10297    if (json.has("episodeOfCare")) {
10298      JsonArray array = json.getAsJsonArray("episodeOfCare");
10299      for (int i = 0; i < array.size(); i++) {
10300        res.getEpisodeOfCare().add(parseReference(array.get(i).getAsJsonObject()));
10301      }
10302    };
10303    if (json.has("basedOn")) {
10304      JsonArray array = json.getAsJsonArray("basedOn");
10305      for (int i = 0; i < array.size(); i++) {
10306        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
10307      }
10308    };
10309    if (json.has("participant")) {
10310      JsonArray array = json.getAsJsonArray("participant");
10311      for (int i = 0; i < array.size(); i++) {
10312        res.getParticipant().add(parseEncounterEncounterParticipantComponent(array.get(i).getAsJsonObject(), res));
10313      }
10314    };
10315    if (json.has("appointment")) {
10316      JsonArray array = json.getAsJsonArray("appointment");
10317      for (int i = 0; i < array.size(); i++) {
10318        res.getAppointment().add(parseReference(array.get(i).getAsJsonObject()));
10319      }
10320    };
10321    if (json.has("period"))
10322      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10323    if (json.has("length"))
10324      res.setLength(parseDuration(json.getAsJsonObject("length")));
10325    if (json.has("reasonCode")) {
10326      JsonArray array = json.getAsJsonArray("reasonCode");
10327      for (int i = 0; i < array.size(); i++) {
10328        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10329      }
10330    };
10331    if (json.has("reasonReference")) {
10332      JsonArray array = json.getAsJsonArray("reasonReference");
10333      for (int i = 0; i < array.size(); i++) {
10334        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
10335      }
10336    };
10337    if (json.has("diagnosis")) {
10338      JsonArray array = json.getAsJsonArray("diagnosis");
10339      for (int i = 0; i < array.size(); i++) {
10340        res.getDiagnosis().add(parseEncounterDiagnosisComponent(array.get(i).getAsJsonObject(), res));
10341      }
10342    };
10343    if (json.has("account")) {
10344      JsonArray array = json.getAsJsonArray("account");
10345      for (int i = 0; i < array.size(); i++) {
10346        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
10347      }
10348    };
10349    if (json.has("hospitalization"))
10350      res.setHospitalization(parseEncounterEncounterHospitalizationComponent(json.getAsJsonObject("hospitalization"), res));
10351    if (json.has("location")) {
10352      JsonArray array = json.getAsJsonArray("location");
10353      for (int i = 0; i < array.size(); i++) {
10354        res.getLocation().add(parseEncounterEncounterLocationComponent(array.get(i).getAsJsonObject(), res));
10355      }
10356    };
10357    if (json.has("serviceProvider"))
10358      res.setServiceProvider(parseReference(json.getAsJsonObject("serviceProvider")));
10359    if (json.has("partOf"))
10360      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
10361  }
10362
10363  protected Encounter.StatusHistoryComponent parseEncounterStatusHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10364    Encounter.StatusHistoryComponent res = new Encounter.StatusHistoryComponent();
10365    parseEncounterStatusHistoryComponentProperties(json, owner, res);
10366    return res;
10367  }
10368
10369  protected void parseEncounterStatusHistoryComponentProperties(JsonObject json, Encounter owner, Encounter.StatusHistoryComponent res) throws IOException, FHIRFormatError {
10370    parseBackboneElementProperties(json, res);
10371    if (json.has("status"))
10372      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
10373    if (json.has("_status"))
10374      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10375    if (json.has("period"))
10376      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10377  }
10378
10379  protected Encounter.ClassHistoryComponent parseEncounterClassHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10380    Encounter.ClassHistoryComponent res = new Encounter.ClassHistoryComponent();
10381    parseEncounterClassHistoryComponentProperties(json, owner, res);
10382    return res;
10383  }
10384
10385  protected void parseEncounterClassHistoryComponentProperties(JsonObject json, Encounter owner, Encounter.ClassHistoryComponent res) throws IOException, FHIRFormatError {
10386    parseBackboneElementProperties(json, res);
10387    if (json.has("class"))
10388      res.setClass_(parseCoding(json.getAsJsonObject("class")));
10389    if (json.has("period"))
10390      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10391  }
10392
10393  protected Encounter.EncounterParticipantComponent parseEncounterEncounterParticipantComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10394    Encounter.EncounterParticipantComponent res = new Encounter.EncounterParticipantComponent();
10395    parseEncounterEncounterParticipantComponentProperties(json, owner, res);
10396    return res;
10397  }
10398
10399  protected void parseEncounterEncounterParticipantComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterParticipantComponent res) throws IOException, FHIRFormatError {
10400    parseBackboneElementProperties(json, res);
10401    if (json.has("type")) {
10402      JsonArray array = json.getAsJsonArray("type");
10403      for (int i = 0; i < array.size(); i++) {
10404        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10405      }
10406    };
10407    if (json.has("period"))
10408      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10409    if (json.has("individual"))
10410      res.setIndividual(parseReference(json.getAsJsonObject("individual")));
10411  }
10412
10413  protected Encounter.DiagnosisComponent parseEncounterDiagnosisComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10414    Encounter.DiagnosisComponent res = new Encounter.DiagnosisComponent();
10415    parseEncounterDiagnosisComponentProperties(json, owner, res);
10416    return res;
10417  }
10418
10419  protected void parseEncounterDiagnosisComponentProperties(JsonObject json, Encounter owner, Encounter.DiagnosisComponent res) throws IOException, FHIRFormatError {
10420    parseBackboneElementProperties(json, res);
10421    if (json.has("condition"))
10422      res.setCondition(parseReference(json.getAsJsonObject("condition")));
10423    if (json.has("use"))
10424      res.setUse(parseCodeableConcept(json.getAsJsonObject("use")));
10425    if (json.has("rank"))
10426      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
10427    if (json.has("_rank"))
10428      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
10429  }
10430
10431  protected Encounter.EncounterHospitalizationComponent parseEncounterEncounterHospitalizationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10432    Encounter.EncounterHospitalizationComponent res = new Encounter.EncounterHospitalizationComponent();
10433    parseEncounterEncounterHospitalizationComponentProperties(json, owner, res);
10434    return res;
10435  }
10436
10437  protected void parseEncounterEncounterHospitalizationComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterHospitalizationComponent res) throws IOException, FHIRFormatError {
10438    parseBackboneElementProperties(json, res);
10439    if (json.has("preAdmissionIdentifier"))
10440      res.setPreAdmissionIdentifier(parseIdentifier(json.getAsJsonObject("preAdmissionIdentifier")));
10441    if (json.has("origin"))
10442      res.setOrigin(parseReference(json.getAsJsonObject("origin")));
10443    if (json.has("admitSource"))
10444      res.setAdmitSource(parseCodeableConcept(json.getAsJsonObject("admitSource")));
10445    if (json.has("reAdmission"))
10446      res.setReAdmission(parseCodeableConcept(json.getAsJsonObject("reAdmission")));
10447    if (json.has("dietPreference")) {
10448      JsonArray array = json.getAsJsonArray("dietPreference");
10449      for (int i = 0; i < array.size(); i++) {
10450        res.getDietPreference().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10451      }
10452    };
10453    if (json.has("specialCourtesy")) {
10454      JsonArray array = json.getAsJsonArray("specialCourtesy");
10455      for (int i = 0; i < array.size(); i++) {
10456        res.getSpecialCourtesy().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10457      }
10458    };
10459    if (json.has("specialArrangement")) {
10460      JsonArray array = json.getAsJsonArray("specialArrangement");
10461      for (int i = 0; i < array.size(); i++) {
10462        res.getSpecialArrangement().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10463      }
10464    };
10465    if (json.has("destination"))
10466      res.setDestination(parseReference(json.getAsJsonObject("destination")));
10467    if (json.has("dischargeDisposition"))
10468      res.setDischargeDisposition(parseCodeableConcept(json.getAsJsonObject("dischargeDisposition")));
10469  }
10470
10471  protected Encounter.EncounterLocationComponent parseEncounterEncounterLocationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10472    Encounter.EncounterLocationComponent res = new Encounter.EncounterLocationComponent();
10473    parseEncounterEncounterLocationComponentProperties(json, owner, res);
10474    return res;
10475  }
10476
10477  protected void parseEncounterEncounterLocationComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterLocationComponent res) throws IOException, FHIRFormatError {
10478    parseBackboneElementProperties(json, res);
10479    if (json.has("location"))
10480      res.setLocation(parseReference(json.getAsJsonObject("location")));
10481    if (json.has("status"))
10482      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterLocationStatus.NULL, new Encounter.EncounterLocationStatusEnumFactory()));
10483    if (json.has("_status"))
10484      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10485    if (json.has("physicalType"))
10486      res.setPhysicalType(parseCodeableConcept(json.getAsJsonObject("physicalType")));
10487    if (json.has("period"))
10488      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10489  }
10490
10491  protected Endpoint parseEndpoint(JsonObject json) throws IOException, FHIRFormatError {
10492    Endpoint res = new Endpoint();
10493    parseEndpointProperties(json, res);
10494    return res;
10495  }
10496
10497  protected void parseEndpointProperties(JsonObject json, Endpoint res) throws IOException, FHIRFormatError {
10498    parseDomainResourceProperties(json, res);
10499    if (json.has("identifier")) {
10500      JsonArray array = json.getAsJsonArray("identifier");
10501      for (int i = 0; i < array.size(); i++) {
10502        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10503      }
10504    };
10505    if (json.has("status"))
10506      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Endpoint.EndpointStatus.NULL, new Endpoint.EndpointStatusEnumFactory()));
10507    if (json.has("_status"))
10508      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10509    if (json.has("connectionType"))
10510      res.setConnectionType(parseCoding(json.getAsJsonObject("connectionType")));
10511    if (json.has("name"))
10512      res.setNameElement(parseString(json.get("name").getAsString()));
10513    if (json.has("_name"))
10514      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10515    if (json.has("managingOrganization"))
10516      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
10517    if (json.has("contact")) {
10518      JsonArray array = json.getAsJsonArray("contact");
10519      for (int i = 0; i < array.size(); i++) {
10520        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
10521      }
10522    };
10523    if (json.has("period"))
10524      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10525    if (json.has("payloadType")) {
10526      JsonArray array = json.getAsJsonArray("payloadType");
10527      for (int i = 0; i < array.size(); i++) {
10528        res.getPayloadType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10529      }
10530    };
10531    if (json.has("payloadMimeType")) {
10532      JsonArray array = json.getAsJsonArray("payloadMimeType");
10533      for (int i = 0; i < array.size(); i++) {
10534        res.getPayloadMimeType().add(parseCode(array.get(i).getAsString()));
10535      }
10536    };
10537    if (json.has("_payloadMimeType")) {
10538      JsonArray array = json.getAsJsonArray("_payloadMimeType");
10539      for (int i = 0; i < array.size(); i++) {
10540        if (i == res.getPayloadMimeType().size())
10541          res.getPayloadMimeType().add(parseCode(null));
10542        if (array.get(i) instanceof JsonObject) 
10543          parseElementProperties(array.get(i).getAsJsonObject(), res.getPayloadMimeType().get(i));
10544      }
10545    };
10546    if (json.has("address"))
10547      res.setAddressElement(parseUrl(json.get("address").getAsString()));
10548    if (json.has("_address"))
10549      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
10550    if (json.has("header")) {
10551      JsonArray array = json.getAsJsonArray("header");
10552      for (int i = 0; i < array.size(); i++) {
10553        res.getHeader().add(parseString(array.get(i).getAsString()));
10554      }
10555    };
10556    if (json.has("_header")) {
10557      JsonArray array = json.getAsJsonArray("_header");
10558      for (int i = 0; i < array.size(); i++) {
10559        if (i == res.getHeader().size())
10560          res.getHeader().add(parseString(null));
10561        if (array.get(i) instanceof JsonObject) 
10562          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
10563      }
10564    };
10565  }
10566
10567  protected EnrollmentRequest parseEnrollmentRequest(JsonObject json) throws IOException, FHIRFormatError {
10568    EnrollmentRequest res = new EnrollmentRequest();
10569    parseEnrollmentRequestProperties(json, res);
10570    return res;
10571  }
10572
10573  protected void parseEnrollmentRequestProperties(JsonObject json, EnrollmentRequest res) throws IOException, FHIRFormatError {
10574    parseDomainResourceProperties(json, res);
10575    if (json.has("identifier")) {
10576      JsonArray array = json.getAsJsonArray("identifier");
10577      for (int i = 0; i < array.size(); i++) {
10578        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10579      }
10580    };
10581    if (json.has("status"))
10582      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EnrollmentRequest.EnrollmentRequestStatus.NULL, new EnrollmentRequest.EnrollmentRequestStatusEnumFactory()));
10583    if (json.has("_status"))
10584      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10585    if (json.has("created"))
10586      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
10587    if (json.has("_created"))
10588      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
10589    if (json.has("insurer"))
10590      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
10591    if (json.has("provider"))
10592      res.setProvider(parseReference(json.getAsJsonObject("provider")));
10593    if (json.has("candidate"))
10594      res.setCandidate(parseReference(json.getAsJsonObject("candidate")));
10595    if (json.has("coverage"))
10596      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
10597  }
10598
10599  protected EnrollmentResponse parseEnrollmentResponse(JsonObject json) throws IOException, FHIRFormatError {
10600    EnrollmentResponse res = new EnrollmentResponse();
10601    parseEnrollmentResponseProperties(json, res);
10602    return res;
10603  }
10604
10605  protected void parseEnrollmentResponseProperties(JsonObject json, EnrollmentResponse res) throws IOException, FHIRFormatError {
10606    parseDomainResourceProperties(json, res);
10607    if (json.has("identifier")) {
10608      JsonArray array = json.getAsJsonArray("identifier");
10609      for (int i = 0; i < array.size(); i++) {
10610        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10611      }
10612    };
10613    if (json.has("status"))
10614      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EnrollmentResponse.EnrollmentResponseStatus.NULL, new EnrollmentResponse.EnrollmentResponseStatusEnumFactory()));
10615    if (json.has("_status"))
10616      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10617    if (json.has("request"))
10618      res.setRequest(parseReference(json.getAsJsonObject("request")));
10619    if (json.has("outcome"))
10620      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
10621    if (json.has("_outcome"))
10622      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
10623    if (json.has("disposition"))
10624      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
10625    if (json.has("_disposition"))
10626      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
10627    if (json.has("created"))
10628      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
10629    if (json.has("_created"))
10630      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
10631    if (json.has("organization"))
10632      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
10633    if (json.has("requestProvider"))
10634      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
10635  }
10636
10637  protected EpisodeOfCare parseEpisodeOfCare(JsonObject json) throws IOException, FHIRFormatError {
10638    EpisodeOfCare res = new EpisodeOfCare();
10639    parseEpisodeOfCareProperties(json, res);
10640    return res;
10641  }
10642
10643  protected void parseEpisodeOfCareProperties(JsonObject json, EpisodeOfCare res) throws IOException, FHIRFormatError {
10644    parseDomainResourceProperties(json, res);
10645    if (json.has("identifier")) {
10646      JsonArray array = json.getAsJsonArray("identifier");
10647      for (int i = 0; i < array.size(); i++) {
10648        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10649      }
10650    };
10651    if (json.has("status"))
10652      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
10653    if (json.has("_status"))
10654      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10655    if (json.has("statusHistory")) {
10656      JsonArray array = json.getAsJsonArray("statusHistory");
10657      for (int i = 0; i < array.size(); i++) {
10658        res.getStatusHistory().add(parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
10659      }
10660    };
10661    if (json.has("type")) {
10662      JsonArray array = json.getAsJsonArray("type");
10663      for (int i = 0; i < array.size(); i++) {
10664        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10665      }
10666    };
10667    if (json.has("diagnosis")) {
10668      JsonArray array = json.getAsJsonArray("diagnosis");
10669      for (int i = 0; i < array.size(); i++) {
10670        res.getDiagnosis().add(parseEpisodeOfCareDiagnosisComponent(array.get(i).getAsJsonObject(), res));
10671      }
10672    };
10673    if (json.has("patient"))
10674      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10675    if (json.has("managingOrganization"))
10676      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
10677    if (json.has("period"))
10678      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10679    if (json.has("referralRequest")) {
10680      JsonArray array = json.getAsJsonArray("referralRequest");
10681      for (int i = 0; i < array.size(); i++) {
10682        res.getReferralRequest().add(parseReference(array.get(i).getAsJsonObject()));
10683      }
10684    };
10685    if (json.has("careManager"))
10686      res.setCareManager(parseReference(json.getAsJsonObject("careManager")));
10687    if (json.has("team")) {
10688      JsonArray array = json.getAsJsonArray("team");
10689      for (int i = 0; i < array.size(); i++) {
10690        res.getTeam().add(parseReference(array.get(i).getAsJsonObject()));
10691      }
10692    };
10693    if (json.has("account")) {
10694      JsonArray array = json.getAsJsonArray("account");
10695      for (int i = 0; i < array.size(); i++) {
10696        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
10697      }
10698    };
10699  }
10700
10701  protected EpisodeOfCare.EpisodeOfCareStatusHistoryComponent parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
10702    EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res = new EpisodeOfCare.EpisodeOfCareStatusHistoryComponent();
10703    parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(json, owner, res);
10704    return res;
10705  }
10706
10707  protected void parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(JsonObject json, EpisodeOfCare owner, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res) throws IOException, FHIRFormatError {
10708    parseBackboneElementProperties(json, res);
10709    if (json.has("status"))
10710      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
10711    if (json.has("_status"))
10712      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10713    if (json.has("period"))
10714      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10715  }
10716
10717  protected EpisodeOfCare.DiagnosisComponent parseEpisodeOfCareDiagnosisComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
10718    EpisodeOfCare.DiagnosisComponent res = new EpisodeOfCare.DiagnosisComponent();
10719    parseEpisodeOfCareDiagnosisComponentProperties(json, owner, res);
10720    return res;
10721  }
10722
10723  protected void parseEpisodeOfCareDiagnosisComponentProperties(JsonObject json, EpisodeOfCare owner, EpisodeOfCare.DiagnosisComponent res) throws IOException, FHIRFormatError {
10724    parseBackboneElementProperties(json, res);
10725    if (json.has("condition"))
10726      res.setCondition(parseReference(json.getAsJsonObject("condition")));
10727    if (json.has("role"))
10728      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
10729    if (json.has("rank"))
10730      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
10731    if (json.has("_rank"))
10732      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
10733  }
10734
10735  protected EventDefinition parseEventDefinition(JsonObject json) throws IOException, FHIRFormatError {
10736    EventDefinition res = new EventDefinition();
10737    parseEventDefinitionProperties(json, res);
10738    return res;
10739  }
10740
10741  protected void parseEventDefinitionProperties(JsonObject json, EventDefinition res) throws IOException, FHIRFormatError {
10742    parseDomainResourceProperties(json, res);
10743    if (json.has("url"))
10744      res.setUrlElement(parseUri(json.get("url").getAsString()));
10745    if (json.has("_url"))
10746      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
10747    if (json.has("identifier")) {
10748      JsonArray array = json.getAsJsonArray("identifier");
10749      for (int i = 0; i < array.size(); i++) {
10750        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10751      }
10752    };
10753    if (json.has("version"))
10754      res.setVersionElement(parseString(json.get("version").getAsString()));
10755    if (json.has("_version"))
10756      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10757    if (json.has("name"))
10758      res.setNameElement(parseString(json.get("name").getAsString()));
10759    if (json.has("_name"))
10760      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10761    if (json.has("title"))
10762      res.setTitleElement(parseString(json.get("title").getAsString()));
10763    if (json.has("_title"))
10764      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
10765    if (json.has("subtitle"))
10766      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
10767    if (json.has("_subtitle"))
10768      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
10769    if (json.has("status"))
10770      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
10771    if (json.has("_status"))
10772      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10773    if (json.has("experimental"))
10774      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
10775    if (json.has("_experimental"))
10776      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
10777    Type subject = parseType("subject", json);
10778    if (subject != null)
10779      res.setSubject(subject);
10780    if (json.has("date"))
10781      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10782    if (json.has("_date"))
10783      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10784    if (json.has("publisher"))
10785      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
10786    if (json.has("_publisher"))
10787      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
10788    if (json.has("contact")) {
10789      JsonArray array = json.getAsJsonArray("contact");
10790      for (int i = 0; i < array.size(); i++) {
10791        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
10792      }
10793    };
10794    if (json.has("description"))
10795      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
10796    if (json.has("_description"))
10797      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10798    if (json.has("useContext")) {
10799      JsonArray array = json.getAsJsonArray("useContext");
10800      for (int i = 0; i < array.size(); i++) {
10801        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
10802      }
10803    };
10804    if (json.has("jurisdiction")) {
10805      JsonArray array = json.getAsJsonArray("jurisdiction");
10806      for (int i = 0; i < array.size(); i++) {
10807        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10808      }
10809    };
10810    if (json.has("purpose"))
10811      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
10812    if (json.has("_purpose"))
10813      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
10814    if (json.has("usage"))
10815      res.setUsageElement(parseString(json.get("usage").getAsString()));
10816    if (json.has("_usage"))
10817      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
10818    if (json.has("copyright"))
10819      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
10820    if (json.has("_copyright"))
10821      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
10822    if (json.has("approvalDate"))
10823      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
10824    if (json.has("_approvalDate"))
10825      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
10826    if (json.has("lastReviewDate"))
10827      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
10828    if (json.has("_lastReviewDate"))
10829      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
10830    if (json.has("effectivePeriod"))
10831      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
10832    if (json.has("topic")) {
10833      JsonArray array = json.getAsJsonArray("topic");
10834      for (int i = 0; i < array.size(); i++) {
10835        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10836      }
10837    };
10838    if (json.has("author")) {
10839      JsonArray array = json.getAsJsonArray("author");
10840      for (int i = 0; i < array.size(); i++) {
10841        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
10842      }
10843    };
10844    if (json.has("editor")) {
10845      JsonArray array = json.getAsJsonArray("editor");
10846      for (int i = 0; i < array.size(); i++) {
10847        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
10848      }
10849    };
10850    if (json.has("reviewer")) {
10851      JsonArray array = json.getAsJsonArray("reviewer");
10852      for (int i = 0; i < array.size(); i++) {
10853        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
10854      }
10855    };
10856    if (json.has("endorser")) {
10857      JsonArray array = json.getAsJsonArray("endorser");
10858      for (int i = 0; i < array.size(); i++) {
10859        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
10860      }
10861    };
10862    if (json.has("relatedArtifact")) {
10863      JsonArray array = json.getAsJsonArray("relatedArtifact");
10864      for (int i = 0; i < array.size(); i++) {
10865        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
10866      }
10867    };
10868    if (json.has("trigger")) {
10869      JsonArray array = json.getAsJsonArray("trigger");
10870      for (int i = 0; i < array.size(); i++) {
10871        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
10872      }
10873    };
10874  }
10875
10876  protected Evidence parseEvidence(JsonObject json) throws IOException, FHIRFormatError {
10877    Evidence res = new Evidence();
10878    parseEvidenceProperties(json, res);
10879    return res;
10880  }
10881
10882  protected void parseEvidenceProperties(JsonObject json, Evidence res) throws IOException, FHIRFormatError {
10883    parseDomainResourceProperties(json, res);
10884    if (json.has("url"))
10885      res.setUrlElement(parseUri(json.get("url").getAsString()));
10886    if (json.has("_url"))
10887      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
10888    if (json.has("identifier")) {
10889      JsonArray array = json.getAsJsonArray("identifier");
10890      for (int i = 0; i < array.size(); i++) {
10891        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10892      }
10893    };
10894    if (json.has("version"))
10895      res.setVersionElement(parseString(json.get("version").getAsString()));
10896    if (json.has("_version"))
10897      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10898    if (json.has("name"))
10899      res.setNameElement(parseString(json.get("name").getAsString()));
10900    if (json.has("_name"))
10901      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10902    if (json.has("title"))
10903      res.setTitleElement(parseString(json.get("title").getAsString()));
10904    if (json.has("_title"))
10905      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
10906    if (json.has("shortTitle"))
10907      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
10908    if (json.has("_shortTitle"))
10909      parseElementProperties(json.getAsJsonObject("_shortTitle"), res.getShortTitleElement());
10910    if (json.has("subtitle"))
10911      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
10912    if (json.has("_subtitle"))
10913      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
10914    if (json.has("status"))
10915      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
10916    if (json.has("_status"))
10917      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10918    if (json.has("date"))
10919      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10920    if (json.has("_date"))
10921      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10922    if (json.has("publisher"))
10923      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
10924    if (json.has("_publisher"))
10925      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
10926    if (json.has("contact")) {
10927      JsonArray array = json.getAsJsonArray("contact");
10928      for (int i = 0; i < array.size(); i++) {
10929        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
10930      }
10931    };
10932    if (json.has("description"))
10933      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
10934    if (json.has("_description"))
10935      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10936    if (json.has("note")) {
10937      JsonArray array = json.getAsJsonArray("note");
10938      for (int i = 0; i < array.size(); i++) {
10939        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10940      }
10941    };
10942    if (json.has("useContext")) {
10943      JsonArray array = json.getAsJsonArray("useContext");
10944      for (int i = 0; i < array.size(); i++) {
10945        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
10946      }
10947    };
10948    if (json.has("jurisdiction")) {
10949      JsonArray array = json.getAsJsonArray("jurisdiction");
10950      for (int i = 0; i < array.size(); i++) {
10951        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10952      }
10953    };
10954    if (json.has("copyright"))
10955      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
10956    if (json.has("_copyright"))
10957      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
10958    if (json.has("approvalDate"))
10959      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
10960    if (json.has("_approvalDate"))
10961      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
10962    if (json.has("lastReviewDate"))
10963      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
10964    if (json.has("_lastReviewDate"))
10965      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
10966    if (json.has("effectivePeriod"))
10967      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
10968    if (json.has("topic")) {
10969      JsonArray array = json.getAsJsonArray("topic");
10970      for (int i = 0; i < array.size(); i++) {
10971        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10972      }
10973    };
10974    if (json.has("author")) {
10975      JsonArray array = json.getAsJsonArray("author");
10976      for (int i = 0; i < array.size(); i++) {
10977        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
10978      }
10979    };
10980    if (json.has("editor")) {
10981      JsonArray array = json.getAsJsonArray("editor");
10982      for (int i = 0; i < array.size(); i++) {
10983        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
10984      }
10985    };
10986    if (json.has("reviewer")) {
10987      JsonArray array = json.getAsJsonArray("reviewer");
10988      for (int i = 0; i < array.size(); i++) {
10989        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
10990      }
10991    };
10992    if (json.has("endorser")) {
10993      JsonArray array = json.getAsJsonArray("endorser");
10994      for (int i = 0; i < array.size(); i++) {
10995        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
10996      }
10997    };
10998    if (json.has("relatedArtifact")) {
10999      JsonArray array = json.getAsJsonArray("relatedArtifact");
11000      for (int i = 0; i < array.size(); i++) {
11001        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
11002      }
11003    };
11004    if (json.has("exposureBackground"))
11005      res.setExposureBackground(parseReference(json.getAsJsonObject("exposureBackground")));
11006    if (json.has("exposureVariant")) {
11007      JsonArray array = json.getAsJsonArray("exposureVariant");
11008      for (int i = 0; i < array.size(); i++) {
11009        res.getExposureVariant().add(parseReference(array.get(i).getAsJsonObject()));
11010      }
11011    };
11012    if (json.has("outcome")) {
11013      JsonArray array = json.getAsJsonArray("outcome");
11014      for (int i = 0; i < array.size(); i++) {
11015        res.getOutcome().add(parseReference(array.get(i).getAsJsonObject()));
11016      }
11017    };
11018  }
11019
11020  protected EvidenceVariable parseEvidenceVariable(JsonObject json) throws IOException, FHIRFormatError {
11021    EvidenceVariable res = new EvidenceVariable();
11022    parseEvidenceVariableProperties(json, res);
11023    return res;
11024  }
11025
11026  protected void parseEvidenceVariableProperties(JsonObject json, EvidenceVariable res) throws IOException, FHIRFormatError {
11027    parseDomainResourceProperties(json, res);
11028    if (json.has("url"))
11029      res.setUrlElement(parseUri(json.get("url").getAsString()));
11030    if (json.has("_url"))
11031      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
11032    if (json.has("identifier")) {
11033      JsonArray array = json.getAsJsonArray("identifier");
11034      for (int i = 0; i < array.size(); i++) {
11035        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11036      }
11037    };
11038    if (json.has("version"))
11039      res.setVersionElement(parseString(json.get("version").getAsString()));
11040    if (json.has("_version"))
11041      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
11042    if (json.has("name"))
11043      res.setNameElement(parseString(json.get("name").getAsString()));
11044    if (json.has("_name"))
11045      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11046    if (json.has("title"))
11047      res.setTitleElement(parseString(json.get("title").getAsString()));
11048    if (json.has("_title"))
11049      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
11050    if (json.has("shortTitle"))
11051      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
11052    if (json.has("_shortTitle"))
11053      parseElementProperties(json.getAsJsonObject("_shortTitle"), res.getShortTitleElement());
11054    if (json.has("subtitle"))
11055      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
11056    if (json.has("_subtitle"))
11057      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
11058    if (json.has("status"))
11059      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
11060    if (json.has("_status"))
11061      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11062    if (json.has("date"))
11063      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11064    if (json.has("_date"))
11065      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11066    if (json.has("publisher"))
11067      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
11068    if (json.has("_publisher"))
11069      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
11070    if (json.has("contact")) {
11071      JsonArray array = json.getAsJsonArray("contact");
11072      for (int i = 0; i < array.size(); i++) {
11073        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
11074      }
11075    };
11076    if (json.has("description"))
11077      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11078    if (json.has("_description"))
11079      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11080    if (json.has("note")) {
11081      JsonArray array = json.getAsJsonArray("note");
11082      for (int i = 0; i < array.size(); i++) {
11083        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11084      }
11085    };
11086    if (json.has("useContext")) {
11087      JsonArray array = json.getAsJsonArray("useContext");
11088      for (int i = 0; i < array.size(); i++) {
11089        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11090      }
11091    };
11092    if (json.has("jurisdiction")) {
11093      JsonArray array = json.getAsJsonArray("jurisdiction");
11094      for (int i = 0; i < array.size(); i++) {
11095        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11096      }
11097    };
11098    if (json.has("copyright"))
11099      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
11100    if (json.has("_copyright"))
11101      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
11102    if (json.has("approvalDate"))
11103      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
11104    if (json.has("_approvalDate"))
11105      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
11106    if (json.has("lastReviewDate"))
11107      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
11108    if (json.has("_lastReviewDate"))
11109      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
11110    if (json.has("effectivePeriod"))
11111      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
11112    if (json.has("topic")) {
11113      JsonArray array = json.getAsJsonArray("topic");
11114      for (int i = 0; i < array.size(); i++) {
11115        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11116      }
11117    };
11118    if (json.has("author")) {
11119      JsonArray array = json.getAsJsonArray("author");
11120      for (int i = 0; i < array.size(); i++) {
11121        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
11122      }
11123    };
11124    if (json.has("editor")) {
11125      JsonArray array = json.getAsJsonArray("editor");
11126      for (int i = 0; i < array.size(); i++) {
11127        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
11128      }
11129    };
11130    if (json.has("reviewer")) {
11131      JsonArray array = json.getAsJsonArray("reviewer");
11132      for (int i = 0; i < array.size(); i++) {
11133        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
11134      }
11135    };
11136    if (json.has("endorser")) {
11137      JsonArray array = json.getAsJsonArray("endorser");
11138      for (int i = 0; i < array.size(); i++) {
11139        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
11140      }
11141    };
11142    if (json.has("relatedArtifact")) {
11143      JsonArray array = json.getAsJsonArray("relatedArtifact");
11144      for (int i = 0; i < array.size(); i++) {
11145        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
11146      }
11147    };
11148    if (json.has("type"))
11149      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), EvidenceVariable.EvidenceVariableType.NULL, new EvidenceVariable.EvidenceVariableTypeEnumFactory()));
11150    if (json.has("_type"))
11151      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
11152    if (json.has("characteristic")) {
11153      JsonArray array = json.getAsJsonArray("characteristic");
11154      for (int i = 0; i < array.size(); i++) {
11155        res.getCharacteristic().add(parseEvidenceVariableEvidenceVariableCharacteristicComponent(array.get(i).getAsJsonObject(), res));
11156      }
11157    };
11158  }
11159
11160  protected EvidenceVariable.EvidenceVariableCharacteristicComponent parseEvidenceVariableEvidenceVariableCharacteristicComponent(JsonObject json, EvidenceVariable owner) throws IOException, FHIRFormatError {
11161    EvidenceVariable.EvidenceVariableCharacteristicComponent res = new EvidenceVariable.EvidenceVariableCharacteristicComponent();
11162    parseEvidenceVariableEvidenceVariableCharacteristicComponentProperties(json, owner, res);
11163    return res;
11164  }
11165
11166  protected void parseEvidenceVariableEvidenceVariableCharacteristicComponentProperties(JsonObject json, EvidenceVariable owner, EvidenceVariable.EvidenceVariableCharacteristicComponent res) throws IOException, FHIRFormatError {
11167    parseBackboneElementProperties(json, res);
11168    if (json.has("description"))
11169      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11170    if (json.has("_description"))
11171      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11172    Type definition = parseType("definition", json);
11173    if (definition != null)
11174      res.setDefinition(definition);
11175    if (json.has("usageContext")) {
11176      JsonArray array = json.getAsJsonArray("usageContext");
11177      for (int i = 0; i < array.size(); i++) {
11178        res.getUsageContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11179      }
11180    };
11181    if (json.has("exclude"))
11182      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
11183    if (json.has("_exclude"))
11184      parseElementProperties(json.getAsJsonObject("_exclude"), res.getExcludeElement());
11185    Type participantEffective = parseType("participantEffective", json);
11186    if (participantEffective != null)
11187      res.setParticipantEffective(participantEffective);
11188    if (json.has("timeFromStart"))
11189      res.setTimeFromStart(parseDuration(json.getAsJsonObject("timeFromStart")));
11190    if (json.has("groupMeasure"))
11191      res.setGroupMeasureElement(parseEnumeration(json.get("groupMeasure").getAsString(), EvidenceVariable.GroupMeasure.NULL, new EvidenceVariable.GroupMeasureEnumFactory()));
11192    if (json.has("_groupMeasure"))
11193      parseElementProperties(json.getAsJsonObject("_groupMeasure"), res.getGroupMeasureElement());
11194  }
11195
11196  protected ExampleScenario parseExampleScenario(JsonObject json) throws IOException, FHIRFormatError {
11197    ExampleScenario res = new ExampleScenario();
11198    parseExampleScenarioProperties(json, res);
11199    return res;
11200  }
11201
11202  protected void parseExampleScenarioProperties(JsonObject json, ExampleScenario res) throws IOException, FHIRFormatError {
11203    parseDomainResourceProperties(json, res);
11204    if (json.has("url"))
11205      res.setUrlElement(parseUri(json.get("url").getAsString()));
11206    if (json.has("_url"))
11207      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
11208    if (json.has("identifier")) {
11209      JsonArray array = json.getAsJsonArray("identifier");
11210      for (int i = 0; i < array.size(); i++) {
11211        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11212      }
11213    };
11214    if (json.has("version"))
11215      res.setVersionElement(parseString(json.get("version").getAsString()));
11216    if (json.has("_version"))
11217      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
11218    if (json.has("name"))
11219      res.setNameElement(parseString(json.get("name").getAsString()));
11220    if (json.has("_name"))
11221      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11222    if (json.has("status"))
11223      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
11224    if (json.has("_status"))
11225      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11226    if (json.has("experimental"))
11227      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
11228    if (json.has("_experimental"))
11229      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
11230    if (json.has("date"))
11231      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11232    if (json.has("_date"))
11233      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11234    if (json.has("publisher"))
11235      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
11236    if (json.has("_publisher"))
11237      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
11238    if (json.has("contact")) {
11239      JsonArray array = json.getAsJsonArray("contact");
11240      for (int i = 0; i < array.size(); i++) {
11241        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
11242      }
11243    };
11244    if (json.has("useContext")) {
11245      JsonArray array = json.getAsJsonArray("useContext");
11246      for (int i = 0; i < array.size(); i++) {
11247        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11248      }
11249    };
11250    if (json.has("jurisdiction")) {
11251      JsonArray array = json.getAsJsonArray("jurisdiction");
11252      for (int i = 0; i < array.size(); i++) {
11253        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11254      }
11255    };
11256    if (json.has("copyright"))
11257      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
11258    if (json.has("_copyright"))
11259      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
11260    if (json.has("purpose"))
11261      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
11262    if (json.has("_purpose"))
11263      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
11264    if (json.has("actor")) {
11265      JsonArray array = json.getAsJsonArray("actor");
11266      for (int i = 0; i < array.size(); i++) {
11267        res.getActor().add(parseExampleScenarioExampleScenarioActorComponent(array.get(i).getAsJsonObject(), res));
11268      }
11269    };
11270    if (json.has("instance")) {
11271      JsonArray array = json.getAsJsonArray("instance");
11272      for (int i = 0; i < array.size(); i++) {
11273        res.getInstance().add(parseExampleScenarioExampleScenarioInstanceComponent(array.get(i).getAsJsonObject(), res));
11274      }
11275    };
11276    if (json.has("process")) {
11277      JsonArray array = json.getAsJsonArray("process");
11278      for (int i = 0; i < array.size(); i++) {
11279        res.getProcess().add(parseExampleScenarioExampleScenarioProcessComponent(array.get(i).getAsJsonObject(), res));
11280      }
11281    };
11282    if (json.has("workflow")) {
11283      JsonArray array = json.getAsJsonArray("workflow");
11284      for (int i = 0; i < array.size(); i++) {
11285        res.getWorkflow().add(parseCanonical(array.get(i).getAsString()));
11286      }
11287    };
11288    if (json.has("_workflow")) {
11289      JsonArray array = json.getAsJsonArray("_workflow");
11290      for (int i = 0; i < array.size(); i++) {
11291        if (i == res.getWorkflow().size())
11292          res.getWorkflow().add(parseCanonical(null));
11293        if (array.get(i) instanceof JsonObject) 
11294          parseElementProperties(array.get(i).getAsJsonObject(), res.getWorkflow().get(i));
11295      }
11296    };
11297  }
11298
11299  protected ExampleScenario.ExampleScenarioActorComponent parseExampleScenarioExampleScenarioActorComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11300    ExampleScenario.ExampleScenarioActorComponent res = new ExampleScenario.ExampleScenarioActorComponent();
11301    parseExampleScenarioExampleScenarioActorComponentProperties(json, owner, res);
11302    return res;
11303  }
11304
11305  protected void parseExampleScenarioExampleScenarioActorComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioActorComponent res) throws IOException, FHIRFormatError {
11306    parseBackboneElementProperties(json, res);
11307    if (json.has("actorId"))
11308      res.setActorIdElement(parseString(json.get("actorId").getAsString()));
11309    if (json.has("_actorId"))
11310      parseElementProperties(json.getAsJsonObject("_actorId"), res.getActorIdElement());
11311    if (json.has("type"))
11312      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ExampleScenario.ExampleScenarioActorType.NULL, new ExampleScenario.ExampleScenarioActorTypeEnumFactory()));
11313    if (json.has("_type"))
11314      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
11315    if (json.has("name"))
11316      res.setNameElement(parseString(json.get("name").getAsString()));
11317    if (json.has("_name"))
11318      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11319    if (json.has("description"))
11320      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11321    if (json.has("_description"))
11322      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11323  }
11324
11325  protected ExampleScenario.ExampleScenarioInstanceComponent parseExampleScenarioExampleScenarioInstanceComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11326    ExampleScenario.ExampleScenarioInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceComponent();
11327    parseExampleScenarioExampleScenarioInstanceComponentProperties(json, owner, res);
11328    return res;
11329  }
11330
11331  protected void parseExampleScenarioExampleScenarioInstanceComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceComponent res) throws IOException, FHIRFormatError {
11332    parseBackboneElementProperties(json, res);
11333    if (json.has("resourceId"))
11334      res.setResourceIdElement(parseString(json.get("resourceId").getAsString()));
11335    if (json.has("_resourceId"))
11336      parseElementProperties(json.getAsJsonObject("_resourceId"), res.getResourceIdElement());
11337    if (json.has("resourceType"))
11338      res.setResourceTypeElement(parseEnumeration(json.get("resourceType").getAsString(), ExampleScenario.FHIRResourceType.NULL, new ExampleScenario.FHIRResourceTypeEnumFactory()));
11339    if (json.has("_resourceType"))
11340      parseElementProperties(json.getAsJsonObject("_resourceType"), res.getResourceTypeElement());
11341    if (json.has("name"))
11342      res.setNameElement(parseString(json.get("name").getAsString()));
11343    if (json.has("_name"))
11344      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11345    if (json.has("description"))
11346      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11347    if (json.has("_description"))
11348      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11349    if (json.has("version")) {
11350      JsonArray array = json.getAsJsonArray("version");
11351      for (int i = 0; i < array.size(); i++) {
11352        res.getVersion().add(parseExampleScenarioExampleScenarioInstanceVersionComponent(array.get(i).getAsJsonObject(), owner));
11353      }
11354    };
11355    if (json.has("containedInstance")) {
11356      JsonArray array = json.getAsJsonArray("containedInstance");
11357      for (int i = 0; i < array.size(); i++) {
11358        res.getContainedInstance().add(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(array.get(i).getAsJsonObject(), owner));
11359      }
11360    };
11361  }
11362
11363  protected ExampleScenario.ExampleScenarioInstanceVersionComponent parseExampleScenarioExampleScenarioInstanceVersionComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11364    ExampleScenario.ExampleScenarioInstanceVersionComponent res = new ExampleScenario.ExampleScenarioInstanceVersionComponent();
11365    parseExampleScenarioExampleScenarioInstanceVersionComponentProperties(json, owner, res);
11366    return res;
11367  }
11368
11369  protected void parseExampleScenarioExampleScenarioInstanceVersionComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceVersionComponent res) throws IOException, FHIRFormatError {
11370    parseBackboneElementProperties(json, res);
11371    if (json.has("versionId"))
11372      res.setVersionIdElement(parseString(json.get("versionId").getAsString()));
11373    if (json.has("_versionId"))
11374      parseElementProperties(json.getAsJsonObject("_versionId"), res.getVersionIdElement());
11375    if (json.has("description"))
11376      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11377    if (json.has("_description"))
11378      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11379  }
11380
11381  protected ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11382    ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent();
11383    parseExampleScenarioExampleScenarioInstanceContainedInstanceComponentProperties(json, owner, res);
11384    return res;
11385  }
11386
11387  protected void parseExampleScenarioExampleScenarioInstanceContainedInstanceComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res) throws IOException, FHIRFormatError {
11388    parseBackboneElementProperties(json, res);
11389    if (json.has("resourceId"))
11390      res.setResourceIdElement(parseString(json.get("resourceId").getAsString()));
11391    if (json.has("_resourceId"))
11392      parseElementProperties(json.getAsJsonObject("_resourceId"), res.getResourceIdElement());
11393    if (json.has("versionId"))
11394      res.setVersionIdElement(parseString(json.get("versionId").getAsString()));
11395    if (json.has("_versionId"))
11396      parseElementProperties(json.getAsJsonObject("_versionId"), res.getVersionIdElement());
11397  }
11398
11399  protected ExampleScenario.ExampleScenarioProcessComponent parseExampleScenarioExampleScenarioProcessComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11400    ExampleScenario.ExampleScenarioProcessComponent res = new ExampleScenario.ExampleScenarioProcessComponent();
11401    parseExampleScenarioExampleScenarioProcessComponentProperties(json, owner, res);
11402    return res;
11403  }
11404
11405  protected void parseExampleScenarioExampleScenarioProcessComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessComponent res) throws IOException, FHIRFormatError {
11406    parseBackboneElementProperties(json, res);
11407    if (json.has("title"))
11408      res.setTitleElement(parseString(json.get("title").getAsString()));
11409    if (json.has("_title"))
11410      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
11411    if (json.has("description"))
11412      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11413    if (json.has("_description"))
11414      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11415    if (json.has("preConditions"))
11416      res.setPreConditionsElement(parseMarkdown(json.get("preConditions").getAsString()));
11417    if (json.has("_preConditions"))
11418      parseElementProperties(json.getAsJsonObject("_preConditions"), res.getPreConditionsElement());
11419    if (json.has("postConditions"))
11420      res.setPostConditionsElement(parseMarkdown(json.get("postConditions").getAsString()));
11421    if (json.has("_postConditions"))
11422      parseElementProperties(json.getAsJsonObject("_postConditions"), res.getPostConditionsElement());
11423    if (json.has("step")) {
11424      JsonArray array = json.getAsJsonArray("step");
11425      for (int i = 0; i < array.size(); i++) {
11426        res.getStep().add(parseExampleScenarioExampleScenarioProcessStepComponent(array.get(i).getAsJsonObject(), owner));
11427      }
11428    };
11429  }
11430
11431  protected ExampleScenario.ExampleScenarioProcessStepComponent parseExampleScenarioExampleScenarioProcessStepComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11432    ExampleScenario.ExampleScenarioProcessStepComponent res = new ExampleScenario.ExampleScenarioProcessStepComponent();
11433    parseExampleScenarioExampleScenarioProcessStepComponentProperties(json, owner, res);
11434    return res;
11435  }
11436
11437  protected void parseExampleScenarioExampleScenarioProcessStepComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepComponent res) throws IOException, FHIRFormatError {
11438    parseBackboneElementProperties(json, res);
11439    if (json.has("process")) {
11440      JsonArray array = json.getAsJsonArray("process");
11441      for (int i = 0; i < array.size(); i++) {
11442        res.getProcess().add(parseExampleScenarioExampleScenarioProcessComponent(array.get(i).getAsJsonObject(), owner));
11443      }
11444    };
11445    if (json.has("pause"))
11446      res.setPauseElement(parseBoolean(json.get("pause").getAsBoolean()));
11447    if (json.has("_pause"))
11448      parseElementProperties(json.getAsJsonObject("_pause"), res.getPauseElement());
11449    if (json.has("operation"))
11450      res.setOperation(parseExampleScenarioExampleScenarioProcessStepOperationComponent(json.getAsJsonObject("operation"), owner));
11451    if (json.has("alternative")) {
11452      JsonArray array = json.getAsJsonArray("alternative");
11453      for (int i = 0; i < array.size(); i++) {
11454        res.getAlternative().add(parseExampleScenarioExampleScenarioProcessStepAlternativeComponent(array.get(i).getAsJsonObject(), owner));
11455      }
11456    };
11457  }
11458
11459  protected ExampleScenario.ExampleScenarioProcessStepOperationComponent parseExampleScenarioExampleScenarioProcessStepOperationComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11460    ExampleScenario.ExampleScenarioProcessStepOperationComponent res = new ExampleScenario.ExampleScenarioProcessStepOperationComponent();
11461    parseExampleScenarioExampleScenarioProcessStepOperationComponentProperties(json, owner, res);
11462    return res;
11463  }
11464
11465  protected void parseExampleScenarioExampleScenarioProcessStepOperationComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepOperationComponent res) throws IOException, FHIRFormatError {
11466    parseBackboneElementProperties(json, res);
11467    if (json.has("number"))
11468      res.setNumberElement(parseString(json.get("number").getAsString()));
11469    if (json.has("_number"))
11470      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
11471    if (json.has("type"))
11472      res.setTypeElement(parseString(json.get("type").getAsString()));
11473    if (json.has("_type"))
11474      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
11475    if (json.has("name"))
11476      res.setNameElement(parseString(json.get("name").getAsString()));
11477    if (json.has("_name"))
11478      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11479    if (json.has("initiator"))
11480      res.setInitiatorElement(parseString(json.get("initiator").getAsString()));
11481    if (json.has("_initiator"))
11482      parseElementProperties(json.getAsJsonObject("_initiator"), res.getInitiatorElement());
11483    if (json.has("receiver"))
11484      res.setReceiverElement(parseString(json.get("receiver").getAsString()));
11485    if (json.has("_receiver"))
11486      parseElementProperties(json.getAsJsonObject("_receiver"), res.getReceiverElement());
11487    if (json.has("description"))
11488      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11489    if (json.has("_description"))
11490      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11491    if (json.has("initiatorActive"))
11492      res.setInitiatorActiveElement(parseBoolean(json.get("initiatorActive").getAsBoolean()));
11493    if (json.has("_initiatorActive"))
11494      parseElementProperties(json.getAsJsonObject("_initiatorActive"), res.getInitiatorActiveElement());
11495    if (json.has("receiverActive"))
11496      res.setReceiverActiveElement(parseBoolean(json.get("receiverActive").getAsBoolean()));
11497    if (json.has("_receiverActive"))
11498      parseElementProperties(json.getAsJsonObject("_receiverActive"), res.getReceiverActiveElement());
11499    if (json.has("request"))
11500      res.setRequest(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(json.getAsJsonObject("request"), owner));
11501    if (json.has("response"))
11502      res.setResponse(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(json.getAsJsonObject("response"), owner));
11503  }
11504
11505  protected ExampleScenario.ExampleScenarioProcessStepAlternativeComponent parseExampleScenarioExampleScenarioProcessStepAlternativeComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
11506    ExampleScenario.ExampleScenarioProcessStepAlternativeComponent res = new ExampleScenario.ExampleScenarioProcessStepAlternativeComponent();
11507    parseExampleScenarioExampleScenarioProcessStepAlternativeComponentProperties(json, owner, res);
11508    return res;
11509  }
11510
11511  protected void parseExampleScenarioExampleScenarioProcessStepAlternativeComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepAlternativeComponent res) throws IOException, FHIRFormatError {
11512    parseBackboneElementProperties(json, res);
11513    if (json.has("title"))
11514      res.setTitleElement(parseString(json.get("title").getAsString()));
11515    if (json.has("_title"))
11516      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
11517    if (json.has("description"))
11518      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11519    if (json.has("_description"))
11520      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11521    if (json.has("step")) {
11522      JsonArray array = json.getAsJsonArray("step");
11523      for (int i = 0; i < array.size(); i++) {
11524        res.getStep().add(parseExampleScenarioExampleScenarioProcessStepComponent(array.get(i).getAsJsonObject(), owner));
11525      }
11526    };
11527  }
11528
11529  protected ExplanationOfBenefit parseExplanationOfBenefit(JsonObject json) throws IOException, FHIRFormatError {
11530    ExplanationOfBenefit res = new ExplanationOfBenefit();
11531    parseExplanationOfBenefitProperties(json, res);
11532    return res;
11533  }
11534
11535  protected void parseExplanationOfBenefitProperties(JsonObject json, ExplanationOfBenefit res) throws IOException, FHIRFormatError {
11536    parseDomainResourceProperties(json, res);
11537    if (json.has("identifier")) {
11538      JsonArray array = json.getAsJsonArray("identifier");
11539      for (int i = 0; i < array.size(); i++) {
11540        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11541      }
11542    };
11543    if (json.has("status"))
11544      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ExplanationOfBenefit.ExplanationOfBenefitStatus.NULL, new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory()));
11545    if (json.has("_status"))
11546      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11547    if (json.has("type"))
11548      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
11549    if (json.has("subType"))
11550      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
11551    if (json.has("use"))
11552      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ExplanationOfBenefit.Use.NULL, new ExplanationOfBenefit.UseEnumFactory()));
11553    if (json.has("_use"))
11554      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
11555    if (json.has("patient"))
11556      res.setPatient(parseReference(json.getAsJsonObject("patient")));
11557    if (json.has("billablePeriod"))
11558      res.setBillablePeriod(parsePeriod(json.getAsJsonObject("billablePeriod")));
11559    if (json.has("created"))
11560      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
11561    if (json.has("_created"))
11562      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
11563    if (json.has("enterer"))
11564      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
11565    if (json.has("insurer"))
11566      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
11567    if (json.has("provider"))
11568      res.setProvider(parseReference(json.getAsJsonObject("provider")));
11569    if (json.has("priority"))
11570      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
11571    if (json.has("fundsReserveRequested"))
11572      res.setFundsReserveRequested(parseCodeableConcept(json.getAsJsonObject("fundsReserveRequested")));
11573    if (json.has("fundsReserve"))
11574      res.setFundsReserve(parseCodeableConcept(json.getAsJsonObject("fundsReserve")));
11575    if (json.has("related")) {
11576      JsonArray array = json.getAsJsonArray("related");
11577      for (int i = 0; i < array.size(); i++) {
11578        res.getRelated().add(parseExplanationOfBenefitRelatedClaimComponent(array.get(i).getAsJsonObject(), res));
11579      }
11580    };
11581    if (json.has("prescription"))
11582      res.setPrescription(parseReference(json.getAsJsonObject("prescription")));
11583    if (json.has("originalPrescription"))
11584      res.setOriginalPrescription(parseReference(json.getAsJsonObject("originalPrescription")));
11585    if (json.has("payee"))
11586      res.setPayee(parseExplanationOfBenefitPayeeComponent(json.getAsJsonObject("payee"), res));
11587    if (json.has("referral"))
11588      res.setReferral(parseReference(json.getAsJsonObject("referral")));
11589    if (json.has("facility"))
11590      res.setFacility(parseReference(json.getAsJsonObject("facility")));
11591    if (json.has("claim"))
11592      res.setClaim(parseReference(json.getAsJsonObject("claim")));
11593    if (json.has("claimResponse"))
11594      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
11595    if (json.has("outcome"))
11596      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), ExplanationOfBenefit.RemittanceOutcome.NULL, new ExplanationOfBenefit.RemittanceOutcomeEnumFactory()));
11597    if (json.has("_outcome"))
11598      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
11599    if (json.has("disposition"))
11600      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
11601    if (json.has("_disposition"))
11602      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
11603    if (json.has("preAuthRef")) {
11604      JsonArray array = json.getAsJsonArray("preAuthRef");
11605      for (int i = 0; i < array.size(); i++) {
11606        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
11607      }
11608    };
11609    if (json.has("_preAuthRef")) {
11610      JsonArray array = json.getAsJsonArray("_preAuthRef");
11611      for (int i = 0; i < array.size(); i++) {
11612        if (i == res.getPreAuthRef().size())
11613          res.getPreAuthRef().add(parseString(null));
11614        if (array.get(i) instanceof JsonObject) 
11615          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
11616      }
11617    };
11618    if (json.has("preAuthRefPeriod")) {
11619      JsonArray array = json.getAsJsonArray("preAuthRefPeriod");
11620      for (int i = 0; i < array.size(); i++) {
11621        res.getPreAuthRefPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
11622      }
11623    };
11624    if (json.has("careTeam")) {
11625      JsonArray array = json.getAsJsonArray("careTeam");
11626      for (int i = 0; i < array.size(); i++) {
11627        res.getCareTeam().add(parseExplanationOfBenefitCareTeamComponent(array.get(i).getAsJsonObject(), res));
11628      }
11629    };
11630    if (json.has("supportingInfo")) {
11631      JsonArray array = json.getAsJsonArray("supportingInfo");
11632      for (int i = 0; i < array.size(); i++) {
11633        res.getSupportingInfo().add(parseExplanationOfBenefitSupportingInformationComponent(array.get(i).getAsJsonObject(), res));
11634      }
11635    };
11636    if (json.has("diagnosis")) {
11637      JsonArray array = json.getAsJsonArray("diagnosis");
11638      for (int i = 0; i < array.size(); i++) {
11639        res.getDiagnosis().add(parseExplanationOfBenefitDiagnosisComponent(array.get(i).getAsJsonObject(), res));
11640      }
11641    };
11642    if (json.has("procedure")) {
11643      JsonArray array = json.getAsJsonArray("procedure");
11644      for (int i = 0; i < array.size(); i++) {
11645        res.getProcedure().add(parseExplanationOfBenefitProcedureComponent(array.get(i).getAsJsonObject(), res));
11646      }
11647    };
11648    if (json.has("precedence"))
11649      res.setPrecedenceElement(parsePositiveInt(json.get("precedence").getAsString()));
11650    if (json.has("_precedence"))
11651      parseElementProperties(json.getAsJsonObject("_precedence"), res.getPrecedenceElement());
11652    if (json.has("insurance")) {
11653      JsonArray array = json.getAsJsonArray("insurance");
11654      for (int i = 0; i < array.size(); i++) {
11655        res.getInsurance().add(parseExplanationOfBenefitInsuranceComponent(array.get(i).getAsJsonObject(), res));
11656      }
11657    };
11658    if (json.has("accident"))
11659      res.setAccident(parseExplanationOfBenefitAccidentComponent(json.getAsJsonObject("accident"), res));
11660    if (json.has("item")) {
11661      JsonArray array = json.getAsJsonArray("item");
11662      for (int i = 0; i < array.size(); i++) {
11663        res.getItem().add(parseExplanationOfBenefitItemComponent(array.get(i).getAsJsonObject(), res));
11664      }
11665    };
11666    if (json.has("addItem")) {
11667      JsonArray array = json.getAsJsonArray("addItem");
11668      for (int i = 0; i < array.size(); i++) {
11669        res.getAddItem().add(parseExplanationOfBenefitAddedItemComponent(array.get(i).getAsJsonObject(), res));
11670      }
11671    };
11672    if (json.has("adjudication")) {
11673      JsonArray array = json.getAsJsonArray("adjudication");
11674      for (int i = 0; i < array.size(); i++) {
11675        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), res));
11676      }
11677    };
11678    if (json.has("total")) {
11679      JsonArray array = json.getAsJsonArray("total");
11680      for (int i = 0; i < array.size(); i++) {
11681        res.getTotal().add(parseExplanationOfBenefitTotalComponent(array.get(i).getAsJsonObject(), res));
11682      }
11683    };
11684    if (json.has("payment"))
11685      res.setPayment(parseExplanationOfBenefitPaymentComponent(json.getAsJsonObject("payment"), res));
11686    if (json.has("formCode"))
11687      res.setFormCode(parseCodeableConcept(json.getAsJsonObject("formCode")));
11688    if (json.has("form"))
11689      res.setForm(parseAttachment(json.getAsJsonObject("form")));
11690    if (json.has("processNote")) {
11691      JsonArray array = json.getAsJsonArray("processNote");
11692      for (int i = 0; i < array.size(); i++) {
11693        res.getProcessNote().add(parseExplanationOfBenefitNoteComponent(array.get(i).getAsJsonObject(), res));
11694      }
11695    };
11696    if (json.has("benefitPeriod"))
11697      res.setBenefitPeriod(parsePeriod(json.getAsJsonObject("benefitPeriod")));
11698    if (json.has("benefitBalance")) {
11699      JsonArray array = json.getAsJsonArray("benefitBalance");
11700      for (int i = 0; i < array.size(); i++) {
11701        res.getBenefitBalance().add(parseExplanationOfBenefitBenefitBalanceComponent(array.get(i).getAsJsonObject(), res));
11702      }
11703    };
11704  }
11705
11706  protected ExplanationOfBenefit.RelatedClaimComponent parseExplanationOfBenefitRelatedClaimComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11707    ExplanationOfBenefit.RelatedClaimComponent res = new ExplanationOfBenefit.RelatedClaimComponent();
11708    parseExplanationOfBenefitRelatedClaimComponentProperties(json, owner, res);
11709    return res;
11710  }
11711
11712  protected void parseExplanationOfBenefitRelatedClaimComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.RelatedClaimComponent res) throws IOException, FHIRFormatError {
11713    parseBackboneElementProperties(json, res);
11714    if (json.has("claim"))
11715      res.setClaim(parseReference(json.getAsJsonObject("claim")));
11716    if (json.has("relationship"))
11717      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
11718    if (json.has("reference"))
11719      res.setReference(parseIdentifier(json.getAsJsonObject("reference")));
11720  }
11721
11722  protected ExplanationOfBenefit.PayeeComponent parseExplanationOfBenefitPayeeComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11723    ExplanationOfBenefit.PayeeComponent res = new ExplanationOfBenefit.PayeeComponent();
11724    parseExplanationOfBenefitPayeeComponentProperties(json, owner, res);
11725    return res;
11726  }
11727
11728  protected void parseExplanationOfBenefitPayeeComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.PayeeComponent res) throws IOException, FHIRFormatError {
11729    parseBackboneElementProperties(json, res);
11730    if (json.has("type"))
11731      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
11732    if (json.has("party"))
11733      res.setParty(parseReference(json.getAsJsonObject("party")));
11734  }
11735
11736  protected ExplanationOfBenefit.CareTeamComponent parseExplanationOfBenefitCareTeamComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11737    ExplanationOfBenefit.CareTeamComponent res = new ExplanationOfBenefit.CareTeamComponent();
11738    parseExplanationOfBenefitCareTeamComponentProperties(json, owner, res);
11739    return res;
11740  }
11741
11742  protected void parseExplanationOfBenefitCareTeamComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.CareTeamComponent res) throws IOException, FHIRFormatError {
11743    parseBackboneElementProperties(json, res);
11744    if (json.has("sequence"))
11745      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
11746    if (json.has("_sequence"))
11747      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
11748    if (json.has("provider"))
11749      res.setProvider(parseReference(json.getAsJsonObject("provider")));
11750    if (json.has("responsible"))
11751      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
11752    if (json.has("_responsible"))
11753      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
11754    if (json.has("role"))
11755      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
11756    if (json.has("qualification"))
11757      res.setQualification(parseCodeableConcept(json.getAsJsonObject("qualification")));
11758  }
11759
11760  protected ExplanationOfBenefit.SupportingInformationComponent parseExplanationOfBenefitSupportingInformationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11761    ExplanationOfBenefit.SupportingInformationComponent res = new ExplanationOfBenefit.SupportingInformationComponent();
11762    parseExplanationOfBenefitSupportingInformationComponentProperties(json, owner, res);
11763    return res;
11764  }
11765
11766  protected void parseExplanationOfBenefitSupportingInformationComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.SupportingInformationComponent res) throws IOException, FHIRFormatError {
11767    parseBackboneElementProperties(json, res);
11768    if (json.has("sequence"))
11769      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
11770    if (json.has("_sequence"))
11771      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
11772    if (json.has("category"))
11773      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
11774    if (json.has("code"))
11775      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
11776    Type timing = parseType("timing", json);
11777    if (timing != null)
11778      res.setTiming(timing);
11779    Type value = parseType("value", json);
11780    if (value != null)
11781      res.setValue(value);
11782    if (json.has("reason"))
11783      res.setReason(parseCoding(json.getAsJsonObject("reason")));
11784  }
11785
11786  protected ExplanationOfBenefit.DiagnosisComponent parseExplanationOfBenefitDiagnosisComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11787    ExplanationOfBenefit.DiagnosisComponent res = new ExplanationOfBenefit.DiagnosisComponent();
11788    parseExplanationOfBenefitDiagnosisComponentProperties(json, owner, res);
11789    return res;
11790  }
11791
11792  protected void parseExplanationOfBenefitDiagnosisComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.DiagnosisComponent res) throws IOException, FHIRFormatError {
11793    parseBackboneElementProperties(json, res);
11794    if (json.has("sequence"))
11795      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
11796    if (json.has("_sequence"))
11797      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
11798    Type diagnosis = parseType("diagnosis", json);
11799    if (diagnosis != null)
11800      res.setDiagnosis(diagnosis);
11801    if (json.has("type")) {
11802      JsonArray array = json.getAsJsonArray("type");
11803      for (int i = 0; i < array.size(); i++) {
11804        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11805      }
11806    };
11807    if (json.has("onAdmission"))
11808      res.setOnAdmission(parseCodeableConcept(json.getAsJsonObject("onAdmission")));
11809    if (json.has("packageCode"))
11810      res.setPackageCode(parseCodeableConcept(json.getAsJsonObject("packageCode")));
11811  }
11812
11813  protected ExplanationOfBenefit.ProcedureComponent parseExplanationOfBenefitProcedureComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11814    ExplanationOfBenefit.ProcedureComponent res = new ExplanationOfBenefit.ProcedureComponent();
11815    parseExplanationOfBenefitProcedureComponentProperties(json, owner, res);
11816    return res;
11817  }
11818
11819  protected void parseExplanationOfBenefitProcedureComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.ProcedureComponent res) throws IOException, FHIRFormatError {
11820    parseBackboneElementProperties(json, res);
11821    if (json.has("sequence"))
11822      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
11823    if (json.has("_sequence"))
11824      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
11825    if (json.has("type")) {
11826      JsonArray array = json.getAsJsonArray("type");
11827      for (int i = 0; i < array.size(); i++) {
11828        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11829      }
11830    };
11831    if (json.has("date"))
11832      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11833    if (json.has("_date"))
11834      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11835    Type procedure = parseType("procedure", json);
11836    if (procedure != null)
11837      res.setProcedure(procedure);
11838    if (json.has("udi")) {
11839      JsonArray array = json.getAsJsonArray("udi");
11840      for (int i = 0; i < array.size(); i++) {
11841        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
11842      }
11843    };
11844  }
11845
11846  protected ExplanationOfBenefit.InsuranceComponent parseExplanationOfBenefitInsuranceComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11847    ExplanationOfBenefit.InsuranceComponent res = new ExplanationOfBenefit.InsuranceComponent();
11848    parseExplanationOfBenefitInsuranceComponentProperties(json, owner, res);
11849    return res;
11850  }
11851
11852  protected void parseExplanationOfBenefitInsuranceComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.InsuranceComponent res) throws IOException, FHIRFormatError {
11853    parseBackboneElementProperties(json, res);
11854    if (json.has("focal"))
11855      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
11856    if (json.has("_focal"))
11857      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
11858    if (json.has("coverage"))
11859      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
11860    if (json.has("preAuthRef")) {
11861      JsonArray array = json.getAsJsonArray("preAuthRef");
11862      for (int i = 0; i < array.size(); i++) {
11863        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
11864      }
11865    };
11866    if (json.has("_preAuthRef")) {
11867      JsonArray array = json.getAsJsonArray("_preAuthRef");
11868      for (int i = 0; i < array.size(); i++) {
11869        if (i == res.getPreAuthRef().size())
11870          res.getPreAuthRef().add(parseString(null));
11871        if (array.get(i) instanceof JsonObject) 
11872          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
11873      }
11874    };
11875  }
11876
11877  protected ExplanationOfBenefit.AccidentComponent parseExplanationOfBenefitAccidentComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11878    ExplanationOfBenefit.AccidentComponent res = new ExplanationOfBenefit.AccidentComponent();
11879    parseExplanationOfBenefitAccidentComponentProperties(json, owner, res);
11880    return res;
11881  }
11882
11883  protected void parseExplanationOfBenefitAccidentComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AccidentComponent res) throws IOException, FHIRFormatError {
11884    parseBackboneElementProperties(json, res);
11885    if (json.has("date"))
11886      res.setDateElement(parseDate(json.get("date").getAsString()));
11887    if (json.has("_date"))
11888      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11889    if (json.has("type"))
11890      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
11891    Type location = parseType("location", json);
11892    if (location != null)
11893      res.setLocation(location);
11894  }
11895
11896  protected ExplanationOfBenefit.ItemComponent parseExplanationOfBenefitItemComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11897    ExplanationOfBenefit.ItemComponent res = new ExplanationOfBenefit.ItemComponent();
11898    parseExplanationOfBenefitItemComponentProperties(json, owner, res);
11899    return res;
11900  }
11901
11902  protected void parseExplanationOfBenefitItemComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.ItemComponent res) throws IOException, FHIRFormatError {
11903    parseBackboneElementProperties(json, res);
11904    if (json.has("sequence"))
11905      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
11906    if (json.has("_sequence"))
11907      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
11908    if (json.has("careTeamSequence")) {
11909      JsonArray array = json.getAsJsonArray("careTeamSequence");
11910      for (int i = 0; i < array.size(); i++) {
11911        res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
11912      }
11913    };
11914    if (json.has("_careTeamSequence")) {
11915      JsonArray array = json.getAsJsonArray("_careTeamSequence");
11916      for (int i = 0; i < array.size(); i++) {
11917        if (i == res.getCareTeamSequence().size())
11918          res.getCareTeamSequence().add(parsePositiveInt(null));
11919        if (array.get(i) instanceof JsonObject) 
11920          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
11921      }
11922    };
11923    if (json.has("diagnosisSequence")) {
11924      JsonArray array = json.getAsJsonArray("diagnosisSequence");
11925      for (int i = 0; i < array.size(); i++) {
11926        res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
11927      }
11928    };
11929    if (json.has("_diagnosisSequence")) {
11930      JsonArray array = json.getAsJsonArray("_diagnosisSequence");
11931      for (int i = 0; i < array.size(); i++) {
11932        if (i == res.getDiagnosisSequence().size())
11933          res.getDiagnosisSequence().add(parsePositiveInt(null));
11934        if (array.get(i) instanceof JsonObject) 
11935          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
11936      }
11937    };
11938    if (json.has("procedureSequence")) {
11939      JsonArray array = json.getAsJsonArray("procedureSequence");
11940      for (int i = 0; i < array.size(); i++) {
11941        res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
11942      }
11943    };
11944    if (json.has("_procedureSequence")) {
11945      JsonArray array = json.getAsJsonArray("_procedureSequence");
11946      for (int i = 0; i < array.size(); i++) {
11947        if (i == res.getProcedureSequence().size())
11948          res.getProcedureSequence().add(parsePositiveInt(null));
11949        if (array.get(i) instanceof JsonObject) 
11950          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
11951      }
11952    };
11953    if (json.has("informationSequence")) {
11954      JsonArray array = json.getAsJsonArray("informationSequence");
11955      for (int i = 0; i < array.size(); i++) {
11956        res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
11957      }
11958    };
11959    if (json.has("_informationSequence")) {
11960      JsonArray array = json.getAsJsonArray("_informationSequence");
11961      for (int i = 0; i < array.size(); i++) {
11962        if (i == res.getInformationSequence().size())
11963          res.getInformationSequence().add(parsePositiveInt(null));
11964        if (array.get(i) instanceof JsonObject) 
11965          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
11966      }
11967    };
11968    if (json.has("revenue"))
11969      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
11970    if (json.has("category"))
11971      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
11972    if (json.has("productOrService"))
11973      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
11974    if (json.has("modifier")) {
11975      JsonArray array = json.getAsJsonArray("modifier");
11976      for (int i = 0; i < array.size(); i++) {
11977        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11978      }
11979    };
11980    if (json.has("programCode")) {
11981      JsonArray array = json.getAsJsonArray("programCode");
11982      for (int i = 0; i < array.size(); i++) {
11983        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11984      }
11985    };
11986    Type serviced = parseType("serviced", json);
11987    if (serviced != null)
11988      res.setServiced(serviced);
11989    Type location = parseType("location", json);
11990    if (location != null)
11991      res.setLocation(location);
11992    if (json.has("quantity"))
11993      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
11994    if (json.has("unitPrice"))
11995      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
11996    if (json.has("factor"))
11997      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
11998    if (json.has("_factor"))
11999      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
12000    if (json.has("net"))
12001      res.setNet(parseMoney(json.getAsJsonObject("net")));
12002    if (json.has("udi")) {
12003      JsonArray array = json.getAsJsonArray("udi");
12004      for (int i = 0; i < array.size(); i++) {
12005        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
12006      }
12007    };
12008    if (json.has("bodySite"))
12009      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
12010    if (json.has("subSite")) {
12011      JsonArray array = json.getAsJsonArray("subSite");
12012      for (int i = 0; i < array.size(); i++) {
12013        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12014      }
12015    };
12016    if (json.has("encounter")) {
12017      JsonArray array = json.getAsJsonArray("encounter");
12018      for (int i = 0; i < array.size(); i++) {
12019        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
12020      }
12021    };
12022    if (json.has("noteNumber")) {
12023      JsonArray array = json.getAsJsonArray("noteNumber");
12024      for (int i = 0; i < array.size(); i++) {
12025        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12026      }
12027    };
12028    if (json.has("_noteNumber")) {
12029      JsonArray array = json.getAsJsonArray("_noteNumber");
12030      for (int i = 0; i < array.size(); i++) {
12031        if (i == res.getNoteNumber().size())
12032          res.getNoteNumber().add(parsePositiveInt(null));
12033        if (array.get(i) instanceof JsonObject) 
12034          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12035      }
12036    };
12037    if (json.has("adjudication")) {
12038      JsonArray array = json.getAsJsonArray("adjudication");
12039      for (int i = 0; i < array.size(); i++) {
12040        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12041      }
12042    };
12043    if (json.has("detail")) {
12044      JsonArray array = json.getAsJsonArray("detail");
12045      for (int i = 0; i < array.size(); i++) {
12046        res.getDetail().add(parseExplanationOfBenefitDetailComponent(array.get(i).getAsJsonObject(), owner));
12047      }
12048    };
12049  }
12050
12051  protected ExplanationOfBenefit.AdjudicationComponent parseExplanationOfBenefitAdjudicationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12052    ExplanationOfBenefit.AdjudicationComponent res = new ExplanationOfBenefit.AdjudicationComponent();
12053    parseExplanationOfBenefitAdjudicationComponentProperties(json, owner, res);
12054    return res;
12055  }
12056
12057  protected void parseExplanationOfBenefitAdjudicationComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AdjudicationComponent res) throws IOException, FHIRFormatError {
12058    parseBackboneElementProperties(json, res);
12059    if (json.has("category"))
12060      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
12061    if (json.has("reason"))
12062      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
12063    if (json.has("amount"))
12064      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
12065    if (json.has("value"))
12066      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
12067    if (json.has("_value"))
12068      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
12069  }
12070
12071  protected ExplanationOfBenefit.DetailComponent parseExplanationOfBenefitDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12072    ExplanationOfBenefit.DetailComponent res = new ExplanationOfBenefit.DetailComponent();
12073    parseExplanationOfBenefitDetailComponentProperties(json, owner, res);
12074    return res;
12075  }
12076
12077  protected void parseExplanationOfBenefitDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.DetailComponent res) throws IOException, FHIRFormatError {
12078    parseBackboneElementProperties(json, res);
12079    if (json.has("sequence"))
12080      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
12081    if (json.has("_sequence"))
12082      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
12083    if (json.has("revenue"))
12084      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
12085    if (json.has("category"))
12086      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
12087    if (json.has("productOrService"))
12088      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
12089    if (json.has("modifier")) {
12090      JsonArray array = json.getAsJsonArray("modifier");
12091      for (int i = 0; i < array.size(); i++) {
12092        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12093      }
12094    };
12095    if (json.has("programCode")) {
12096      JsonArray array = json.getAsJsonArray("programCode");
12097      for (int i = 0; i < array.size(); i++) {
12098        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12099      }
12100    };
12101    if (json.has("quantity"))
12102      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
12103    if (json.has("unitPrice"))
12104      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
12105    if (json.has("factor"))
12106      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
12107    if (json.has("_factor"))
12108      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
12109    if (json.has("net"))
12110      res.setNet(parseMoney(json.getAsJsonObject("net")));
12111    if (json.has("udi")) {
12112      JsonArray array = json.getAsJsonArray("udi");
12113      for (int i = 0; i < array.size(); i++) {
12114        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
12115      }
12116    };
12117    if (json.has("noteNumber")) {
12118      JsonArray array = json.getAsJsonArray("noteNumber");
12119      for (int i = 0; i < array.size(); i++) {
12120        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12121      }
12122    };
12123    if (json.has("_noteNumber")) {
12124      JsonArray array = json.getAsJsonArray("_noteNumber");
12125      for (int i = 0; i < array.size(); i++) {
12126        if (i == res.getNoteNumber().size())
12127          res.getNoteNumber().add(parsePositiveInt(null));
12128        if (array.get(i) instanceof JsonObject) 
12129          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12130      }
12131    };
12132    if (json.has("adjudication")) {
12133      JsonArray array = json.getAsJsonArray("adjudication");
12134      for (int i = 0; i < array.size(); i++) {
12135        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12136      }
12137    };
12138    if (json.has("subDetail")) {
12139      JsonArray array = json.getAsJsonArray("subDetail");
12140      for (int i = 0; i < array.size(); i++) {
12141        res.getSubDetail().add(parseExplanationOfBenefitSubDetailComponent(array.get(i).getAsJsonObject(), owner));
12142      }
12143    };
12144  }
12145
12146  protected ExplanationOfBenefit.SubDetailComponent parseExplanationOfBenefitSubDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12147    ExplanationOfBenefit.SubDetailComponent res = new ExplanationOfBenefit.SubDetailComponent();
12148    parseExplanationOfBenefitSubDetailComponentProperties(json, owner, res);
12149    return res;
12150  }
12151
12152  protected void parseExplanationOfBenefitSubDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.SubDetailComponent res) throws IOException, FHIRFormatError {
12153    parseBackboneElementProperties(json, res);
12154    if (json.has("sequence"))
12155      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
12156    if (json.has("_sequence"))
12157      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
12158    if (json.has("revenue"))
12159      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
12160    if (json.has("category"))
12161      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
12162    if (json.has("productOrService"))
12163      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
12164    if (json.has("modifier")) {
12165      JsonArray array = json.getAsJsonArray("modifier");
12166      for (int i = 0; i < array.size(); i++) {
12167        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12168      }
12169    };
12170    if (json.has("programCode")) {
12171      JsonArray array = json.getAsJsonArray("programCode");
12172      for (int i = 0; i < array.size(); i++) {
12173        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12174      }
12175    };
12176    if (json.has("quantity"))
12177      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
12178    if (json.has("unitPrice"))
12179      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
12180    if (json.has("factor"))
12181      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
12182    if (json.has("_factor"))
12183      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
12184    if (json.has("net"))
12185      res.setNet(parseMoney(json.getAsJsonObject("net")));
12186    if (json.has("udi")) {
12187      JsonArray array = json.getAsJsonArray("udi");
12188      for (int i = 0; i < array.size(); i++) {
12189        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
12190      }
12191    };
12192    if (json.has("noteNumber")) {
12193      JsonArray array = json.getAsJsonArray("noteNumber");
12194      for (int i = 0; i < array.size(); i++) {
12195        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12196      }
12197    };
12198    if (json.has("_noteNumber")) {
12199      JsonArray array = json.getAsJsonArray("_noteNumber");
12200      for (int i = 0; i < array.size(); i++) {
12201        if (i == res.getNoteNumber().size())
12202          res.getNoteNumber().add(parsePositiveInt(null));
12203        if (array.get(i) instanceof JsonObject) 
12204          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12205      }
12206    };
12207    if (json.has("adjudication")) {
12208      JsonArray array = json.getAsJsonArray("adjudication");
12209      for (int i = 0; i < array.size(); i++) {
12210        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12211      }
12212    };
12213  }
12214
12215  protected ExplanationOfBenefit.AddedItemComponent parseExplanationOfBenefitAddedItemComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12216    ExplanationOfBenefit.AddedItemComponent res = new ExplanationOfBenefit.AddedItemComponent();
12217    parseExplanationOfBenefitAddedItemComponentProperties(json, owner, res);
12218    return res;
12219  }
12220
12221  protected void parseExplanationOfBenefitAddedItemComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemComponent res) throws IOException, FHIRFormatError {
12222    parseBackboneElementProperties(json, res);
12223    if (json.has("itemSequence")) {
12224      JsonArray array = json.getAsJsonArray("itemSequence");
12225      for (int i = 0; i < array.size(); i++) {
12226        res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
12227      }
12228    };
12229    if (json.has("_itemSequence")) {
12230      JsonArray array = json.getAsJsonArray("_itemSequence");
12231      for (int i = 0; i < array.size(); i++) {
12232        if (i == res.getItemSequence().size())
12233          res.getItemSequence().add(parsePositiveInt(null));
12234        if (array.get(i) instanceof JsonObject) 
12235          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
12236      }
12237    };
12238    if (json.has("detailSequence")) {
12239      JsonArray array = json.getAsJsonArray("detailSequence");
12240      for (int i = 0; i < array.size(); i++) {
12241        res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
12242      }
12243    };
12244    if (json.has("_detailSequence")) {
12245      JsonArray array = json.getAsJsonArray("_detailSequence");
12246      for (int i = 0; i < array.size(); i++) {
12247        if (i == res.getDetailSequence().size())
12248          res.getDetailSequence().add(parsePositiveInt(null));
12249        if (array.get(i) instanceof JsonObject) 
12250          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
12251      }
12252    };
12253    if (json.has("subDetailSequence")) {
12254      JsonArray array = json.getAsJsonArray("subDetailSequence");
12255      for (int i = 0; i < array.size(); i++) {
12256        res.getSubDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
12257      }
12258    };
12259    if (json.has("_subDetailSequence")) {
12260      JsonArray array = json.getAsJsonArray("_subDetailSequence");
12261      for (int i = 0; i < array.size(); i++) {
12262        if (i == res.getSubDetailSequence().size())
12263          res.getSubDetailSequence().add(parsePositiveInt(null));
12264        if (array.get(i) instanceof JsonObject) 
12265          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubDetailSequence().get(i));
12266      }
12267    };
12268    if (json.has("provider")) {
12269      JsonArray array = json.getAsJsonArray("provider");
12270      for (int i = 0; i < array.size(); i++) {
12271        res.getProvider().add(parseReference(array.get(i).getAsJsonObject()));
12272      }
12273    };
12274    if (json.has("productOrService"))
12275      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
12276    if (json.has("modifier")) {
12277      JsonArray array = json.getAsJsonArray("modifier");
12278      for (int i = 0; i < array.size(); i++) {
12279        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12280      }
12281    };
12282    if (json.has("programCode")) {
12283      JsonArray array = json.getAsJsonArray("programCode");
12284      for (int i = 0; i < array.size(); i++) {
12285        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12286      }
12287    };
12288    Type serviced = parseType("serviced", json);
12289    if (serviced != null)
12290      res.setServiced(serviced);
12291    Type location = parseType("location", json);
12292    if (location != null)
12293      res.setLocation(location);
12294    if (json.has("quantity"))
12295      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
12296    if (json.has("unitPrice"))
12297      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
12298    if (json.has("factor"))
12299      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
12300    if (json.has("_factor"))
12301      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
12302    if (json.has("net"))
12303      res.setNet(parseMoney(json.getAsJsonObject("net")));
12304    if (json.has("bodySite"))
12305      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
12306    if (json.has("subSite")) {
12307      JsonArray array = json.getAsJsonArray("subSite");
12308      for (int i = 0; i < array.size(); i++) {
12309        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12310      }
12311    };
12312    if (json.has("noteNumber")) {
12313      JsonArray array = json.getAsJsonArray("noteNumber");
12314      for (int i = 0; i < array.size(); i++) {
12315        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12316      }
12317    };
12318    if (json.has("_noteNumber")) {
12319      JsonArray array = json.getAsJsonArray("_noteNumber");
12320      for (int i = 0; i < array.size(); i++) {
12321        if (i == res.getNoteNumber().size())
12322          res.getNoteNumber().add(parsePositiveInt(null));
12323        if (array.get(i) instanceof JsonObject) 
12324          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12325      }
12326    };
12327    if (json.has("adjudication")) {
12328      JsonArray array = json.getAsJsonArray("adjudication");
12329      for (int i = 0; i < array.size(); i++) {
12330        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12331      }
12332    };
12333    if (json.has("detail")) {
12334      JsonArray array = json.getAsJsonArray("detail");
12335      for (int i = 0; i < array.size(); i++) {
12336        res.getDetail().add(parseExplanationOfBenefitAddedItemDetailComponent(array.get(i).getAsJsonObject(), owner));
12337      }
12338    };
12339  }
12340
12341  protected ExplanationOfBenefit.AddedItemDetailComponent parseExplanationOfBenefitAddedItemDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12342    ExplanationOfBenefit.AddedItemDetailComponent res = new ExplanationOfBenefit.AddedItemDetailComponent();
12343    parseExplanationOfBenefitAddedItemDetailComponentProperties(json, owner, res);
12344    return res;
12345  }
12346
12347  protected void parseExplanationOfBenefitAddedItemDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemDetailComponent res) throws IOException, FHIRFormatError {
12348    parseBackboneElementProperties(json, res);
12349    if (json.has("productOrService"))
12350      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
12351    if (json.has("modifier")) {
12352      JsonArray array = json.getAsJsonArray("modifier");
12353      for (int i = 0; i < array.size(); i++) {
12354        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12355      }
12356    };
12357    if (json.has("quantity"))
12358      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
12359    if (json.has("unitPrice"))
12360      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
12361    if (json.has("factor"))
12362      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
12363    if (json.has("_factor"))
12364      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
12365    if (json.has("net"))
12366      res.setNet(parseMoney(json.getAsJsonObject("net")));
12367    if (json.has("noteNumber")) {
12368      JsonArray array = json.getAsJsonArray("noteNumber");
12369      for (int i = 0; i < array.size(); i++) {
12370        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12371      }
12372    };
12373    if (json.has("_noteNumber")) {
12374      JsonArray array = json.getAsJsonArray("_noteNumber");
12375      for (int i = 0; i < array.size(); i++) {
12376        if (i == res.getNoteNumber().size())
12377          res.getNoteNumber().add(parsePositiveInt(null));
12378        if (array.get(i) instanceof JsonObject) 
12379          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12380      }
12381    };
12382    if (json.has("adjudication")) {
12383      JsonArray array = json.getAsJsonArray("adjudication");
12384      for (int i = 0; i < array.size(); i++) {
12385        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12386      }
12387    };
12388    if (json.has("subDetail")) {
12389      JsonArray array = json.getAsJsonArray("subDetail");
12390      for (int i = 0; i < array.size(); i++) {
12391        res.getSubDetail().add(parseExplanationOfBenefitAddedItemDetailSubDetailComponent(array.get(i).getAsJsonObject(), owner));
12392      }
12393    };
12394  }
12395
12396  protected ExplanationOfBenefit.AddedItemDetailSubDetailComponent parseExplanationOfBenefitAddedItemDetailSubDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12397    ExplanationOfBenefit.AddedItemDetailSubDetailComponent res = new ExplanationOfBenefit.AddedItemDetailSubDetailComponent();
12398    parseExplanationOfBenefitAddedItemDetailSubDetailComponentProperties(json, owner, res);
12399    return res;
12400  }
12401
12402  protected void parseExplanationOfBenefitAddedItemDetailSubDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemDetailSubDetailComponent res) throws IOException, FHIRFormatError {
12403    parseBackboneElementProperties(json, res);
12404    if (json.has("productOrService"))
12405      res.setProductOrService(parseCodeableConcept(json.getAsJsonObject("productOrService")));
12406    if (json.has("modifier")) {
12407      JsonArray array = json.getAsJsonArray("modifier");
12408      for (int i = 0; i < array.size(); i++) {
12409        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12410      }
12411    };
12412    if (json.has("quantity"))
12413      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
12414    if (json.has("unitPrice"))
12415      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
12416    if (json.has("factor"))
12417      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
12418    if (json.has("_factor"))
12419      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
12420    if (json.has("net"))
12421      res.setNet(parseMoney(json.getAsJsonObject("net")));
12422    if (json.has("noteNumber")) {
12423      JsonArray array = json.getAsJsonArray("noteNumber");
12424      for (int i = 0; i < array.size(); i++) {
12425        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
12426      }
12427    };
12428    if (json.has("_noteNumber")) {
12429      JsonArray array = json.getAsJsonArray("_noteNumber");
12430      for (int i = 0; i < array.size(); i++) {
12431        if (i == res.getNoteNumber().size())
12432          res.getNoteNumber().add(parsePositiveInt(null));
12433        if (array.get(i) instanceof JsonObject) 
12434          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
12435      }
12436    };
12437    if (json.has("adjudication")) {
12438      JsonArray array = json.getAsJsonArray("adjudication");
12439      for (int i = 0; i < array.size(); i++) {
12440        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
12441      }
12442    };
12443  }
12444
12445  protected ExplanationOfBenefit.TotalComponent parseExplanationOfBenefitTotalComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12446    ExplanationOfBenefit.TotalComponent res = new ExplanationOfBenefit.TotalComponent();
12447    parseExplanationOfBenefitTotalComponentProperties(json, owner, res);
12448    return res;
12449  }
12450
12451  protected void parseExplanationOfBenefitTotalComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.TotalComponent res) throws IOException, FHIRFormatError {
12452    parseBackboneElementProperties(json, res);
12453    if (json.has("category"))
12454      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
12455    if (json.has("amount"))
12456      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
12457  }
12458
12459  protected ExplanationOfBenefit.PaymentComponent parseExplanationOfBenefitPaymentComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12460    ExplanationOfBenefit.PaymentComponent res = new ExplanationOfBenefit.PaymentComponent();
12461    parseExplanationOfBenefitPaymentComponentProperties(json, owner, res);
12462    return res;
12463  }
12464
12465  protected void parseExplanationOfBenefitPaymentComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.PaymentComponent res) throws IOException, FHIRFormatError {
12466    parseBackboneElementProperties(json, res);
12467    if (json.has("type"))
12468      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
12469    if (json.has("adjustment"))
12470      res.setAdjustment(parseMoney(json.getAsJsonObject("adjustment")));
12471    if (json.has("adjustmentReason"))
12472      res.setAdjustmentReason(parseCodeableConcept(json.getAsJsonObject("adjustmentReason")));
12473    if (json.has("date"))
12474      res.setDateElement(parseDate(json.get("date").getAsString()));
12475    if (json.has("_date"))
12476      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12477    if (json.has("amount"))
12478      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
12479    if (json.has("identifier"))
12480      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
12481  }
12482
12483  protected ExplanationOfBenefit.NoteComponent parseExplanationOfBenefitNoteComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12484    ExplanationOfBenefit.NoteComponent res = new ExplanationOfBenefit.NoteComponent();
12485    parseExplanationOfBenefitNoteComponentProperties(json, owner, res);
12486    return res;
12487  }
12488
12489  protected void parseExplanationOfBenefitNoteComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.NoteComponent res) throws IOException, FHIRFormatError {
12490    parseBackboneElementProperties(json, res);
12491    if (json.has("number"))
12492      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
12493    if (json.has("_number"))
12494      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
12495    if (json.has("type"))
12496      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
12497    if (json.has("_type"))
12498      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
12499    if (json.has("text"))
12500      res.setTextElement(parseString(json.get("text").getAsString()));
12501    if (json.has("_text"))
12502      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
12503    if (json.has("language"))
12504      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
12505  }
12506
12507  protected ExplanationOfBenefit.BenefitBalanceComponent parseExplanationOfBenefitBenefitBalanceComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12508    ExplanationOfBenefit.BenefitBalanceComponent res = new ExplanationOfBenefit.BenefitBalanceComponent();
12509    parseExplanationOfBenefitBenefitBalanceComponentProperties(json, owner, res);
12510    return res;
12511  }
12512
12513  protected void parseExplanationOfBenefitBenefitBalanceComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.BenefitBalanceComponent res) throws IOException, FHIRFormatError {
12514    parseBackboneElementProperties(json, res);
12515    if (json.has("category"))
12516      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
12517    if (json.has("excluded"))
12518      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
12519    if (json.has("_excluded"))
12520      parseElementProperties(json.getAsJsonObject("_excluded"), res.getExcludedElement());
12521    if (json.has("name"))
12522      res.setNameElement(parseString(json.get("name").getAsString()));
12523    if (json.has("_name"))
12524      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12525    if (json.has("description"))
12526      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12527    if (json.has("_description"))
12528      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12529    if (json.has("network"))
12530      res.setNetwork(parseCodeableConcept(json.getAsJsonObject("network")));
12531    if (json.has("unit"))
12532      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
12533    if (json.has("term"))
12534      res.setTerm(parseCodeableConcept(json.getAsJsonObject("term")));
12535    if (json.has("financial")) {
12536      JsonArray array = json.getAsJsonArray("financial");
12537      for (int i = 0; i < array.size(); i++) {
12538        res.getFinancial().add(parseExplanationOfBenefitBenefitComponent(array.get(i).getAsJsonObject(), owner));
12539      }
12540    };
12541  }
12542
12543  protected ExplanationOfBenefit.BenefitComponent parseExplanationOfBenefitBenefitComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
12544    ExplanationOfBenefit.BenefitComponent res = new ExplanationOfBenefit.BenefitComponent();
12545    parseExplanationOfBenefitBenefitComponentProperties(json, owner, res);
12546    return res;
12547  }
12548
12549  protected void parseExplanationOfBenefitBenefitComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.BenefitComponent res) throws IOException, FHIRFormatError {
12550    parseBackboneElementProperties(json, res);
12551    if (json.has("type"))
12552      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
12553    Type allowed = parseType("allowed", json);
12554    if (allowed != null)
12555      res.setAllowed(allowed);
12556    Type used = parseType("used", json);
12557    if (used != null)
12558      res.setUsed(used);
12559  }
12560
12561  protected FamilyMemberHistory parseFamilyMemberHistory(JsonObject json) throws IOException, FHIRFormatError {
12562    FamilyMemberHistory res = new FamilyMemberHistory();
12563    parseFamilyMemberHistoryProperties(json, res);
12564    return res;
12565  }
12566
12567  protected void parseFamilyMemberHistoryProperties(JsonObject json, FamilyMemberHistory res) throws IOException, FHIRFormatError {
12568    parseDomainResourceProperties(json, res);
12569    if (json.has("identifier")) {
12570      JsonArray array = json.getAsJsonArray("identifier");
12571      for (int i = 0; i < array.size(); i++) {
12572        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12573      }
12574    };
12575    if (json.has("instantiatesCanonical")) {
12576      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
12577      for (int i = 0; i < array.size(); i++) {
12578        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
12579      }
12580    };
12581    if (json.has("_instantiatesCanonical")) {
12582      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
12583      for (int i = 0; i < array.size(); i++) {
12584        if (i == res.getInstantiatesCanonical().size())
12585          res.getInstantiatesCanonical().add(parseCanonical(null));
12586        if (array.get(i) instanceof JsonObject) 
12587          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
12588      }
12589    };
12590    if (json.has("instantiatesUri")) {
12591      JsonArray array = json.getAsJsonArray("instantiatesUri");
12592      for (int i = 0; i < array.size(); i++) {
12593        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
12594      }
12595    };
12596    if (json.has("_instantiatesUri")) {
12597      JsonArray array = json.getAsJsonArray("_instantiatesUri");
12598      for (int i = 0; i < array.size(); i++) {
12599        if (i == res.getInstantiatesUri().size())
12600          res.getInstantiatesUri().add(parseUri(null));
12601        if (array.get(i) instanceof JsonObject) 
12602          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
12603      }
12604    };
12605    if (json.has("status"))
12606      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), FamilyMemberHistory.FamilyHistoryStatus.NULL, new FamilyMemberHistory.FamilyHistoryStatusEnumFactory()));
12607    if (json.has("_status"))
12608      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12609    if (json.has("dataAbsentReason"))
12610      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
12611    if (json.has("patient"))
12612      res.setPatient(parseReference(json.getAsJsonObject("patient")));
12613    if (json.has("date"))
12614      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12615    if (json.has("_date"))
12616      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12617    if (json.has("name"))
12618      res.setNameElement(parseString(json.get("name").getAsString()));
12619    if (json.has("_name"))
12620      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12621    if (json.has("relationship"))
12622      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
12623    if (json.has("sex"))
12624      res.setSex(parseCodeableConcept(json.getAsJsonObject("sex")));
12625    Type born = parseType("born", json);
12626    if (born != null)
12627      res.setBorn(born);
12628    Type age = parseType("age", json);
12629    if (age != null)
12630      res.setAge(age);
12631    if (json.has("estimatedAge"))
12632      res.setEstimatedAgeElement(parseBoolean(json.get("estimatedAge").getAsBoolean()));
12633    if (json.has("_estimatedAge"))
12634      parseElementProperties(json.getAsJsonObject("_estimatedAge"), res.getEstimatedAgeElement());
12635    Type deceased = parseType("deceased", json);
12636    if (deceased != null)
12637      res.setDeceased(deceased);
12638    if (json.has("reasonCode")) {
12639      JsonArray array = json.getAsJsonArray("reasonCode");
12640      for (int i = 0; i < array.size(); i++) {
12641        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12642      }
12643    };
12644    if (json.has("reasonReference")) {
12645      JsonArray array = json.getAsJsonArray("reasonReference");
12646      for (int i = 0; i < array.size(); i++) {
12647        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
12648      }
12649    };
12650    if (json.has("note")) {
12651      JsonArray array = json.getAsJsonArray("note");
12652      for (int i = 0; i < array.size(); i++) {
12653        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12654      }
12655    };
12656    if (json.has("condition")) {
12657      JsonArray array = json.getAsJsonArray("condition");
12658      for (int i = 0; i < array.size(); i++) {
12659        res.getCondition().add(parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(array.get(i).getAsJsonObject(), res));
12660      }
12661    };
12662  }
12663
12664  protected FamilyMemberHistory.FamilyMemberHistoryConditionComponent parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(JsonObject json, FamilyMemberHistory owner) throws IOException, FHIRFormatError {
12665    FamilyMemberHistory.FamilyMemberHistoryConditionComponent res = new FamilyMemberHistory.FamilyMemberHistoryConditionComponent();
12666    parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentProperties(json, owner, res);
12667    return res;
12668  }
12669
12670  protected void parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentProperties(JsonObject json, FamilyMemberHistory owner, FamilyMemberHistory.FamilyMemberHistoryConditionComponent res) throws IOException, FHIRFormatError {
12671    parseBackboneElementProperties(json, res);
12672    if (json.has("code"))
12673      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
12674    if (json.has("outcome"))
12675      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
12676    if (json.has("contributedToDeath"))
12677      res.setContributedToDeathElement(parseBoolean(json.get("contributedToDeath").getAsBoolean()));
12678    if (json.has("_contributedToDeath"))
12679      parseElementProperties(json.getAsJsonObject("_contributedToDeath"), res.getContributedToDeathElement());
12680    Type onset = parseType("onset", json);
12681    if (onset != null)
12682      res.setOnset(onset);
12683    if (json.has("note")) {
12684      JsonArray array = json.getAsJsonArray("note");
12685      for (int i = 0; i < array.size(); i++) {
12686        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12687      }
12688    };
12689  }
12690
12691  protected Flag parseFlag(JsonObject json) throws IOException, FHIRFormatError {
12692    Flag res = new Flag();
12693    parseFlagProperties(json, res);
12694    return res;
12695  }
12696
12697  protected void parseFlagProperties(JsonObject json, Flag res) throws IOException, FHIRFormatError {
12698    parseDomainResourceProperties(json, res);
12699    if (json.has("identifier")) {
12700      JsonArray array = json.getAsJsonArray("identifier");
12701      for (int i = 0; i < array.size(); i++) {
12702        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12703      }
12704    };
12705    if (json.has("status"))
12706      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Flag.FlagStatus.NULL, new Flag.FlagStatusEnumFactory()));
12707    if (json.has("_status"))
12708      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12709    if (json.has("category")) {
12710      JsonArray array = json.getAsJsonArray("category");
12711      for (int i = 0; i < array.size(); i++) {
12712        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12713      }
12714    };
12715    if (json.has("code"))
12716      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
12717    if (json.has("subject"))
12718      res.setSubject(parseReference(json.getAsJsonObject("subject")));
12719    if (json.has("period"))
12720      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
12721    if (json.has("encounter"))
12722      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
12723    if (json.has("author"))
12724      res.setAuthor(parseReference(json.getAsJsonObject("author")));
12725  }
12726
12727  protected Goal parseGoal(JsonObject json) throws IOException, FHIRFormatError {
12728    Goal res = new Goal();
12729    parseGoalProperties(json, res);
12730    return res;
12731  }
12732
12733  protected void parseGoalProperties(JsonObject json, Goal res) throws IOException, FHIRFormatError {
12734    parseDomainResourceProperties(json, res);
12735    if (json.has("identifier")) {
12736      JsonArray array = json.getAsJsonArray("identifier");
12737      for (int i = 0; i < array.size(); i++) {
12738        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12739      }
12740    };
12741    if (json.has("lifecycleStatus"))
12742      res.setLifecycleStatusElement(parseEnumeration(json.get("lifecycleStatus").getAsString(), Goal.GoalLifecycleStatus.NULL, new Goal.GoalLifecycleStatusEnumFactory()));
12743    if (json.has("_lifecycleStatus"))
12744      parseElementProperties(json.getAsJsonObject("_lifecycleStatus"), res.getLifecycleStatusElement());
12745    if (json.has("achievementStatus"))
12746      res.setAchievementStatus(parseCodeableConcept(json.getAsJsonObject("achievementStatus")));
12747    if (json.has("category")) {
12748      JsonArray array = json.getAsJsonArray("category");
12749      for (int i = 0; i < array.size(); i++) {
12750        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12751      }
12752    };
12753    if (json.has("priority"))
12754      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
12755    if (json.has("description"))
12756      res.setDescription(parseCodeableConcept(json.getAsJsonObject("description")));
12757    if (json.has("subject"))
12758      res.setSubject(parseReference(json.getAsJsonObject("subject")));
12759    Type start = parseType("start", json);
12760    if (start != null)
12761      res.setStart(start);
12762    if (json.has("target")) {
12763      JsonArray array = json.getAsJsonArray("target");
12764      for (int i = 0; i < array.size(); i++) {
12765        res.getTarget().add(parseGoalGoalTargetComponent(array.get(i).getAsJsonObject(), res));
12766      }
12767    };
12768    if (json.has("statusDate"))
12769      res.setStatusDateElement(parseDate(json.get("statusDate").getAsString()));
12770    if (json.has("_statusDate"))
12771      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
12772    if (json.has("statusReason"))
12773      res.setStatusReasonElement(parseString(json.get("statusReason").getAsString()));
12774    if (json.has("_statusReason"))
12775      parseElementProperties(json.getAsJsonObject("_statusReason"), res.getStatusReasonElement());
12776    if (json.has("expressedBy"))
12777      res.setExpressedBy(parseReference(json.getAsJsonObject("expressedBy")));
12778    if (json.has("addresses")) {
12779      JsonArray array = json.getAsJsonArray("addresses");
12780      for (int i = 0; i < array.size(); i++) {
12781        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
12782      }
12783    };
12784    if (json.has("note")) {
12785      JsonArray array = json.getAsJsonArray("note");
12786      for (int i = 0; i < array.size(); i++) {
12787        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12788      }
12789    };
12790    if (json.has("outcomeCode")) {
12791      JsonArray array = json.getAsJsonArray("outcomeCode");
12792      for (int i = 0; i < array.size(); i++) {
12793        res.getOutcomeCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12794      }
12795    };
12796    if (json.has("outcomeReference")) {
12797      JsonArray array = json.getAsJsonArray("outcomeReference");
12798      for (int i = 0; i < array.size(); i++) {
12799        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
12800      }
12801    };
12802  }
12803
12804  protected Goal.GoalTargetComponent parseGoalGoalTargetComponent(JsonObject json, Goal owner) throws IOException, FHIRFormatError {
12805    Goal.GoalTargetComponent res = new Goal.GoalTargetComponent();
12806    parseGoalGoalTargetComponentProperties(json, owner, res);
12807    return res;
12808  }
12809
12810  protected void parseGoalGoalTargetComponentProperties(JsonObject json, Goal owner, Goal.GoalTargetComponent res) throws IOException, FHIRFormatError {
12811    parseBackboneElementProperties(json, res);
12812    if (json.has("measure"))
12813      res.setMeasure(parseCodeableConcept(json.getAsJsonObject("measure")));
12814    Type detail = parseType("detail", json);
12815    if (detail != null)
12816      res.setDetail(detail);
12817    Type due = parseType("due", json);
12818    if (due != null)
12819      res.setDue(due);
12820  }
12821
12822  protected GraphDefinition parseGraphDefinition(JsonObject json) throws IOException, FHIRFormatError {
12823    GraphDefinition res = new GraphDefinition();
12824    parseGraphDefinitionProperties(json, res);
12825    return res;
12826  }
12827
12828  protected void parseGraphDefinitionProperties(JsonObject json, GraphDefinition res) throws IOException, FHIRFormatError {
12829    parseDomainResourceProperties(json, res);
12830    if (json.has("url"))
12831      res.setUrlElement(parseUri(json.get("url").getAsString()));
12832    if (json.has("_url"))
12833      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
12834    if (json.has("version"))
12835      res.setVersionElement(parseString(json.get("version").getAsString()));
12836    if (json.has("_version"))
12837      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
12838    if (json.has("name"))
12839      res.setNameElement(parseString(json.get("name").getAsString()));
12840    if (json.has("_name"))
12841      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12842    if (json.has("status"))
12843      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
12844    if (json.has("_status"))
12845      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12846    if (json.has("experimental"))
12847      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
12848    if (json.has("_experimental"))
12849      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
12850    if (json.has("date"))
12851      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12852    if (json.has("_date"))
12853      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12854    if (json.has("publisher"))
12855      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12856    if (json.has("_publisher"))
12857      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
12858    if (json.has("contact")) {
12859      JsonArray array = json.getAsJsonArray("contact");
12860      for (int i = 0; i < array.size(); i++) {
12861        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12862      }
12863    };
12864    if (json.has("description"))
12865      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12866    if (json.has("_description"))
12867      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12868    if (json.has("useContext")) {
12869      JsonArray array = json.getAsJsonArray("useContext");
12870      for (int i = 0; i < array.size(); i++) {
12871        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12872      }
12873    };
12874    if (json.has("jurisdiction")) {
12875      JsonArray array = json.getAsJsonArray("jurisdiction");
12876      for (int i = 0; i < array.size(); i++) {
12877        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12878      }
12879    };
12880    if (json.has("purpose"))
12881      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
12882    if (json.has("_purpose"))
12883      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
12884    if (json.has("start"))
12885      res.setStartElement(parseCode(json.get("start").getAsString()));
12886    if (json.has("_start"))
12887      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
12888    if (json.has("profile"))
12889      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
12890    if (json.has("_profile"))
12891      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
12892    if (json.has("link")) {
12893      JsonArray array = json.getAsJsonArray("link");
12894      for (int i = 0; i < array.size(); i++) {
12895        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(array.get(i).getAsJsonObject(), res));
12896      }
12897    };
12898  }
12899
12900  protected GraphDefinition.GraphDefinitionLinkComponent parseGraphDefinitionGraphDefinitionLinkComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
12901    GraphDefinition.GraphDefinitionLinkComponent res = new GraphDefinition.GraphDefinitionLinkComponent();
12902    parseGraphDefinitionGraphDefinitionLinkComponentProperties(json, owner, res);
12903    return res;
12904  }
12905
12906  protected void parseGraphDefinitionGraphDefinitionLinkComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkComponent res) throws IOException, FHIRFormatError {
12907    parseBackboneElementProperties(json, res);
12908    if (json.has("path"))
12909      res.setPathElement(parseString(json.get("path").getAsString()));
12910    if (json.has("_path"))
12911      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
12912    if (json.has("sliceName"))
12913      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
12914    if (json.has("_sliceName"))
12915      parseElementProperties(json.getAsJsonObject("_sliceName"), res.getSliceNameElement());
12916    if (json.has("min"))
12917      res.setMinElement(parseInteger(json.get("min").getAsLong()));
12918    if (json.has("_min"))
12919      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
12920    if (json.has("max"))
12921      res.setMaxElement(parseString(json.get("max").getAsString()));
12922    if (json.has("_max"))
12923      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
12924    if (json.has("description"))
12925      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12926    if (json.has("_description"))
12927      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12928    if (json.has("target")) {
12929      JsonArray array = json.getAsJsonArray("target");
12930      for (int i = 0; i < array.size(); i++) {
12931        res.getTarget().add(parseGraphDefinitionGraphDefinitionLinkTargetComponent(array.get(i).getAsJsonObject(), owner));
12932      }
12933    };
12934  }
12935
12936  protected GraphDefinition.GraphDefinitionLinkTargetComponent parseGraphDefinitionGraphDefinitionLinkTargetComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
12937    GraphDefinition.GraphDefinitionLinkTargetComponent res = new GraphDefinition.GraphDefinitionLinkTargetComponent();
12938    parseGraphDefinitionGraphDefinitionLinkTargetComponentProperties(json, owner, res);
12939    return res;
12940  }
12941
12942  protected void parseGraphDefinitionGraphDefinitionLinkTargetComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetComponent res) throws IOException, FHIRFormatError {
12943    parseBackboneElementProperties(json, res);
12944    if (json.has("type"))
12945      res.setTypeElement(parseCode(json.get("type").getAsString()));
12946    if (json.has("_type"))
12947      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
12948    if (json.has("params"))
12949      res.setParamsElement(parseString(json.get("params").getAsString()));
12950    if (json.has("_params"))
12951      parseElementProperties(json.getAsJsonObject("_params"), res.getParamsElement());
12952    if (json.has("profile"))
12953      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
12954    if (json.has("_profile"))
12955      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
12956    if (json.has("compartment")) {
12957      JsonArray array = json.getAsJsonArray("compartment");
12958      for (int i = 0; i < array.size(); i++) {
12959        res.getCompartment().add(parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(array.get(i).getAsJsonObject(), owner));
12960      }
12961    };
12962    if (json.has("link")) {
12963      JsonArray array = json.getAsJsonArray("link");
12964      for (int i = 0; i < array.size(); i++) {
12965        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(array.get(i).getAsJsonObject(), owner));
12966      }
12967    };
12968  }
12969
12970  protected GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
12971    GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res = new GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent();
12972    parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentProperties(json, owner, res);
12973    return res;
12974  }
12975
12976  protected void parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res) throws IOException, FHIRFormatError {
12977    parseBackboneElementProperties(json, res);
12978    if (json.has("use"))
12979      res.setUseElement(parseEnumeration(json.get("use").getAsString(), GraphDefinition.GraphCompartmentUse.NULL, new GraphDefinition.GraphCompartmentUseEnumFactory()));
12980    if (json.has("_use"))
12981      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
12982    if (json.has("code"))
12983      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), GraphDefinition.CompartmentCode.NULL, new GraphDefinition.CompartmentCodeEnumFactory()));
12984    if (json.has("_code"))
12985      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
12986    if (json.has("rule"))
12987      res.setRuleElement(parseEnumeration(json.get("rule").getAsString(), GraphDefinition.GraphCompartmentRule.NULL, new GraphDefinition.GraphCompartmentRuleEnumFactory()));
12988    if (json.has("_rule"))
12989      parseElementProperties(json.getAsJsonObject("_rule"), res.getRuleElement());
12990    if (json.has("expression"))
12991      res.setExpressionElement(parseString(json.get("expression").getAsString()));
12992    if (json.has("_expression"))
12993      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
12994    if (json.has("description"))
12995      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12996    if (json.has("_description"))
12997      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12998  }
12999
13000  protected Group parseGroup(JsonObject json) throws IOException, FHIRFormatError {
13001    Group res = new Group();
13002    parseGroupProperties(json, res);
13003    return res;
13004  }
13005
13006  protected void parseGroupProperties(JsonObject json, Group res) throws IOException, FHIRFormatError {
13007    parseDomainResourceProperties(json, res);
13008    if (json.has("identifier")) {
13009      JsonArray array = json.getAsJsonArray("identifier");
13010      for (int i = 0; i < array.size(); i++) {
13011        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13012      }
13013    };
13014    if (json.has("active"))
13015      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
13016    if (json.has("_active"))
13017      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
13018    if (json.has("type"))
13019      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Group.GroupType.NULL, new Group.GroupTypeEnumFactory()));
13020    if (json.has("_type"))
13021      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
13022    if (json.has("actual"))
13023      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
13024    if (json.has("_actual"))
13025      parseElementProperties(json.getAsJsonObject("_actual"), res.getActualElement());
13026    if (json.has("code"))
13027      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13028    if (json.has("name"))
13029      res.setNameElement(parseString(json.get("name").getAsString()));
13030    if (json.has("_name"))
13031      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13032    if (json.has("quantity"))
13033      res.setQuantityElement(parseUnsignedInt(json.get("quantity").getAsString()));
13034    if (json.has("_quantity"))
13035      parseElementProperties(json.getAsJsonObject("_quantity"), res.getQuantityElement());
13036    if (json.has("managingEntity"))
13037      res.setManagingEntity(parseReference(json.getAsJsonObject("managingEntity")));
13038    if (json.has("characteristic")) {
13039      JsonArray array = json.getAsJsonArray("characteristic");
13040      for (int i = 0; i < array.size(); i++) {
13041        res.getCharacteristic().add(parseGroupGroupCharacteristicComponent(array.get(i).getAsJsonObject(), res));
13042      }
13043    };
13044    if (json.has("member")) {
13045      JsonArray array = json.getAsJsonArray("member");
13046      for (int i = 0; i < array.size(); i++) {
13047        res.getMember().add(parseGroupGroupMemberComponent(array.get(i).getAsJsonObject(), res));
13048      }
13049    };
13050  }
13051
13052  protected Group.GroupCharacteristicComponent parseGroupGroupCharacteristicComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
13053    Group.GroupCharacteristicComponent res = new Group.GroupCharacteristicComponent();
13054    parseGroupGroupCharacteristicComponentProperties(json, owner, res);
13055    return res;
13056  }
13057
13058  protected void parseGroupGroupCharacteristicComponentProperties(JsonObject json, Group owner, Group.GroupCharacteristicComponent res) throws IOException, FHIRFormatError {
13059    parseBackboneElementProperties(json, res);
13060    if (json.has("code"))
13061      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13062    Type value = parseType("value", json);
13063    if (value != null)
13064      res.setValue(value);
13065    if (json.has("exclude"))
13066      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
13067    if (json.has("_exclude"))
13068      parseElementProperties(json.getAsJsonObject("_exclude"), res.getExcludeElement());
13069    if (json.has("period"))
13070      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
13071  }
13072
13073  protected Group.GroupMemberComponent parseGroupGroupMemberComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
13074    Group.GroupMemberComponent res = new Group.GroupMemberComponent();
13075    parseGroupGroupMemberComponentProperties(json, owner, res);
13076    return res;
13077  }
13078
13079  protected void parseGroupGroupMemberComponentProperties(JsonObject json, Group owner, Group.GroupMemberComponent res) throws IOException, FHIRFormatError {
13080    parseBackboneElementProperties(json, res);
13081    if (json.has("entity"))
13082      res.setEntity(parseReference(json.getAsJsonObject("entity")));
13083    if (json.has("period"))
13084      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
13085    if (json.has("inactive"))
13086      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
13087    if (json.has("_inactive"))
13088      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
13089  }
13090
13091  protected GuidanceResponse parseGuidanceResponse(JsonObject json) throws IOException, FHIRFormatError {
13092    GuidanceResponse res = new GuidanceResponse();
13093    parseGuidanceResponseProperties(json, res);
13094    return res;
13095  }
13096
13097  protected void parseGuidanceResponseProperties(JsonObject json, GuidanceResponse res) throws IOException, FHIRFormatError {
13098    parseDomainResourceProperties(json, res);
13099    if (json.has("requestIdentifier"))
13100      res.setRequestIdentifier(parseIdentifier(json.getAsJsonObject("requestIdentifier")));
13101    if (json.has("identifier")) {
13102      JsonArray array = json.getAsJsonArray("identifier");
13103      for (int i = 0; i < array.size(); i++) {
13104        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13105      }
13106    };
13107    Type module = parseType("module", json);
13108    if (module != null)
13109      res.setModule(module);
13110    if (json.has("status"))
13111      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), GuidanceResponse.GuidanceResponseStatus.NULL, new GuidanceResponse.GuidanceResponseStatusEnumFactory()));
13112    if (json.has("_status"))
13113      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13114    if (json.has("subject"))
13115      res.setSubject(parseReference(json.getAsJsonObject("subject")));
13116    if (json.has("encounter"))
13117      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
13118    if (json.has("occurrenceDateTime"))
13119      res.setOccurrenceDateTimeElement(parseDateTime(json.get("occurrenceDateTime").getAsString()));
13120    if (json.has("_occurrenceDateTime"))
13121      parseElementProperties(json.getAsJsonObject("_occurrenceDateTime"), res.getOccurrenceDateTimeElement());
13122    if (json.has("performer"))
13123      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
13124    if (json.has("reasonCode")) {
13125      JsonArray array = json.getAsJsonArray("reasonCode");
13126      for (int i = 0; i < array.size(); i++) {
13127        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13128      }
13129    };
13130    if (json.has("reasonReference")) {
13131      JsonArray array = json.getAsJsonArray("reasonReference");
13132      for (int i = 0; i < array.size(); i++) {
13133        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
13134      }
13135    };
13136    if (json.has("note")) {
13137      JsonArray array = json.getAsJsonArray("note");
13138      for (int i = 0; i < array.size(); i++) {
13139        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13140      }
13141    };
13142    if (json.has("evaluationMessage")) {
13143      JsonArray array = json.getAsJsonArray("evaluationMessage");
13144      for (int i = 0; i < array.size(); i++) {
13145        res.getEvaluationMessage().add(parseReference(array.get(i).getAsJsonObject()));
13146      }
13147    };
13148    if (json.has("outputParameters"))
13149      res.setOutputParameters(parseReference(json.getAsJsonObject("outputParameters")));
13150    if (json.has("result"))
13151      res.setResult(parseReference(json.getAsJsonObject("result")));
13152    if (json.has("dataRequirement")) {
13153      JsonArray array = json.getAsJsonArray("dataRequirement");
13154      for (int i = 0; i < array.size(); i++) {
13155        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
13156      }
13157    };
13158  }
13159
13160  protected HealthcareService parseHealthcareService(JsonObject json) throws IOException, FHIRFormatError {
13161    HealthcareService res = new HealthcareService();
13162    parseHealthcareServiceProperties(json, res);
13163    return res;
13164  }
13165
13166  protected void parseHealthcareServiceProperties(JsonObject json, HealthcareService res) throws IOException, FHIRFormatError {
13167    parseDomainResourceProperties(json, res);
13168    if (json.has("identifier")) {
13169      JsonArray array = json.getAsJsonArray("identifier");
13170      for (int i = 0; i < array.size(); i++) {
13171        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13172      }
13173    };
13174    if (json.has("active"))
13175      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
13176    if (json.has("_active"))
13177      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
13178    if (json.has("providedBy"))
13179      res.setProvidedBy(parseReference(json.getAsJsonObject("providedBy")));
13180    if (json.has("category")) {
13181      JsonArray array = json.getAsJsonArray("category");
13182      for (int i = 0; i < array.size(); i++) {
13183        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13184      }
13185    };
13186    if (json.has("type")) {
13187      JsonArray array = json.getAsJsonArray("type");
13188      for (int i = 0; i < array.size(); i++) {
13189        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13190      }
13191    };
13192    if (json.has("specialty")) {
13193      JsonArray array = json.getAsJsonArray("specialty");
13194      for (int i = 0; i < array.size(); i++) {
13195        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13196      }
13197    };
13198    if (json.has("location")) {
13199      JsonArray array = json.getAsJsonArray("location");
13200      for (int i = 0; i < array.size(); i++) {
13201        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
13202      }
13203    };
13204    if (json.has("name"))
13205      res.setNameElement(parseString(json.get("name").getAsString()));
13206    if (json.has("_name"))
13207      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13208    if (json.has("comment"))
13209      res.setCommentElement(parseString(json.get("comment").getAsString()));
13210    if (json.has("_comment"))
13211      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
13212    if (json.has("extraDetails"))
13213      res.setExtraDetailsElement(parseMarkdown(json.get("extraDetails").getAsString()));
13214    if (json.has("_extraDetails"))
13215      parseElementProperties(json.getAsJsonObject("_extraDetails"), res.getExtraDetailsElement());
13216    if (json.has("photo"))
13217      res.setPhoto(parseAttachment(json.getAsJsonObject("photo")));
13218    if (json.has("telecom")) {
13219      JsonArray array = json.getAsJsonArray("telecom");
13220      for (int i = 0; i < array.size(); i++) {
13221        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
13222      }
13223    };
13224    if (json.has("coverageArea")) {
13225      JsonArray array = json.getAsJsonArray("coverageArea");
13226      for (int i = 0; i < array.size(); i++) {
13227        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
13228      }
13229    };
13230    if (json.has("serviceProvisionCode")) {
13231      JsonArray array = json.getAsJsonArray("serviceProvisionCode");
13232      for (int i = 0; i < array.size(); i++) {
13233        res.getServiceProvisionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13234      }
13235    };
13236    if (json.has("eligibility")) {
13237      JsonArray array = json.getAsJsonArray("eligibility");
13238      for (int i = 0; i < array.size(); i++) {
13239        res.getEligibility().add(parseHealthcareServiceHealthcareServiceEligibilityComponent(array.get(i).getAsJsonObject(), res));
13240      }
13241    };
13242    if (json.has("program")) {
13243      JsonArray array = json.getAsJsonArray("program");
13244      for (int i = 0; i < array.size(); i++) {
13245        res.getProgram().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13246      }
13247    };
13248    if (json.has("characteristic")) {
13249      JsonArray array = json.getAsJsonArray("characteristic");
13250      for (int i = 0; i < array.size(); i++) {
13251        res.getCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13252      }
13253    };
13254    if (json.has("communication")) {
13255      JsonArray array = json.getAsJsonArray("communication");
13256      for (int i = 0; i < array.size(); i++) {
13257        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13258      }
13259    };
13260    if (json.has("referralMethod")) {
13261      JsonArray array = json.getAsJsonArray("referralMethod");
13262      for (int i = 0; i < array.size(); i++) {
13263        res.getReferralMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13264      }
13265    };
13266    if (json.has("appointmentRequired"))
13267      res.setAppointmentRequiredElement(parseBoolean(json.get("appointmentRequired").getAsBoolean()));
13268    if (json.has("_appointmentRequired"))
13269      parseElementProperties(json.getAsJsonObject("_appointmentRequired"), res.getAppointmentRequiredElement());
13270    if (json.has("availableTime")) {
13271      JsonArray array = json.getAsJsonArray("availableTime");
13272      for (int i = 0; i < array.size(); i++) {
13273        res.getAvailableTime().add(parseHealthcareServiceHealthcareServiceAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
13274      }
13275    };
13276    if (json.has("notAvailable")) {
13277      JsonArray array = json.getAsJsonArray("notAvailable");
13278      for (int i = 0; i < array.size(); i++) {
13279        res.getNotAvailable().add(parseHealthcareServiceHealthcareServiceNotAvailableComponent(array.get(i).getAsJsonObject(), res));
13280      }
13281    };
13282    if (json.has("availabilityExceptions"))
13283      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
13284    if (json.has("_availabilityExceptions"))
13285      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
13286    if (json.has("endpoint")) {
13287      JsonArray array = json.getAsJsonArray("endpoint");
13288      for (int i = 0; i < array.size(); i++) {
13289        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
13290      }
13291    };
13292  }
13293
13294  protected HealthcareService.HealthcareServiceEligibilityComponent parseHealthcareServiceHealthcareServiceEligibilityComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
13295    HealthcareService.HealthcareServiceEligibilityComponent res = new HealthcareService.HealthcareServiceEligibilityComponent();
13296    parseHealthcareServiceHealthcareServiceEligibilityComponentProperties(json, owner, res);
13297    return res;
13298  }
13299
13300  protected void parseHealthcareServiceHealthcareServiceEligibilityComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceEligibilityComponent res) throws IOException, FHIRFormatError {
13301    parseBackboneElementProperties(json, res);
13302    if (json.has("code"))
13303      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13304    if (json.has("comment"))
13305      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
13306    if (json.has("_comment"))
13307      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
13308  }
13309
13310  protected HealthcareService.HealthcareServiceAvailableTimeComponent parseHealthcareServiceHealthcareServiceAvailableTimeComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
13311    HealthcareService.HealthcareServiceAvailableTimeComponent res = new HealthcareService.HealthcareServiceAvailableTimeComponent();
13312    parseHealthcareServiceHealthcareServiceAvailableTimeComponentProperties(json, owner, res);
13313    return res;
13314  }
13315
13316  protected void parseHealthcareServiceHealthcareServiceAvailableTimeComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceAvailableTimeComponent res) throws IOException, FHIRFormatError {
13317    parseBackboneElementProperties(json, res);
13318    if (json.has("daysOfWeek")) {
13319      JsonArray array = json.getAsJsonArray("daysOfWeek");
13320      for (int i = 0; i < array.size(); i++) {
13321        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
13322      }
13323    };
13324    if (json.has("_daysOfWeek")) {
13325      JsonArray array = json.getAsJsonArray("_daysOfWeek");
13326      for (int i = 0; i < array.size(); i++) {
13327        if (i == res.getDaysOfWeek().size())
13328          res.getDaysOfWeek().add(parseEnumeration(null, HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
13329        if (array.get(i) instanceof JsonObject) 
13330          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
13331      }
13332    };
13333    if (json.has("allDay"))
13334      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
13335    if (json.has("_allDay"))
13336      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
13337    if (json.has("availableStartTime"))
13338      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
13339    if (json.has("_availableStartTime"))
13340      parseElementProperties(json.getAsJsonObject("_availableStartTime"), res.getAvailableStartTimeElement());
13341    if (json.has("availableEndTime"))
13342      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
13343    if (json.has("_availableEndTime"))
13344      parseElementProperties(json.getAsJsonObject("_availableEndTime"), res.getAvailableEndTimeElement());
13345  }
13346
13347  protected HealthcareService.HealthcareServiceNotAvailableComponent parseHealthcareServiceHealthcareServiceNotAvailableComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
13348    HealthcareService.HealthcareServiceNotAvailableComponent res = new HealthcareService.HealthcareServiceNotAvailableComponent();
13349    parseHealthcareServiceHealthcareServiceNotAvailableComponentProperties(json, owner, res);
13350    return res;
13351  }
13352
13353  protected void parseHealthcareServiceHealthcareServiceNotAvailableComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceNotAvailableComponent res) throws IOException, FHIRFormatError {
13354    parseBackboneElementProperties(json, res);
13355    if (json.has("description"))
13356      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13357    if (json.has("_description"))
13358      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13359    if (json.has("during"))
13360      res.setDuring(parsePeriod(json.getAsJsonObject("during")));
13361  }
13362
13363  protected ImagingStudy parseImagingStudy(JsonObject json) throws IOException, FHIRFormatError {
13364    ImagingStudy res = new ImagingStudy();
13365    parseImagingStudyProperties(json, res);
13366    return res;
13367  }
13368
13369  protected void parseImagingStudyProperties(JsonObject json, ImagingStudy res) throws IOException, FHIRFormatError {
13370    parseDomainResourceProperties(json, res);
13371    if (json.has("identifier")) {
13372      JsonArray array = json.getAsJsonArray("identifier");
13373      for (int i = 0; i < array.size(); i++) {
13374        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13375      }
13376    };
13377    if (json.has("status"))
13378      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ImagingStudy.ImagingStudyStatus.NULL, new ImagingStudy.ImagingStudyStatusEnumFactory()));
13379    if (json.has("_status"))
13380      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13381    if (json.has("modality")) {
13382      JsonArray array = json.getAsJsonArray("modality");
13383      for (int i = 0; i < array.size(); i++) {
13384        res.getModality().add(parseCoding(array.get(i).getAsJsonObject()));
13385      }
13386    };
13387    if (json.has("subject"))
13388      res.setSubject(parseReference(json.getAsJsonObject("subject")));
13389    if (json.has("encounter"))
13390      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
13391    if (json.has("started"))
13392      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
13393    if (json.has("_started"))
13394      parseElementProperties(json.getAsJsonObject("_started"), res.getStartedElement());
13395    if (json.has("basedOn")) {
13396      JsonArray array = json.getAsJsonArray("basedOn");
13397      for (int i = 0; i < array.size(); i++) {
13398        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
13399      }
13400    };
13401    if (json.has("referrer"))
13402      res.setReferrer(parseReference(json.getAsJsonObject("referrer")));
13403    if (json.has("interpreter")) {
13404      JsonArray array = json.getAsJsonArray("interpreter");
13405      for (int i = 0; i < array.size(); i++) {
13406        res.getInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
13407      }
13408    };
13409    if (json.has("endpoint")) {
13410      JsonArray array = json.getAsJsonArray("endpoint");
13411      for (int i = 0; i < array.size(); i++) {
13412        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
13413      }
13414    };
13415    if (json.has("numberOfSeries"))
13416      res.setNumberOfSeriesElement(parseUnsignedInt(json.get("numberOfSeries").getAsString()));
13417    if (json.has("_numberOfSeries"))
13418      parseElementProperties(json.getAsJsonObject("_numberOfSeries"), res.getNumberOfSeriesElement());
13419    if (json.has("numberOfInstances"))
13420      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
13421    if (json.has("_numberOfInstances"))
13422      parseElementProperties(json.getAsJsonObject("_numberOfInstances"), res.getNumberOfInstancesElement());
13423    if (json.has("procedureReference"))
13424      res.setProcedureReference(parseReference(json.getAsJsonObject("procedureReference")));
13425    if (json.has("procedureCode")) {
13426      JsonArray array = json.getAsJsonArray("procedureCode");
13427      for (int i = 0; i < array.size(); i++) {
13428        res.getProcedureCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13429      }
13430    };
13431    if (json.has("location"))
13432      res.setLocation(parseReference(json.getAsJsonObject("location")));
13433    if (json.has("reasonCode")) {
13434      JsonArray array = json.getAsJsonArray("reasonCode");
13435      for (int i = 0; i < array.size(); i++) {
13436        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13437      }
13438    };
13439    if (json.has("reasonReference")) {
13440      JsonArray array = json.getAsJsonArray("reasonReference");
13441      for (int i = 0; i < array.size(); i++) {
13442        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
13443      }
13444    };
13445    if (json.has("note")) {
13446      JsonArray array = json.getAsJsonArray("note");
13447      for (int i = 0; i < array.size(); i++) {
13448        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13449      }
13450    };
13451    if (json.has("description"))
13452      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13453    if (json.has("_description"))
13454      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13455    if (json.has("series")) {
13456      JsonArray array = json.getAsJsonArray("series");
13457      for (int i = 0; i < array.size(); i++) {
13458        res.getSeries().add(parseImagingStudyImagingStudySeriesComponent(array.get(i).getAsJsonObject(), res));
13459      }
13460    };
13461  }
13462
13463  protected ImagingStudy.ImagingStudySeriesComponent parseImagingStudyImagingStudySeriesComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
13464    ImagingStudy.ImagingStudySeriesComponent res = new ImagingStudy.ImagingStudySeriesComponent();
13465    parseImagingStudyImagingStudySeriesComponentProperties(json, owner, res);
13466    return res;
13467  }
13468
13469  protected void parseImagingStudyImagingStudySeriesComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesComponent res) throws IOException, FHIRFormatError {
13470    parseBackboneElementProperties(json, res);
13471    if (json.has("uid"))
13472      res.setUidElement(parseId(json.get("uid").getAsString()));
13473    if (json.has("_uid"))
13474      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
13475    if (json.has("number"))
13476      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
13477    if (json.has("_number"))
13478      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
13479    if (json.has("modality"))
13480      res.setModality(parseCoding(json.getAsJsonObject("modality")));
13481    if (json.has("description"))
13482      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13483    if (json.has("_description"))
13484      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13485    if (json.has("numberOfInstances"))
13486      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
13487    if (json.has("_numberOfInstances"))
13488      parseElementProperties(json.getAsJsonObject("_numberOfInstances"), res.getNumberOfInstancesElement());
13489    if (json.has("endpoint")) {
13490      JsonArray array = json.getAsJsonArray("endpoint");
13491      for (int i = 0; i < array.size(); i++) {
13492        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
13493      }
13494    };
13495    if (json.has("bodySite"))
13496      res.setBodySite(parseCoding(json.getAsJsonObject("bodySite")));
13497    if (json.has("laterality"))
13498      res.setLaterality(parseCoding(json.getAsJsonObject("laterality")));
13499    if (json.has("specimen")) {
13500      JsonArray array = json.getAsJsonArray("specimen");
13501      for (int i = 0; i < array.size(); i++) {
13502        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
13503      }
13504    };
13505    if (json.has("started"))
13506      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
13507    if (json.has("_started"))
13508      parseElementProperties(json.getAsJsonObject("_started"), res.getStartedElement());
13509    if (json.has("performer")) {
13510      JsonArray array = json.getAsJsonArray("performer");
13511      for (int i = 0; i < array.size(); i++) {
13512        res.getPerformer().add(parseImagingStudyImagingStudySeriesPerformerComponent(array.get(i).getAsJsonObject(), owner));
13513      }
13514    };
13515    if (json.has("instance")) {
13516      JsonArray array = json.getAsJsonArray("instance");
13517      for (int i = 0; i < array.size(); i++) {
13518        res.getInstance().add(parseImagingStudyImagingStudySeriesInstanceComponent(array.get(i).getAsJsonObject(), owner));
13519      }
13520    };
13521  }
13522
13523  protected ImagingStudy.ImagingStudySeriesPerformerComponent parseImagingStudyImagingStudySeriesPerformerComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
13524    ImagingStudy.ImagingStudySeriesPerformerComponent res = new ImagingStudy.ImagingStudySeriesPerformerComponent();
13525    parseImagingStudyImagingStudySeriesPerformerComponentProperties(json, owner, res);
13526    return res;
13527  }
13528
13529  protected void parseImagingStudyImagingStudySeriesPerformerComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesPerformerComponent res) throws IOException, FHIRFormatError {
13530    parseBackboneElementProperties(json, res);
13531    if (json.has("function"))
13532      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
13533    if (json.has("actor"))
13534      res.setActor(parseReference(json.getAsJsonObject("actor")));
13535  }
13536
13537  protected ImagingStudy.ImagingStudySeriesInstanceComponent parseImagingStudyImagingStudySeriesInstanceComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
13538    ImagingStudy.ImagingStudySeriesInstanceComponent res = new ImagingStudy.ImagingStudySeriesInstanceComponent();
13539    parseImagingStudyImagingStudySeriesInstanceComponentProperties(json, owner, res);
13540    return res;
13541  }
13542
13543  protected void parseImagingStudyImagingStudySeriesInstanceComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesInstanceComponent res) throws IOException, FHIRFormatError {
13544    parseBackboneElementProperties(json, res);
13545    if (json.has("uid"))
13546      res.setUidElement(parseId(json.get("uid").getAsString()));
13547    if (json.has("_uid"))
13548      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
13549    if (json.has("sopClass"))
13550      res.setSopClass(parseCoding(json.getAsJsonObject("sopClass")));
13551    if (json.has("number"))
13552      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
13553    if (json.has("_number"))
13554      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
13555    if (json.has("title"))
13556      res.setTitleElement(parseString(json.get("title").getAsString()));
13557    if (json.has("_title"))
13558      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
13559  }
13560
13561  protected Immunization parseImmunization(JsonObject json) throws IOException, FHIRFormatError {
13562    Immunization res = new Immunization();
13563    parseImmunizationProperties(json, res);
13564    return res;
13565  }
13566
13567  protected void parseImmunizationProperties(JsonObject json, Immunization res) throws IOException, FHIRFormatError {
13568    parseDomainResourceProperties(json, res);
13569    if (json.has("identifier")) {
13570      JsonArray array = json.getAsJsonArray("identifier");
13571      for (int i = 0; i < array.size(); i++) {
13572        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13573      }
13574    };
13575    if (json.has("status"))
13576      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Immunization.ImmunizationStatus.NULL, new Immunization.ImmunizationStatusEnumFactory()));
13577    if (json.has("_status"))
13578      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13579    if (json.has("statusReason"))
13580      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
13581    if (json.has("vaccineCode"))
13582      res.setVaccineCode(parseCodeableConcept(json.getAsJsonObject("vaccineCode")));
13583    if (json.has("patient"))
13584      res.setPatient(parseReference(json.getAsJsonObject("patient")));
13585    if (json.has("encounter"))
13586      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
13587    Type occurrence = parseType("occurrence", json);
13588    if (occurrence != null)
13589      res.setOccurrence(occurrence);
13590    if (json.has("recorded"))
13591      res.setRecordedElement(parseDateTime(json.get("recorded").getAsString()));
13592    if (json.has("_recorded"))
13593      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
13594    if (json.has("primarySource"))
13595      res.setPrimarySourceElement(parseBoolean(json.get("primarySource").getAsBoolean()));
13596    if (json.has("_primarySource"))
13597      parseElementProperties(json.getAsJsonObject("_primarySource"), res.getPrimarySourceElement());
13598    if (json.has("reportOrigin"))
13599      res.setReportOrigin(parseCodeableConcept(json.getAsJsonObject("reportOrigin")));
13600    if (json.has("location"))
13601      res.setLocation(parseReference(json.getAsJsonObject("location")));
13602    if (json.has("manufacturer"))
13603      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
13604    if (json.has("lotNumber"))
13605      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
13606    if (json.has("_lotNumber"))
13607      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
13608    if (json.has("expirationDate"))
13609      res.setExpirationDateElement(parseDate(json.get("expirationDate").getAsString()));
13610    if (json.has("_expirationDate"))
13611      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
13612    if (json.has("site"))
13613      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
13614    if (json.has("route"))
13615      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
13616    if (json.has("doseQuantity"))
13617      res.setDoseQuantity(parseQuantity(json.getAsJsonObject("doseQuantity")));
13618    if (json.has("performer")) {
13619      JsonArray array = json.getAsJsonArray("performer");
13620      for (int i = 0; i < array.size(); i++) {
13621        res.getPerformer().add(parseImmunizationImmunizationPerformerComponent(array.get(i).getAsJsonObject(), res));
13622      }
13623    };
13624    if (json.has("note")) {
13625      JsonArray array = json.getAsJsonArray("note");
13626      for (int i = 0; i < array.size(); i++) {
13627        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13628      }
13629    };
13630    if (json.has("reasonCode")) {
13631      JsonArray array = json.getAsJsonArray("reasonCode");
13632      for (int i = 0; i < array.size(); i++) {
13633        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13634      }
13635    };
13636    if (json.has("reasonReference")) {
13637      JsonArray array = json.getAsJsonArray("reasonReference");
13638      for (int i = 0; i < array.size(); i++) {
13639        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
13640      }
13641    };
13642    if (json.has("isSubpotent"))
13643      res.setIsSubpotentElement(parseBoolean(json.get("isSubpotent").getAsBoolean()));
13644    if (json.has("_isSubpotent"))
13645      parseElementProperties(json.getAsJsonObject("_isSubpotent"), res.getIsSubpotentElement());
13646    if (json.has("subpotentReason")) {
13647      JsonArray array = json.getAsJsonArray("subpotentReason");
13648      for (int i = 0; i < array.size(); i++) {
13649        res.getSubpotentReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13650      }
13651    };
13652    if (json.has("education")) {
13653      JsonArray array = json.getAsJsonArray("education");
13654      for (int i = 0; i < array.size(); i++) {
13655        res.getEducation().add(parseImmunizationImmunizationEducationComponent(array.get(i).getAsJsonObject(), res));
13656      }
13657    };
13658    if (json.has("programEligibility")) {
13659      JsonArray array = json.getAsJsonArray("programEligibility");
13660      for (int i = 0; i < array.size(); i++) {
13661        res.getProgramEligibility().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13662      }
13663    };
13664    if (json.has("fundingSource"))
13665      res.setFundingSource(parseCodeableConcept(json.getAsJsonObject("fundingSource")));
13666    if (json.has("reaction")) {
13667      JsonArray array = json.getAsJsonArray("reaction");
13668      for (int i = 0; i < array.size(); i++) {
13669        res.getReaction().add(parseImmunizationImmunizationReactionComponent(array.get(i).getAsJsonObject(), res));
13670      }
13671    };
13672    if (json.has("protocolApplied")) {
13673      JsonArray array = json.getAsJsonArray("protocolApplied");
13674      for (int i = 0; i < array.size(); i++) {
13675        res.getProtocolApplied().add(parseImmunizationImmunizationProtocolAppliedComponent(array.get(i).getAsJsonObject(), res));
13676      }
13677    };
13678  }
13679
13680  protected Immunization.ImmunizationPerformerComponent parseImmunizationImmunizationPerformerComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
13681    Immunization.ImmunizationPerformerComponent res = new Immunization.ImmunizationPerformerComponent();
13682    parseImmunizationImmunizationPerformerComponentProperties(json, owner, res);
13683    return res;
13684  }
13685
13686  protected void parseImmunizationImmunizationPerformerComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationPerformerComponent res) throws IOException, FHIRFormatError {
13687    parseBackboneElementProperties(json, res);
13688    if (json.has("function"))
13689      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
13690    if (json.has("actor"))
13691      res.setActor(parseReference(json.getAsJsonObject("actor")));
13692  }
13693
13694  protected Immunization.ImmunizationEducationComponent parseImmunizationImmunizationEducationComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
13695    Immunization.ImmunizationEducationComponent res = new Immunization.ImmunizationEducationComponent();
13696    parseImmunizationImmunizationEducationComponentProperties(json, owner, res);
13697    return res;
13698  }
13699
13700  protected void parseImmunizationImmunizationEducationComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationEducationComponent res) throws IOException, FHIRFormatError {
13701    parseBackboneElementProperties(json, res);
13702    if (json.has("documentType"))
13703      res.setDocumentTypeElement(parseString(json.get("documentType").getAsString()));
13704    if (json.has("_documentType"))
13705      parseElementProperties(json.getAsJsonObject("_documentType"), res.getDocumentTypeElement());
13706    if (json.has("reference"))
13707      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
13708    if (json.has("_reference"))
13709      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
13710    if (json.has("publicationDate"))
13711      res.setPublicationDateElement(parseDateTime(json.get("publicationDate").getAsString()));
13712    if (json.has("_publicationDate"))
13713      parseElementProperties(json.getAsJsonObject("_publicationDate"), res.getPublicationDateElement());
13714    if (json.has("presentationDate"))
13715      res.setPresentationDateElement(parseDateTime(json.get("presentationDate").getAsString()));
13716    if (json.has("_presentationDate"))
13717      parseElementProperties(json.getAsJsonObject("_presentationDate"), res.getPresentationDateElement());
13718  }
13719
13720  protected Immunization.ImmunizationReactionComponent parseImmunizationImmunizationReactionComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
13721    Immunization.ImmunizationReactionComponent res = new Immunization.ImmunizationReactionComponent();
13722    parseImmunizationImmunizationReactionComponentProperties(json, owner, res);
13723    return res;
13724  }
13725
13726  protected void parseImmunizationImmunizationReactionComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationReactionComponent res) throws IOException, FHIRFormatError {
13727    parseBackboneElementProperties(json, res);
13728    if (json.has("date"))
13729      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13730    if (json.has("_date"))
13731      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13732    if (json.has("detail"))
13733      res.setDetail(parseReference(json.getAsJsonObject("detail")));
13734    if (json.has("reported"))
13735      res.setReportedElement(parseBoolean(json.get("reported").getAsBoolean()));
13736    if (json.has("_reported"))
13737      parseElementProperties(json.getAsJsonObject("_reported"), res.getReportedElement());
13738  }
13739
13740  protected Immunization.ImmunizationProtocolAppliedComponent parseImmunizationImmunizationProtocolAppliedComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
13741    Immunization.ImmunizationProtocolAppliedComponent res = new Immunization.ImmunizationProtocolAppliedComponent();
13742    parseImmunizationImmunizationProtocolAppliedComponentProperties(json, owner, res);
13743    return res;
13744  }
13745
13746  protected void parseImmunizationImmunizationProtocolAppliedComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationProtocolAppliedComponent res) throws IOException, FHIRFormatError {
13747    parseBackboneElementProperties(json, res);
13748    if (json.has("series"))
13749      res.setSeriesElement(parseString(json.get("series").getAsString()));
13750    if (json.has("_series"))
13751      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
13752    if (json.has("authority"))
13753      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
13754    if (json.has("targetDisease")) {
13755      JsonArray array = json.getAsJsonArray("targetDisease");
13756      for (int i = 0; i < array.size(); i++) {
13757        res.getTargetDisease().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13758      }
13759    };
13760    Type doseNumber = parseType("doseNumber", json);
13761    if (doseNumber != null)
13762      res.setDoseNumber(doseNumber);
13763    Type seriesDoses = parseType("seriesDoses", json);
13764    if (seriesDoses != null)
13765      res.setSeriesDoses(seriesDoses);
13766  }
13767
13768  protected ImmunizationEvaluation parseImmunizationEvaluation(JsonObject json) throws IOException, FHIRFormatError {
13769    ImmunizationEvaluation res = new ImmunizationEvaluation();
13770    parseImmunizationEvaluationProperties(json, res);
13771    return res;
13772  }
13773
13774  protected void parseImmunizationEvaluationProperties(JsonObject json, ImmunizationEvaluation res) throws IOException, FHIRFormatError {
13775    parseDomainResourceProperties(json, res);
13776    if (json.has("identifier")) {
13777      JsonArray array = json.getAsJsonArray("identifier");
13778      for (int i = 0; i < array.size(); i++) {
13779        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13780      }
13781    };
13782    if (json.has("status"))
13783      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ImmunizationEvaluation.ImmunizationEvaluationStatus.NULL, new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory()));
13784    if (json.has("_status"))
13785      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13786    if (json.has("patient"))
13787      res.setPatient(parseReference(json.getAsJsonObject("patient")));
13788    if (json.has("date"))
13789      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13790    if (json.has("_date"))
13791      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13792    if (json.has("authority"))
13793      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
13794    if (json.has("targetDisease"))
13795      res.setTargetDisease(parseCodeableConcept(json.getAsJsonObject("targetDisease")));
13796    if (json.has("immunizationEvent"))
13797      res.setImmunizationEvent(parseReference(json.getAsJsonObject("immunizationEvent")));
13798    if (json.has("doseStatus"))
13799      res.setDoseStatus(parseCodeableConcept(json.getAsJsonObject("doseStatus")));
13800    if (json.has("doseStatusReason")) {
13801      JsonArray array = json.getAsJsonArray("doseStatusReason");
13802      for (int i = 0; i < array.size(); i++) {
13803        res.getDoseStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13804      }
13805    };
13806    if (json.has("description"))
13807      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13808    if (json.has("_description"))
13809      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13810    if (json.has("series"))
13811      res.setSeriesElement(parseString(json.get("series").getAsString()));
13812    if (json.has("_series"))
13813      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
13814    Type doseNumber = parseType("doseNumber", json);
13815    if (doseNumber != null)
13816      res.setDoseNumber(doseNumber);
13817    Type seriesDoses = parseType("seriesDoses", json);
13818    if (seriesDoses != null)
13819      res.setSeriesDoses(seriesDoses);
13820  }
13821
13822  protected ImmunizationRecommendation parseImmunizationRecommendation(JsonObject json) throws IOException, FHIRFormatError {
13823    ImmunizationRecommendation res = new ImmunizationRecommendation();
13824    parseImmunizationRecommendationProperties(json, res);
13825    return res;
13826  }
13827
13828  protected void parseImmunizationRecommendationProperties(JsonObject json, ImmunizationRecommendation res) throws IOException, FHIRFormatError {
13829    parseDomainResourceProperties(json, res);
13830    if (json.has("identifier")) {
13831      JsonArray array = json.getAsJsonArray("identifier");
13832      for (int i = 0; i < array.size(); i++) {
13833        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13834      }
13835    };
13836    if (json.has("patient"))
13837      res.setPatient(parseReference(json.getAsJsonObject("patient")));
13838    if (json.has("date"))
13839      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13840    if (json.has("_date"))
13841      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13842    if (json.has("authority"))
13843      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
13844    if (json.has("recommendation")) {
13845      JsonArray array = json.getAsJsonArray("recommendation");
13846      for (int i = 0; i < array.size(); i++) {
13847        res.getRecommendation().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(array.get(i).getAsJsonObject(), res));
13848      }
13849    };
13850  }
13851
13852  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
13853    ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent();
13854    parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentProperties(json, owner, res);
13855    return res;
13856  }
13857
13858  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentProperties(JsonObject json, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res) throws IOException, FHIRFormatError {
13859    parseBackboneElementProperties(json, res);
13860    if (json.has("vaccineCode")) {
13861      JsonArray array = json.getAsJsonArray("vaccineCode");
13862      for (int i = 0; i < array.size(); i++) {
13863        res.getVaccineCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13864      }
13865    };
13866    if (json.has("targetDisease"))
13867      res.setTargetDisease(parseCodeableConcept(json.getAsJsonObject("targetDisease")));
13868    if (json.has("contraindicatedVaccineCode")) {
13869      JsonArray array = json.getAsJsonArray("contraindicatedVaccineCode");
13870      for (int i = 0; i < array.size(); i++) {
13871        res.getContraindicatedVaccineCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13872      }
13873    };
13874    if (json.has("forecastStatus"))
13875      res.setForecastStatus(parseCodeableConcept(json.getAsJsonObject("forecastStatus")));
13876    if (json.has("forecastReason")) {
13877      JsonArray array = json.getAsJsonArray("forecastReason");
13878      for (int i = 0; i < array.size(); i++) {
13879        res.getForecastReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13880      }
13881    };
13882    if (json.has("dateCriterion")) {
13883      JsonArray array = json.getAsJsonArray("dateCriterion");
13884      for (int i = 0; i < array.size(); i++) {
13885        res.getDateCriterion().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(array.get(i).getAsJsonObject(), owner));
13886      }
13887    };
13888    if (json.has("description"))
13889      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13890    if (json.has("_description"))
13891      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13892    if (json.has("series"))
13893      res.setSeriesElement(parseString(json.get("series").getAsString()));
13894    if (json.has("_series"))
13895      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
13896    Type doseNumber = parseType("doseNumber", json);
13897    if (doseNumber != null)
13898      res.setDoseNumber(doseNumber);
13899    Type seriesDoses = parseType("seriesDoses", json);
13900    if (seriesDoses != null)
13901      res.setSeriesDoses(seriesDoses);
13902    if (json.has("supportingImmunization")) {
13903      JsonArray array = json.getAsJsonArray("supportingImmunization");
13904      for (int i = 0; i < array.size(); i++) {
13905        res.getSupportingImmunization().add(parseReference(array.get(i).getAsJsonObject()));
13906      }
13907    };
13908    if (json.has("supportingPatientInformation")) {
13909      JsonArray array = json.getAsJsonArray("supportingPatientInformation");
13910      for (int i = 0; i < array.size(); i++) {
13911        res.getSupportingPatientInformation().add(parseReference(array.get(i).getAsJsonObject()));
13912      }
13913    };
13914  }
13915
13916  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
13917    ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent();
13918    parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentProperties(json, owner, res);
13919    return res;
13920  }
13921
13922  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentProperties(JsonObject json, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res) throws IOException, FHIRFormatError {
13923    parseBackboneElementProperties(json, res);
13924    if (json.has("code"))
13925      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13926    if (json.has("value"))
13927      res.setValueElement(parseDateTime(json.get("value").getAsString()));
13928    if (json.has("_value"))
13929      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
13930  }
13931
13932  protected ImplementationGuide parseImplementationGuide(JsonObject json) throws IOException, FHIRFormatError {
13933    ImplementationGuide res = new ImplementationGuide();
13934    parseImplementationGuideProperties(json, res);
13935    return res;
13936  }
13937
13938  protected void parseImplementationGuideProperties(JsonObject json, ImplementationGuide res) throws IOException, FHIRFormatError {
13939    parseDomainResourceProperties(json, res);
13940    if (json.has("url"))
13941      res.setUrlElement(parseUri(json.get("url").getAsString()));
13942    if (json.has("_url"))
13943      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
13944    if (json.has("version"))
13945      res.setVersionElement(parseString(json.get("version").getAsString()));
13946    if (json.has("_version"))
13947      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
13948    if (json.has("name"))
13949      res.setNameElement(parseString(json.get("name").getAsString()));
13950    if (json.has("_name"))
13951      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13952    if (json.has("title"))
13953      res.setTitleElement(parseString(json.get("title").getAsString()));
13954    if (json.has("_title"))
13955      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
13956    if (json.has("status"))
13957      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
13958    if (json.has("_status"))
13959      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13960    if (json.has("experimental"))
13961      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
13962    if (json.has("_experimental"))
13963      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
13964    if (json.has("date"))
13965      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13966    if (json.has("_date"))
13967      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13968    if (json.has("publisher"))
13969      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
13970    if (json.has("_publisher"))
13971      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
13972    if (json.has("contact")) {
13973      JsonArray array = json.getAsJsonArray("contact");
13974      for (int i = 0; i < array.size(); i++) {
13975        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
13976      }
13977    };
13978    if (json.has("description"))
13979      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
13980    if (json.has("_description"))
13981      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13982    if (json.has("useContext")) {
13983      JsonArray array = json.getAsJsonArray("useContext");
13984      for (int i = 0; i < array.size(); i++) {
13985        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
13986      }
13987    };
13988    if (json.has("jurisdiction")) {
13989      JsonArray array = json.getAsJsonArray("jurisdiction");
13990      for (int i = 0; i < array.size(); i++) {
13991        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13992      }
13993    };
13994    if (json.has("copyright"))
13995      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
13996    if (json.has("_copyright"))
13997      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
13998    if (json.has("packageId"))
13999      res.setPackageIdElement(parseId(json.get("packageId").getAsString()));
14000    if (json.has("_packageId"))
14001      parseElementProperties(json.getAsJsonObject("_packageId"), res.getPackageIdElement());
14002    if (json.has("license"))
14003      res.setLicenseElement(parseEnumeration(json.get("license").getAsString(), ImplementationGuide.SPDXLicense.NULL, new ImplementationGuide.SPDXLicenseEnumFactory()));
14004    if (json.has("_license"))
14005      parseElementProperties(json.getAsJsonObject("_license"), res.getLicenseElement());
14006    if (json.has("fhirVersion")) {
14007      JsonArray array = json.getAsJsonArray("fhirVersion");
14008      for (int i = 0; i < array.size(); i++) {
14009        res.getFhirVersion().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
14010      }
14011    };
14012    if (json.has("_fhirVersion")) {
14013      JsonArray array = json.getAsJsonArray("_fhirVersion");
14014      for (int i = 0; i < array.size(); i++) {
14015        if (i == res.getFhirVersion().size())
14016          res.getFhirVersion().add(parseEnumeration(null, Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
14017        if (array.get(i) instanceof JsonObject) 
14018          parseElementProperties(array.get(i).getAsJsonObject(), res.getFhirVersion().get(i));
14019      }
14020    };
14021    if (json.has("dependsOn")) {
14022      JsonArray array = json.getAsJsonArray("dependsOn");
14023      for (int i = 0; i < array.size(); i++) {
14024        res.getDependsOn().add(parseImplementationGuideImplementationGuideDependsOnComponent(array.get(i).getAsJsonObject(), res));
14025      }
14026    };
14027    if (json.has("global")) {
14028      JsonArray array = json.getAsJsonArray("global");
14029      for (int i = 0; i < array.size(); i++) {
14030        res.getGlobal().add(parseImplementationGuideImplementationGuideGlobalComponent(array.get(i).getAsJsonObject(), res));
14031      }
14032    };
14033    if (json.has("definition"))
14034      res.setDefinition(parseImplementationGuideImplementationGuideDefinitionComponent(json.getAsJsonObject("definition"), res));
14035    if (json.has("manifest"))
14036      res.setManifest(parseImplementationGuideImplementationGuideManifestComponent(json.getAsJsonObject("manifest"), res));
14037  }
14038
14039  protected ImplementationGuide.ImplementationGuideDependsOnComponent parseImplementationGuideImplementationGuideDependsOnComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14040    ImplementationGuide.ImplementationGuideDependsOnComponent res = new ImplementationGuide.ImplementationGuideDependsOnComponent();
14041    parseImplementationGuideImplementationGuideDependsOnComponentProperties(json, owner, res);
14042    return res;
14043  }
14044
14045  protected void parseImplementationGuideImplementationGuideDependsOnComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDependsOnComponent res) throws IOException, FHIRFormatError {
14046    parseBackboneElementProperties(json, res);
14047    if (json.has("uri"))
14048      res.setUriElement(parseCanonical(json.get("uri").getAsString()));
14049    if (json.has("_uri"))
14050      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
14051    if (json.has("packageId"))
14052      res.setPackageIdElement(parseId(json.get("packageId").getAsString()));
14053    if (json.has("_packageId"))
14054      parseElementProperties(json.getAsJsonObject("_packageId"), res.getPackageIdElement());
14055    if (json.has("version"))
14056      res.setVersionElement(parseString(json.get("version").getAsString()));
14057    if (json.has("_version"))
14058      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
14059  }
14060
14061  protected ImplementationGuide.ImplementationGuideGlobalComponent parseImplementationGuideImplementationGuideGlobalComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14062    ImplementationGuide.ImplementationGuideGlobalComponent res = new ImplementationGuide.ImplementationGuideGlobalComponent();
14063    parseImplementationGuideImplementationGuideGlobalComponentProperties(json, owner, res);
14064    return res;
14065  }
14066
14067  protected void parseImplementationGuideImplementationGuideGlobalComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideGlobalComponent res) throws IOException, FHIRFormatError {
14068    parseBackboneElementProperties(json, res);
14069    if (json.has("type"))
14070      res.setTypeElement(parseCode(json.get("type").getAsString()));
14071    if (json.has("_type"))
14072      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
14073    if (json.has("profile"))
14074      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
14075    if (json.has("_profile"))
14076      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
14077  }
14078
14079  protected ImplementationGuide.ImplementationGuideDefinitionComponent parseImplementationGuideImplementationGuideDefinitionComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14080    ImplementationGuide.ImplementationGuideDefinitionComponent res = new ImplementationGuide.ImplementationGuideDefinitionComponent();
14081    parseImplementationGuideImplementationGuideDefinitionComponentProperties(json, owner, res);
14082    return res;
14083  }
14084
14085  protected void parseImplementationGuideImplementationGuideDefinitionComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionComponent res) throws IOException, FHIRFormatError {
14086    parseBackboneElementProperties(json, res);
14087    if (json.has("grouping")) {
14088      JsonArray array = json.getAsJsonArray("grouping");
14089      for (int i = 0; i < array.size(); i++) {
14090        res.getGrouping().add(parseImplementationGuideImplementationGuideDefinitionGroupingComponent(array.get(i).getAsJsonObject(), owner));
14091      }
14092    };
14093    if (json.has("resource")) {
14094      JsonArray array = json.getAsJsonArray("resource");
14095      for (int i = 0; i < array.size(); i++) {
14096        res.getResource().add(parseImplementationGuideImplementationGuideDefinitionResourceComponent(array.get(i).getAsJsonObject(), owner));
14097      }
14098    };
14099    if (json.has("page"))
14100      res.setPage(parseImplementationGuideImplementationGuideDefinitionPageComponent(json.getAsJsonObject("page"), owner));
14101    if (json.has("parameter")) {
14102      JsonArray array = json.getAsJsonArray("parameter");
14103      for (int i = 0; i < array.size(); i++) {
14104        res.getParameter().add(parseImplementationGuideImplementationGuideDefinitionParameterComponent(array.get(i).getAsJsonObject(), owner));
14105      }
14106    };
14107    if (json.has("template")) {
14108      JsonArray array = json.getAsJsonArray("template");
14109      for (int i = 0; i < array.size(); i++) {
14110        res.getTemplate().add(parseImplementationGuideImplementationGuideDefinitionTemplateComponent(array.get(i).getAsJsonObject(), owner));
14111      }
14112    };
14113  }
14114
14115  protected ImplementationGuide.ImplementationGuideDefinitionGroupingComponent parseImplementationGuideImplementationGuideDefinitionGroupingComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14116    ImplementationGuide.ImplementationGuideDefinitionGroupingComponent res = new ImplementationGuide.ImplementationGuideDefinitionGroupingComponent();
14117    parseImplementationGuideImplementationGuideDefinitionGroupingComponentProperties(json, owner, res);
14118    return res;
14119  }
14120
14121  protected void parseImplementationGuideImplementationGuideDefinitionGroupingComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionGroupingComponent res) throws IOException, FHIRFormatError {
14122    parseBackboneElementProperties(json, res);
14123    if (json.has("name"))
14124      res.setNameElement(parseString(json.get("name").getAsString()));
14125    if (json.has("_name"))
14126      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14127    if (json.has("description"))
14128      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14129    if (json.has("_description"))
14130      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14131  }
14132
14133  protected ImplementationGuide.ImplementationGuideDefinitionResourceComponent parseImplementationGuideImplementationGuideDefinitionResourceComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14134    ImplementationGuide.ImplementationGuideDefinitionResourceComponent res = new ImplementationGuide.ImplementationGuideDefinitionResourceComponent();
14135    parseImplementationGuideImplementationGuideDefinitionResourceComponentProperties(json, owner, res);
14136    return res;
14137  }
14138
14139  protected void parseImplementationGuideImplementationGuideDefinitionResourceComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionResourceComponent res) throws IOException, FHIRFormatError {
14140    parseBackboneElementProperties(json, res);
14141    if (json.has("reference"))
14142      res.setReference(parseReference(json.getAsJsonObject("reference")));
14143    if (json.has("fhirVersion")) {
14144      JsonArray array = json.getAsJsonArray("fhirVersion");
14145      for (int i = 0; i < array.size(); i++) {
14146        res.getFhirVersion().add(parseEnumeration(array.get(i).getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
14147      }
14148    };
14149    if (json.has("_fhirVersion")) {
14150      JsonArray array = json.getAsJsonArray("_fhirVersion");
14151      for (int i = 0; i < array.size(); i++) {
14152        if (i == res.getFhirVersion().size())
14153          res.getFhirVersion().add(parseEnumeration(null, Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
14154        if (array.get(i) instanceof JsonObject) 
14155          parseElementProperties(array.get(i).getAsJsonObject(), res.getFhirVersion().get(i));
14156      }
14157    };
14158    if (json.has("name"))
14159      res.setNameElement(parseString(json.get("name").getAsString()));
14160    if (json.has("_name"))
14161      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14162    if (json.has("description"))
14163      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14164    if (json.has("_description"))
14165      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14166    Type example = parseType("example", json);
14167    if (example != null)
14168      res.setExample(example);
14169    if (json.has("groupingId"))
14170      res.setGroupingIdElement(parseId(json.get("groupingId").getAsString()));
14171    if (json.has("_groupingId"))
14172      parseElementProperties(json.getAsJsonObject("_groupingId"), res.getGroupingIdElement());
14173  }
14174
14175  protected ImplementationGuide.ImplementationGuideDefinitionPageComponent parseImplementationGuideImplementationGuideDefinitionPageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14176    ImplementationGuide.ImplementationGuideDefinitionPageComponent res = new ImplementationGuide.ImplementationGuideDefinitionPageComponent();
14177    parseImplementationGuideImplementationGuideDefinitionPageComponentProperties(json, owner, res);
14178    return res;
14179  }
14180
14181  protected void parseImplementationGuideImplementationGuideDefinitionPageComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionPageComponent res) throws IOException, FHIRFormatError {
14182    parseBackboneElementProperties(json, res);
14183    Type name = parseType("name", json);
14184    if (name != null)
14185      res.setName(name);
14186    if (json.has("title"))
14187      res.setTitleElement(parseString(json.get("title").getAsString()));
14188    if (json.has("_title"))
14189      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
14190    if (json.has("generation"))
14191      res.setGenerationElement(parseEnumeration(json.get("generation").getAsString(), ImplementationGuide.GuidePageGeneration.NULL, new ImplementationGuide.GuidePageGenerationEnumFactory()));
14192    if (json.has("_generation"))
14193      parseElementProperties(json.getAsJsonObject("_generation"), res.getGenerationElement());
14194    if (json.has("page")) {
14195      JsonArray array = json.getAsJsonArray("page");
14196      for (int i = 0; i < array.size(); i++) {
14197        res.getPage().add(parseImplementationGuideImplementationGuideDefinitionPageComponent(array.get(i).getAsJsonObject(), owner));
14198      }
14199    };
14200  }
14201
14202  protected ImplementationGuide.ImplementationGuideDefinitionParameterComponent parseImplementationGuideImplementationGuideDefinitionParameterComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14203    ImplementationGuide.ImplementationGuideDefinitionParameterComponent res = new ImplementationGuide.ImplementationGuideDefinitionParameterComponent();
14204    parseImplementationGuideImplementationGuideDefinitionParameterComponentProperties(json, owner, res);
14205    return res;
14206  }
14207
14208  protected void parseImplementationGuideImplementationGuideDefinitionParameterComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionParameterComponent res) throws IOException, FHIRFormatError {
14209    parseBackboneElementProperties(json, res);
14210    if (json.has("code"))
14211      res.setCodeElement(parseString(json.get("code").getAsString()));
14212    if (json.has("_code"))
14213      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
14214    if (json.has("value"))
14215      res.setValueElement(parseString(json.get("value").getAsString()));
14216    if (json.has("_value"))
14217      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
14218  }
14219
14220  protected ImplementationGuide.ImplementationGuideDefinitionTemplateComponent parseImplementationGuideImplementationGuideDefinitionTemplateComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14221    ImplementationGuide.ImplementationGuideDefinitionTemplateComponent res = new ImplementationGuide.ImplementationGuideDefinitionTemplateComponent();
14222    parseImplementationGuideImplementationGuideDefinitionTemplateComponentProperties(json, owner, res);
14223    return res;
14224  }
14225
14226  protected void parseImplementationGuideImplementationGuideDefinitionTemplateComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionTemplateComponent res) throws IOException, FHIRFormatError {
14227    parseBackboneElementProperties(json, res);
14228    if (json.has("code"))
14229      res.setCodeElement(parseCode(json.get("code").getAsString()));
14230    if (json.has("_code"))
14231      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
14232    if (json.has("source"))
14233      res.setSourceElement(parseString(json.get("source").getAsString()));
14234    if (json.has("_source"))
14235      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
14236    if (json.has("scope"))
14237      res.setScopeElement(parseString(json.get("scope").getAsString()));
14238    if (json.has("_scope"))
14239      parseElementProperties(json.getAsJsonObject("_scope"), res.getScopeElement());
14240  }
14241
14242  protected ImplementationGuide.ImplementationGuideManifestComponent parseImplementationGuideImplementationGuideManifestComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14243    ImplementationGuide.ImplementationGuideManifestComponent res = new ImplementationGuide.ImplementationGuideManifestComponent();
14244    parseImplementationGuideImplementationGuideManifestComponentProperties(json, owner, res);
14245    return res;
14246  }
14247
14248  protected void parseImplementationGuideImplementationGuideManifestComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideManifestComponent res) throws IOException, FHIRFormatError {
14249    parseBackboneElementProperties(json, res);
14250    if (json.has("rendering"))
14251      res.setRenderingElement(parseUrl(json.get("rendering").getAsString()));
14252    if (json.has("_rendering"))
14253      parseElementProperties(json.getAsJsonObject("_rendering"), res.getRenderingElement());
14254    if (json.has("resource")) {
14255      JsonArray array = json.getAsJsonArray("resource");
14256      for (int i = 0; i < array.size(); i++) {
14257        res.getResource().add(parseImplementationGuideManifestResourceComponent(array.get(i).getAsJsonObject(), owner));
14258      }
14259    };
14260    if (json.has("page")) {
14261      JsonArray array = json.getAsJsonArray("page");
14262      for (int i = 0; i < array.size(); i++) {
14263        res.getPage().add(parseImplementationGuideManifestPageComponent(array.get(i).getAsJsonObject(), owner));
14264      }
14265    };
14266    if (json.has("image")) {
14267      JsonArray array = json.getAsJsonArray("image");
14268      for (int i = 0; i < array.size(); i++) {
14269        res.getImage().add(parseString(array.get(i).getAsString()));
14270      }
14271    };
14272    if (json.has("_image")) {
14273      JsonArray array = json.getAsJsonArray("_image");
14274      for (int i = 0; i < array.size(); i++) {
14275        if (i == res.getImage().size())
14276          res.getImage().add(parseString(null));
14277        if (array.get(i) instanceof JsonObject) 
14278          parseElementProperties(array.get(i).getAsJsonObject(), res.getImage().get(i));
14279      }
14280    };
14281    if (json.has("other")) {
14282      JsonArray array = json.getAsJsonArray("other");
14283      for (int i = 0; i < array.size(); i++) {
14284        res.getOther().add(parseString(array.get(i).getAsString()));
14285      }
14286    };
14287    if (json.has("_other")) {
14288      JsonArray array = json.getAsJsonArray("_other");
14289      for (int i = 0; i < array.size(); i++) {
14290        if (i == res.getOther().size())
14291          res.getOther().add(parseString(null));
14292        if (array.get(i) instanceof JsonObject) 
14293          parseElementProperties(array.get(i).getAsJsonObject(), res.getOther().get(i));
14294      }
14295    };
14296  }
14297
14298  protected ImplementationGuide.ManifestResourceComponent parseImplementationGuideManifestResourceComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14299    ImplementationGuide.ManifestResourceComponent res = new ImplementationGuide.ManifestResourceComponent();
14300    parseImplementationGuideManifestResourceComponentProperties(json, owner, res);
14301    return res;
14302  }
14303
14304  protected void parseImplementationGuideManifestResourceComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ManifestResourceComponent res) throws IOException, FHIRFormatError {
14305    parseBackboneElementProperties(json, res);
14306    if (json.has("reference"))
14307      res.setReference(parseReference(json.getAsJsonObject("reference")));
14308    Type example = parseType("example", json);
14309    if (example != null)
14310      res.setExample(example);
14311    if (json.has("relativePath"))
14312      res.setRelativePathElement(parseUrl(json.get("relativePath").getAsString()));
14313    if (json.has("_relativePath"))
14314      parseElementProperties(json.getAsJsonObject("_relativePath"), res.getRelativePathElement());
14315  }
14316
14317  protected ImplementationGuide.ManifestPageComponent parseImplementationGuideManifestPageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
14318    ImplementationGuide.ManifestPageComponent res = new ImplementationGuide.ManifestPageComponent();
14319    parseImplementationGuideManifestPageComponentProperties(json, owner, res);
14320    return res;
14321  }
14322
14323  protected void parseImplementationGuideManifestPageComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ManifestPageComponent res) throws IOException, FHIRFormatError {
14324    parseBackboneElementProperties(json, res);
14325    if (json.has("name"))
14326      res.setNameElement(parseString(json.get("name").getAsString()));
14327    if (json.has("_name"))
14328      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14329    if (json.has("title"))
14330      res.setTitleElement(parseString(json.get("title").getAsString()));
14331    if (json.has("_title"))
14332      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
14333    if (json.has("anchor")) {
14334      JsonArray array = json.getAsJsonArray("anchor");
14335      for (int i = 0; i < array.size(); i++) {
14336        res.getAnchor().add(parseString(array.get(i).getAsString()));
14337      }
14338    };
14339    if (json.has("_anchor")) {
14340      JsonArray array = json.getAsJsonArray("_anchor");
14341      for (int i = 0; i < array.size(); i++) {
14342        if (i == res.getAnchor().size())
14343          res.getAnchor().add(parseString(null));
14344        if (array.get(i) instanceof JsonObject) 
14345          parseElementProperties(array.get(i).getAsJsonObject(), res.getAnchor().get(i));
14346      }
14347    };
14348  }
14349
14350  protected InsurancePlan parseInsurancePlan(JsonObject json) throws IOException, FHIRFormatError {
14351    InsurancePlan res = new InsurancePlan();
14352    parseInsurancePlanProperties(json, res);
14353    return res;
14354  }
14355
14356  protected void parseInsurancePlanProperties(JsonObject json, InsurancePlan res) throws IOException, FHIRFormatError {
14357    parseDomainResourceProperties(json, res);
14358    if (json.has("identifier")) {
14359      JsonArray array = json.getAsJsonArray("identifier");
14360      for (int i = 0; i < array.size(); i++) {
14361        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14362      }
14363    };
14364    if (json.has("status"))
14365      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
14366    if (json.has("_status"))
14367      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14368    if (json.has("type")) {
14369      JsonArray array = json.getAsJsonArray("type");
14370      for (int i = 0; i < array.size(); i++) {
14371        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14372      }
14373    };
14374    if (json.has("name"))
14375      res.setNameElement(parseString(json.get("name").getAsString()));
14376    if (json.has("_name"))
14377      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14378    if (json.has("alias")) {
14379      JsonArray array = json.getAsJsonArray("alias");
14380      for (int i = 0; i < array.size(); i++) {
14381        res.getAlias().add(parseString(array.get(i).getAsString()));
14382      }
14383    };
14384    if (json.has("_alias")) {
14385      JsonArray array = json.getAsJsonArray("_alias");
14386      for (int i = 0; i < array.size(); i++) {
14387        if (i == res.getAlias().size())
14388          res.getAlias().add(parseString(null));
14389        if (array.get(i) instanceof JsonObject) 
14390          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
14391      }
14392    };
14393    if (json.has("period"))
14394      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
14395    if (json.has("ownedBy"))
14396      res.setOwnedBy(parseReference(json.getAsJsonObject("ownedBy")));
14397    if (json.has("administeredBy"))
14398      res.setAdministeredBy(parseReference(json.getAsJsonObject("administeredBy")));
14399    if (json.has("coverageArea")) {
14400      JsonArray array = json.getAsJsonArray("coverageArea");
14401      for (int i = 0; i < array.size(); i++) {
14402        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
14403      }
14404    };
14405    if (json.has("contact")) {
14406      JsonArray array = json.getAsJsonArray("contact");
14407      for (int i = 0; i < array.size(); i++) {
14408        res.getContact().add(parseInsurancePlanInsurancePlanContactComponent(array.get(i).getAsJsonObject(), res));
14409      }
14410    };
14411    if (json.has("endpoint")) {
14412      JsonArray array = json.getAsJsonArray("endpoint");
14413      for (int i = 0; i < array.size(); i++) {
14414        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
14415      }
14416    };
14417    if (json.has("network")) {
14418      JsonArray array = json.getAsJsonArray("network");
14419      for (int i = 0; i < array.size(); i++) {
14420        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
14421      }
14422    };
14423    if (json.has("coverage")) {
14424      JsonArray array = json.getAsJsonArray("coverage");
14425      for (int i = 0; i < array.size(); i++) {
14426        res.getCoverage().add(parseInsurancePlanInsurancePlanCoverageComponent(array.get(i).getAsJsonObject(), res));
14427      }
14428    };
14429    if (json.has("plan")) {
14430      JsonArray array = json.getAsJsonArray("plan");
14431      for (int i = 0; i < array.size(); i++) {
14432        res.getPlan().add(parseInsurancePlanInsurancePlanPlanComponent(array.get(i).getAsJsonObject(), res));
14433      }
14434    };
14435  }
14436
14437  protected InsurancePlan.InsurancePlanContactComponent parseInsurancePlanInsurancePlanContactComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14438    InsurancePlan.InsurancePlanContactComponent res = new InsurancePlan.InsurancePlanContactComponent();
14439    parseInsurancePlanInsurancePlanContactComponentProperties(json, owner, res);
14440    return res;
14441  }
14442
14443  protected void parseInsurancePlanInsurancePlanContactComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanContactComponent res) throws IOException, FHIRFormatError {
14444    parseBackboneElementProperties(json, res);
14445    if (json.has("purpose"))
14446      res.setPurpose(parseCodeableConcept(json.getAsJsonObject("purpose")));
14447    if (json.has("name"))
14448      res.setName(parseHumanName(json.getAsJsonObject("name")));
14449    if (json.has("telecom")) {
14450      JsonArray array = json.getAsJsonArray("telecom");
14451      for (int i = 0; i < array.size(); i++) {
14452        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
14453      }
14454    };
14455    if (json.has("address"))
14456      res.setAddress(parseAddress(json.getAsJsonObject("address")));
14457  }
14458
14459  protected InsurancePlan.InsurancePlanCoverageComponent parseInsurancePlanInsurancePlanCoverageComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14460    InsurancePlan.InsurancePlanCoverageComponent res = new InsurancePlan.InsurancePlanCoverageComponent();
14461    parseInsurancePlanInsurancePlanCoverageComponentProperties(json, owner, res);
14462    return res;
14463  }
14464
14465  protected void parseInsurancePlanInsurancePlanCoverageComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanCoverageComponent res) throws IOException, FHIRFormatError {
14466    parseBackboneElementProperties(json, res);
14467    if (json.has("type"))
14468      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14469    if (json.has("network")) {
14470      JsonArray array = json.getAsJsonArray("network");
14471      for (int i = 0; i < array.size(); i++) {
14472        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
14473      }
14474    };
14475    if (json.has("benefit")) {
14476      JsonArray array = json.getAsJsonArray("benefit");
14477      for (int i = 0; i < array.size(); i++) {
14478        res.getBenefit().add(parseInsurancePlanCoverageBenefitComponent(array.get(i).getAsJsonObject(), owner));
14479      }
14480    };
14481  }
14482
14483  protected InsurancePlan.CoverageBenefitComponent parseInsurancePlanCoverageBenefitComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14484    InsurancePlan.CoverageBenefitComponent res = new InsurancePlan.CoverageBenefitComponent();
14485    parseInsurancePlanCoverageBenefitComponentProperties(json, owner, res);
14486    return res;
14487  }
14488
14489  protected void parseInsurancePlanCoverageBenefitComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.CoverageBenefitComponent res) throws IOException, FHIRFormatError {
14490    parseBackboneElementProperties(json, res);
14491    if (json.has("type"))
14492      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14493    if (json.has("requirement"))
14494      res.setRequirementElement(parseString(json.get("requirement").getAsString()));
14495    if (json.has("_requirement"))
14496      parseElementProperties(json.getAsJsonObject("_requirement"), res.getRequirementElement());
14497    if (json.has("limit")) {
14498      JsonArray array = json.getAsJsonArray("limit");
14499      for (int i = 0; i < array.size(); i++) {
14500        res.getLimit().add(parseInsurancePlanCoverageBenefitLimitComponent(array.get(i).getAsJsonObject(), owner));
14501      }
14502    };
14503  }
14504
14505  protected InsurancePlan.CoverageBenefitLimitComponent parseInsurancePlanCoverageBenefitLimitComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14506    InsurancePlan.CoverageBenefitLimitComponent res = new InsurancePlan.CoverageBenefitLimitComponent();
14507    parseInsurancePlanCoverageBenefitLimitComponentProperties(json, owner, res);
14508    return res;
14509  }
14510
14511  protected void parseInsurancePlanCoverageBenefitLimitComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.CoverageBenefitLimitComponent res) throws IOException, FHIRFormatError {
14512    parseBackboneElementProperties(json, res);
14513    if (json.has("value"))
14514      res.setValue(parseQuantity(json.getAsJsonObject("value")));
14515    if (json.has("code"))
14516      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14517  }
14518
14519  protected InsurancePlan.InsurancePlanPlanComponent parseInsurancePlanInsurancePlanPlanComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14520    InsurancePlan.InsurancePlanPlanComponent res = new InsurancePlan.InsurancePlanPlanComponent();
14521    parseInsurancePlanInsurancePlanPlanComponentProperties(json, owner, res);
14522    return res;
14523  }
14524
14525  protected void parseInsurancePlanInsurancePlanPlanComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanPlanComponent res) throws IOException, FHIRFormatError {
14526    parseBackboneElementProperties(json, res);
14527    if (json.has("identifier")) {
14528      JsonArray array = json.getAsJsonArray("identifier");
14529      for (int i = 0; i < array.size(); i++) {
14530        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14531      }
14532    };
14533    if (json.has("type"))
14534      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14535    if (json.has("coverageArea")) {
14536      JsonArray array = json.getAsJsonArray("coverageArea");
14537      for (int i = 0; i < array.size(); i++) {
14538        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
14539      }
14540    };
14541    if (json.has("network")) {
14542      JsonArray array = json.getAsJsonArray("network");
14543      for (int i = 0; i < array.size(); i++) {
14544        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
14545      }
14546    };
14547    if (json.has("generalCost")) {
14548      JsonArray array = json.getAsJsonArray("generalCost");
14549      for (int i = 0; i < array.size(); i++) {
14550        res.getGeneralCost().add(parseInsurancePlanInsurancePlanPlanGeneralCostComponent(array.get(i).getAsJsonObject(), owner));
14551      }
14552    };
14553    if (json.has("specificCost")) {
14554      JsonArray array = json.getAsJsonArray("specificCost");
14555      for (int i = 0; i < array.size(); i++) {
14556        res.getSpecificCost().add(parseInsurancePlanInsurancePlanPlanSpecificCostComponent(array.get(i).getAsJsonObject(), owner));
14557      }
14558    };
14559  }
14560
14561  protected InsurancePlan.InsurancePlanPlanGeneralCostComponent parseInsurancePlanInsurancePlanPlanGeneralCostComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14562    InsurancePlan.InsurancePlanPlanGeneralCostComponent res = new InsurancePlan.InsurancePlanPlanGeneralCostComponent();
14563    parseInsurancePlanInsurancePlanPlanGeneralCostComponentProperties(json, owner, res);
14564    return res;
14565  }
14566
14567  protected void parseInsurancePlanInsurancePlanPlanGeneralCostComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanPlanGeneralCostComponent res) throws IOException, FHIRFormatError {
14568    parseBackboneElementProperties(json, res);
14569    if (json.has("type"))
14570      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14571    if (json.has("groupSize"))
14572      res.setGroupSizeElement(parsePositiveInt(json.get("groupSize").getAsString()));
14573    if (json.has("_groupSize"))
14574      parseElementProperties(json.getAsJsonObject("_groupSize"), res.getGroupSizeElement());
14575    if (json.has("cost"))
14576      res.setCost(parseMoney(json.getAsJsonObject("cost")));
14577    if (json.has("comment"))
14578      res.setCommentElement(parseString(json.get("comment").getAsString()));
14579    if (json.has("_comment"))
14580      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
14581  }
14582
14583  protected InsurancePlan.InsurancePlanPlanSpecificCostComponent parseInsurancePlanInsurancePlanPlanSpecificCostComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14584    InsurancePlan.InsurancePlanPlanSpecificCostComponent res = new InsurancePlan.InsurancePlanPlanSpecificCostComponent();
14585    parseInsurancePlanInsurancePlanPlanSpecificCostComponentProperties(json, owner, res);
14586    return res;
14587  }
14588
14589  protected void parseInsurancePlanInsurancePlanPlanSpecificCostComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanPlanSpecificCostComponent res) throws IOException, FHIRFormatError {
14590    parseBackboneElementProperties(json, res);
14591    if (json.has("category"))
14592      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
14593    if (json.has("benefit")) {
14594      JsonArray array = json.getAsJsonArray("benefit");
14595      for (int i = 0; i < array.size(); i++) {
14596        res.getBenefit().add(parseInsurancePlanPlanBenefitComponent(array.get(i).getAsJsonObject(), owner));
14597      }
14598    };
14599  }
14600
14601  protected InsurancePlan.PlanBenefitComponent parseInsurancePlanPlanBenefitComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14602    InsurancePlan.PlanBenefitComponent res = new InsurancePlan.PlanBenefitComponent();
14603    parseInsurancePlanPlanBenefitComponentProperties(json, owner, res);
14604    return res;
14605  }
14606
14607  protected void parseInsurancePlanPlanBenefitComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.PlanBenefitComponent res) throws IOException, FHIRFormatError {
14608    parseBackboneElementProperties(json, res);
14609    if (json.has("type"))
14610      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14611    if (json.has("cost")) {
14612      JsonArray array = json.getAsJsonArray("cost");
14613      for (int i = 0; i < array.size(); i++) {
14614        res.getCost().add(parseInsurancePlanPlanBenefitCostComponent(array.get(i).getAsJsonObject(), owner));
14615      }
14616    };
14617  }
14618
14619  protected InsurancePlan.PlanBenefitCostComponent parseInsurancePlanPlanBenefitCostComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
14620    InsurancePlan.PlanBenefitCostComponent res = new InsurancePlan.PlanBenefitCostComponent();
14621    parseInsurancePlanPlanBenefitCostComponentProperties(json, owner, res);
14622    return res;
14623  }
14624
14625  protected void parseInsurancePlanPlanBenefitCostComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.PlanBenefitCostComponent res) throws IOException, FHIRFormatError {
14626    parseBackboneElementProperties(json, res);
14627    if (json.has("type"))
14628      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14629    if (json.has("applicability"))
14630      res.setApplicability(parseCodeableConcept(json.getAsJsonObject("applicability")));
14631    if (json.has("qualifiers")) {
14632      JsonArray array = json.getAsJsonArray("qualifiers");
14633      for (int i = 0; i < array.size(); i++) {
14634        res.getQualifiers().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14635      }
14636    };
14637    if (json.has("value"))
14638      res.setValue(parseQuantity(json.getAsJsonObject("value")));
14639  }
14640
14641  protected Invoice parseInvoice(JsonObject json) throws IOException, FHIRFormatError {
14642    Invoice res = new Invoice();
14643    parseInvoiceProperties(json, res);
14644    return res;
14645  }
14646
14647  protected void parseInvoiceProperties(JsonObject json, Invoice res) throws IOException, FHIRFormatError {
14648    parseDomainResourceProperties(json, res);
14649    if (json.has("identifier")) {
14650      JsonArray array = json.getAsJsonArray("identifier");
14651      for (int i = 0; i < array.size(); i++) {
14652        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14653      }
14654    };
14655    if (json.has("status"))
14656      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Invoice.InvoiceStatus.NULL, new Invoice.InvoiceStatusEnumFactory()));
14657    if (json.has("_status"))
14658      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14659    if (json.has("cancelledReason"))
14660      res.setCancelledReasonElement(parseString(json.get("cancelledReason").getAsString()));
14661    if (json.has("_cancelledReason"))
14662      parseElementProperties(json.getAsJsonObject("_cancelledReason"), res.getCancelledReasonElement());
14663    if (json.has("type"))
14664      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14665    if (json.has("subject"))
14666      res.setSubject(parseReference(json.getAsJsonObject("subject")));
14667    if (json.has("recipient"))
14668      res.setRecipient(parseReference(json.getAsJsonObject("recipient")));
14669    if (json.has("date"))
14670      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14671    if (json.has("_date"))
14672      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
14673    if (json.has("participant")) {
14674      JsonArray array = json.getAsJsonArray("participant");
14675      for (int i = 0; i < array.size(); i++) {
14676        res.getParticipant().add(parseInvoiceInvoiceParticipantComponent(array.get(i).getAsJsonObject(), res));
14677      }
14678    };
14679    if (json.has("issuer"))
14680      res.setIssuer(parseReference(json.getAsJsonObject("issuer")));
14681    if (json.has("account"))
14682      res.setAccount(parseReference(json.getAsJsonObject("account")));
14683    if (json.has("lineItem")) {
14684      JsonArray array = json.getAsJsonArray("lineItem");
14685      for (int i = 0; i < array.size(); i++) {
14686        res.getLineItem().add(parseInvoiceInvoiceLineItemComponent(array.get(i).getAsJsonObject(), res));
14687      }
14688    };
14689    if (json.has("totalPriceComponent")) {
14690      JsonArray array = json.getAsJsonArray("totalPriceComponent");
14691      for (int i = 0; i < array.size(); i++) {
14692        res.getTotalPriceComponent().add(parseInvoiceInvoiceLineItemPriceComponentComponent(array.get(i).getAsJsonObject(), res));
14693      }
14694    };
14695    if (json.has("totalNet"))
14696      res.setTotalNet(parseMoney(json.getAsJsonObject("totalNet")));
14697    if (json.has("totalGross"))
14698      res.setTotalGross(parseMoney(json.getAsJsonObject("totalGross")));
14699    if (json.has("paymentTerms"))
14700      res.setPaymentTermsElement(parseMarkdown(json.get("paymentTerms").getAsString()));
14701    if (json.has("_paymentTerms"))
14702      parseElementProperties(json.getAsJsonObject("_paymentTerms"), res.getPaymentTermsElement());
14703    if (json.has("note")) {
14704      JsonArray array = json.getAsJsonArray("note");
14705      for (int i = 0; i < array.size(); i++) {
14706        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14707      }
14708    };
14709  }
14710
14711  protected Invoice.InvoiceParticipantComponent parseInvoiceInvoiceParticipantComponent(JsonObject json, Invoice owner) throws IOException, FHIRFormatError {
14712    Invoice.InvoiceParticipantComponent res = new Invoice.InvoiceParticipantComponent();
14713    parseInvoiceInvoiceParticipantComponentProperties(json, owner, res);
14714    return res;
14715  }
14716
14717  protected void parseInvoiceInvoiceParticipantComponentProperties(JsonObject json, Invoice owner, Invoice.InvoiceParticipantComponent res) throws IOException, FHIRFormatError {
14718    parseBackboneElementProperties(json, res);
14719    if (json.has("role"))
14720      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
14721    if (json.has("actor"))
14722      res.setActor(parseReference(json.getAsJsonObject("actor")));
14723  }
14724
14725  protected Invoice.InvoiceLineItemComponent parseInvoiceInvoiceLineItemComponent(JsonObject json, Invoice owner) throws IOException, FHIRFormatError {
14726    Invoice.InvoiceLineItemComponent res = new Invoice.InvoiceLineItemComponent();
14727    parseInvoiceInvoiceLineItemComponentProperties(json, owner, res);
14728    return res;
14729  }
14730
14731  protected void parseInvoiceInvoiceLineItemComponentProperties(JsonObject json, Invoice owner, Invoice.InvoiceLineItemComponent res) throws IOException, FHIRFormatError {
14732    parseBackboneElementProperties(json, res);
14733    if (json.has("sequence"))
14734      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
14735    if (json.has("_sequence"))
14736      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
14737    Type chargeItem = parseType("chargeItem", json);
14738    if (chargeItem != null)
14739      res.setChargeItem(chargeItem);
14740    if (json.has("priceComponent")) {
14741      JsonArray array = json.getAsJsonArray("priceComponent");
14742      for (int i = 0; i < array.size(); i++) {
14743        res.getPriceComponent().add(parseInvoiceInvoiceLineItemPriceComponentComponent(array.get(i).getAsJsonObject(), owner));
14744      }
14745    };
14746  }
14747
14748  protected Invoice.InvoiceLineItemPriceComponentComponent parseInvoiceInvoiceLineItemPriceComponentComponent(JsonObject json, Invoice owner) throws IOException, FHIRFormatError {
14749    Invoice.InvoiceLineItemPriceComponentComponent res = new Invoice.InvoiceLineItemPriceComponentComponent();
14750    parseInvoiceInvoiceLineItemPriceComponentComponentProperties(json, owner, res);
14751    return res;
14752  }
14753
14754  protected void parseInvoiceInvoiceLineItemPriceComponentComponentProperties(JsonObject json, Invoice owner, Invoice.InvoiceLineItemPriceComponentComponent res) throws IOException, FHIRFormatError {
14755    parseBackboneElementProperties(json, res);
14756    if (json.has("type"))
14757      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Invoice.InvoicePriceComponentType.NULL, new Invoice.InvoicePriceComponentTypeEnumFactory()));
14758    if (json.has("_type"))
14759      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
14760    if (json.has("code"))
14761      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14762    if (json.has("factor"))
14763      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
14764    if (json.has("_factor"))
14765      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
14766    if (json.has("amount"))
14767      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
14768  }
14769
14770  protected Library parseLibrary(JsonObject json) throws IOException, FHIRFormatError {
14771    Library res = new Library();
14772    parseLibraryProperties(json, res);
14773    return res;
14774  }
14775
14776  protected void parseLibraryProperties(JsonObject json, Library res) throws IOException, FHIRFormatError {
14777    parseDomainResourceProperties(json, res);
14778    if (json.has("url"))
14779      res.setUrlElement(parseUri(json.get("url").getAsString()));
14780    if (json.has("_url"))
14781      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
14782    if (json.has("identifier")) {
14783      JsonArray array = json.getAsJsonArray("identifier");
14784      for (int i = 0; i < array.size(); i++) {
14785        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14786      }
14787    };
14788    if (json.has("version"))
14789      res.setVersionElement(parseString(json.get("version").getAsString()));
14790    if (json.has("_version"))
14791      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
14792    if (json.has("name"))
14793      res.setNameElement(parseString(json.get("name").getAsString()));
14794    if (json.has("_name"))
14795      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14796    if (json.has("title"))
14797      res.setTitleElement(parseString(json.get("title").getAsString()));
14798    if (json.has("_title"))
14799      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
14800    if (json.has("subtitle"))
14801      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
14802    if (json.has("_subtitle"))
14803      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
14804    if (json.has("status"))
14805      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
14806    if (json.has("_status"))
14807      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14808    if (json.has("experimental"))
14809      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
14810    if (json.has("_experimental"))
14811      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
14812    if (json.has("type"))
14813      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14814    Type subject = parseType("subject", json);
14815    if (subject != null)
14816      res.setSubject(subject);
14817    if (json.has("date"))
14818      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14819    if (json.has("_date"))
14820      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
14821    if (json.has("publisher"))
14822      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
14823    if (json.has("_publisher"))
14824      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
14825    if (json.has("contact")) {
14826      JsonArray array = json.getAsJsonArray("contact");
14827      for (int i = 0; i < array.size(); i++) {
14828        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
14829      }
14830    };
14831    if (json.has("description"))
14832      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
14833    if (json.has("_description"))
14834      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14835    if (json.has("useContext")) {
14836      JsonArray array = json.getAsJsonArray("useContext");
14837      for (int i = 0; i < array.size(); i++) {
14838        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
14839      }
14840    };
14841    if (json.has("jurisdiction")) {
14842      JsonArray array = json.getAsJsonArray("jurisdiction");
14843      for (int i = 0; i < array.size(); i++) {
14844        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14845      }
14846    };
14847    if (json.has("purpose"))
14848      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
14849    if (json.has("_purpose"))
14850      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
14851    if (json.has("usage"))
14852      res.setUsageElement(parseString(json.get("usage").getAsString()));
14853    if (json.has("_usage"))
14854      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
14855    if (json.has("copyright"))
14856      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
14857    if (json.has("_copyright"))
14858      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
14859    if (json.has("approvalDate"))
14860      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
14861    if (json.has("_approvalDate"))
14862      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
14863    if (json.has("lastReviewDate"))
14864      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
14865    if (json.has("_lastReviewDate"))
14866      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
14867    if (json.has("effectivePeriod"))
14868      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
14869    if (json.has("topic")) {
14870      JsonArray array = json.getAsJsonArray("topic");
14871      for (int i = 0; i < array.size(); i++) {
14872        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14873      }
14874    };
14875    if (json.has("author")) {
14876      JsonArray array = json.getAsJsonArray("author");
14877      for (int i = 0; i < array.size(); i++) {
14878        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
14879      }
14880    };
14881    if (json.has("editor")) {
14882      JsonArray array = json.getAsJsonArray("editor");
14883      for (int i = 0; i < array.size(); i++) {
14884        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
14885      }
14886    };
14887    if (json.has("reviewer")) {
14888      JsonArray array = json.getAsJsonArray("reviewer");
14889      for (int i = 0; i < array.size(); i++) {
14890        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
14891      }
14892    };
14893    if (json.has("endorser")) {
14894      JsonArray array = json.getAsJsonArray("endorser");
14895      for (int i = 0; i < array.size(); i++) {
14896        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
14897      }
14898    };
14899    if (json.has("relatedArtifact")) {
14900      JsonArray array = json.getAsJsonArray("relatedArtifact");
14901      for (int i = 0; i < array.size(); i++) {
14902        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
14903      }
14904    };
14905    if (json.has("parameter")) {
14906      JsonArray array = json.getAsJsonArray("parameter");
14907      for (int i = 0; i < array.size(); i++) {
14908        res.getParameter().add(parseParameterDefinition(array.get(i).getAsJsonObject()));
14909      }
14910    };
14911    if (json.has("dataRequirement")) {
14912      JsonArray array = json.getAsJsonArray("dataRequirement");
14913      for (int i = 0; i < array.size(); i++) {
14914        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
14915      }
14916    };
14917    if (json.has("content")) {
14918      JsonArray array = json.getAsJsonArray("content");
14919      for (int i = 0; i < array.size(); i++) {
14920        res.getContent().add(parseAttachment(array.get(i).getAsJsonObject()));
14921      }
14922    };
14923  }
14924
14925  protected Linkage parseLinkage(JsonObject json) throws IOException, FHIRFormatError {
14926    Linkage res = new Linkage();
14927    parseLinkageProperties(json, res);
14928    return res;
14929  }
14930
14931  protected void parseLinkageProperties(JsonObject json, Linkage res) throws IOException, FHIRFormatError {
14932    parseDomainResourceProperties(json, res);
14933    if (json.has("active"))
14934      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
14935    if (json.has("_active"))
14936      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
14937    if (json.has("author"))
14938      res.setAuthor(parseReference(json.getAsJsonObject("author")));
14939    if (json.has("item")) {
14940      JsonArray array = json.getAsJsonArray("item");
14941      for (int i = 0; i < array.size(); i++) {
14942        res.getItem().add(parseLinkageLinkageItemComponent(array.get(i).getAsJsonObject(), res));
14943      }
14944    };
14945  }
14946
14947  protected Linkage.LinkageItemComponent parseLinkageLinkageItemComponent(JsonObject json, Linkage owner) throws IOException, FHIRFormatError {
14948    Linkage.LinkageItemComponent res = new Linkage.LinkageItemComponent();
14949    parseLinkageLinkageItemComponentProperties(json, owner, res);
14950    return res;
14951  }
14952
14953  protected void parseLinkageLinkageItemComponentProperties(JsonObject json, Linkage owner, Linkage.LinkageItemComponent res) throws IOException, FHIRFormatError {
14954    parseBackboneElementProperties(json, res);
14955    if (json.has("type"))
14956      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Linkage.LinkageType.NULL, new Linkage.LinkageTypeEnumFactory()));
14957    if (json.has("_type"))
14958      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
14959    if (json.has("resource"))
14960      res.setResource(parseReference(json.getAsJsonObject("resource")));
14961  }
14962
14963  protected ListResource parseListResource(JsonObject json) throws IOException, FHIRFormatError {
14964    ListResource res = new ListResource();
14965    parseListResourceProperties(json, res);
14966    return res;
14967  }
14968
14969  protected void parseListResourceProperties(JsonObject json, ListResource res) throws IOException, FHIRFormatError {
14970    parseDomainResourceProperties(json, res);
14971    if (json.has("identifier")) {
14972      JsonArray array = json.getAsJsonArray("identifier");
14973      for (int i = 0; i < array.size(); i++) {
14974        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14975      }
14976    };
14977    if (json.has("status"))
14978      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ListResource.ListStatus.NULL, new ListResource.ListStatusEnumFactory()));
14979    if (json.has("_status"))
14980      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14981    if (json.has("mode"))
14982      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ListResource.ListMode.NULL, new ListResource.ListModeEnumFactory()));
14983    if (json.has("_mode"))
14984      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
14985    if (json.has("title"))
14986      res.setTitleElement(parseString(json.get("title").getAsString()));
14987    if (json.has("_title"))
14988      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
14989    if (json.has("code"))
14990      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14991    if (json.has("subject"))
14992      res.setSubject(parseReference(json.getAsJsonObject("subject")));
14993    if (json.has("encounter"))
14994      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
14995    if (json.has("date"))
14996      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14997    if (json.has("_date"))
14998      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
14999    if (json.has("source"))
15000      res.setSource(parseReference(json.getAsJsonObject("source")));
15001    if (json.has("orderedBy"))
15002      res.setOrderedBy(parseCodeableConcept(json.getAsJsonObject("orderedBy")));
15003    if (json.has("note")) {
15004      JsonArray array = json.getAsJsonArray("note");
15005      for (int i = 0; i < array.size(); i++) {
15006        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15007      }
15008    };
15009    if (json.has("entry")) {
15010      JsonArray array = json.getAsJsonArray("entry");
15011      for (int i = 0; i < array.size(); i++) {
15012        res.getEntry().add(parseListResourceListEntryComponent(array.get(i).getAsJsonObject(), res));
15013      }
15014    };
15015    if (json.has("emptyReason"))
15016      res.setEmptyReason(parseCodeableConcept(json.getAsJsonObject("emptyReason")));
15017  }
15018
15019  protected ListResource.ListEntryComponent parseListResourceListEntryComponent(JsonObject json, ListResource owner) throws IOException, FHIRFormatError {
15020    ListResource.ListEntryComponent res = new ListResource.ListEntryComponent();
15021    parseListResourceListEntryComponentProperties(json, owner, res);
15022    return res;
15023  }
15024
15025  protected void parseListResourceListEntryComponentProperties(JsonObject json, ListResource owner, ListResource.ListEntryComponent res) throws IOException, FHIRFormatError {
15026    parseBackboneElementProperties(json, res);
15027    if (json.has("flag"))
15028      res.setFlag(parseCodeableConcept(json.getAsJsonObject("flag")));
15029    if (json.has("deleted"))
15030      res.setDeletedElement(parseBoolean(json.get("deleted").getAsBoolean()));
15031    if (json.has("_deleted"))
15032      parseElementProperties(json.getAsJsonObject("_deleted"), res.getDeletedElement());
15033    if (json.has("date"))
15034      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15035    if (json.has("_date"))
15036      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
15037    if (json.has("item"))
15038      res.setItem(parseReference(json.getAsJsonObject("item")));
15039  }
15040
15041  protected Location parseLocation(JsonObject json) throws IOException, FHIRFormatError {
15042    Location res = new Location();
15043    parseLocationProperties(json, res);
15044    return res;
15045  }
15046
15047  protected void parseLocationProperties(JsonObject json, Location res) throws IOException, FHIRFormatError {
15048    parseDomainResourceProperties(json, res);
15049    if (json.has("identifier")) {
15050      JsonArray array = json.getAsJsonArray("identifier");
15051      for (int i = 0; i < array.size(); i++) {
15052        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15053      }
15054    };
15055    if (json.has("status"))
15056      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Location.LocationStatus.NULL, new Location.LocationStatusEnumFactory()));
15057    if (json.has("_status"))
15058      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15059    if (json.has("operationalStatus"))
15060      res.setOperationalStatus(parseCoding(json.getAsJsonObject("operationalStatus")));
15061    if (json.has("name"))
15062      res.setNameElement(parseString(json.get("name").getAsString()));
15063    if (json.has("_name"))
15064      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15065    if (json.has("alias")) {
15066      JsonArray array = json.getAsJsonArray("alias");
15067      for (int i = 0; i < array.size(); i++) {
15068        res.getAlias().add(parseString(array.get(i).getAsString()));
15069      }
15070    };
15071    if (json.has("_alias")) {
15072      JsonArray array = json.getAsJsonArray("_alias");
15073      for (int i = 0; i < array.size(); i++) {
15074        if (i == res.getAlias().size())
15075          res.getAlias().add(parseString(null));
15076        if (array.get(i) instanceof JsonObject) 
15077          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
15078      }
15079    };
15080    if (json.has("description"))
15081      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15082    if (json.has("_description"))
15083      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15084    if (json.has("mode"))
15085      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Location.LocationMode.NULL, new Location.LocationModeEnumFactory()));
15086    if (json.has("_mode"))
15087      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
15088    if (json.has("type")) {
15089      JsonArray array = json.getAsJsonArray("type");
15090      for (int i = 0; i < array.size(); i++) {
15091        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15092      }
15093    };
15094    if (json.has("telecom")) {
15095      JsonArray array = json.getAsJsonArray("telecom");
15096      for (int i = 0; i < array.size(); i++) {
15097        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
15098      }
15099    };
15100    if (json.has("address"))
15101      res.setAddress(parseAddress(json.getAsJsonObject("address")));
15102    if (json.has("physicalType"))
15103      res.setPhysicalType(parseCodeableConcept(json.getAsJsonObject("physicalType")));
15104    if (json.has("position"))
15105      res.setPosition(parseLocationLocationPositionComponent(json.getAsJsonObject("position"), res));
15106    if (json.has("managingOrganization"))
15107      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
15108    if (json.has("partOf"))
15109      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
15110    if (json.has("hoursOfOperation")) {
15111      JsonArray array = json.getAsJsonArray("hoursOfOperation");
15112      for (int i = 0; i < array.size(); i++) {
15113        res.getHoursOfOperation().add(parseLocationLocationHoursOfOperationComponent(array.get(i).getAsJsonObject(), res));
15114      }
15115    };
15116    if (json.has("availabilityExceptions"))
15117      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
15118    if (json.has("_availabilityExceptions"))
15119      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
15120    if (json.has("endpoint")) {
15121      JsonArray array = json.getAsJsonArray("endpoint");
15122      for (int i = 0; i < array.size(); i++) {
15123        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
15124      }
15125    };
15126  }
15127
15128  protected Location.LocationPositionComponent parseLocationLocationPositionComponent(JsonObject json, Location owner) throws IOException, FHIRFormatError {
15129    Location.LocationPositionComponent res = new Location.LocationPositionComponent();
15130    parseLocationLocationPositionComponentProperties(json, owner, res);
15131    return res;
15132  }
15133
15134  protected void parseLocationLocationPositionComponentProperties(JsonObject json, Location owner, Location.LocationPositionComponent res) throws IOException, FHIRFormatError {
15135    parseBackboneElementProperties(json, res);
15136    if (json.has("longitude"))
15137      res.setLongitudeElement(parseDecimal(json.get("longitude").getAsBigDecimal()));
15138    if (json.has("_longitude"))
15139      parseElementProperties(json.getAsJsonObject("_longitude"), res.getLongitudeElement());
15140    if (json.has("latitude"))
15141      res.setLatitudeElement(parseDecimal(json.get("latitude").getAsBigDecimal()));
15142    if (json.has("_latitude"))
15143      parseElementProperties(json.getAsJsonObject("_latitude"), res.getLatitudeElement());
15144    if (json.has("altitude"))
15145      res.setAltitudeElement(parseDecimal(json.get("altitude").getAsBigDecimal()));
15146    if (json.has("_altitude"))
15147      parseElementProperties(json.getAsJsonObject("_altitude"), res.getAltitudeElement());
15148  }
15149
15150  protected Location.LocationHoursOfOperationComponent parseLocationLocationHoursOfOperationComponent(JsonObject json, Location owner) throws IOException, FHIRFormatError {
15151    Location.LocationHoursOfOperationComponent res = new Location.LocationHoursOfOperationComponent();
15152    parseLocationLocationHoursOfOperationComponentProperties(json, owner, res);
15153    return res;
15154  }
15155
15156  protected void parseLocationLocationHoursOfOperationComponentProperties(JsonObject json, Location owner, Location.LocationHoursOfOperationComponent res) throws IOException, FHIRFormatError {
15157    parseBackboneElementProperties(json, res);
15158    if (json.has("daysOfWeek")) {
15159      JsonArray array = json.getAsJsonArray("daysOfWeek");
15160      for (int i = 0; i < array.size(); i++) {
15161        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), Location.DaysOfWeek.NULL, new Location.DaysOfWeekEnumFactory()));
15162      }
15163    };
15164    if (json.has("_daysOfWeek")) {
15165      JsonArray array = json.getAsJsonArray("_daysOfWeek");
15166      for (int i = 0; i < array.size(); i++) {
15167        if (i == res.getDaysOfWeek().size())
15168          res.getDaysOfWeek().add(parseEnumeration(null, Location.DaysOfWeek.NULL, new Location.DaysOfWeekEnumFactory()));
15169        if (array.get(i) instanceof JsonObject) 
15170          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
15171      }
15172    };
15173    if (json.has("allDay"))
15174      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
15175    if (json.has("_allDay"))
15176      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
15177    if (json.has("openingTime"))
15178      res.setOpeningTimeElement(parseTime(json.get("openingTime").getAsString()));
15179    if (json.has("_openingTime"))
15180      parseElementProperties(json.getAsJsonObject("_openingTime"), res.getOpeningTimeElement());
15181    if (json.has("closingTime"))
15182      res.setClosingTimeElement(parseTime(json.get("closingTime").getAsString()));
15183    if (json.has("_closingTime"))
15184      parseElementProperties(json.getAsJsonObject("_closingTime"), res.getClosingTimeElement());
15185  }
15186
15187  protected Measure parseMeasure(JsonObject json) throws IOException, FHIRFormatError {
15188    Measure res = new Measure();
15189    parseMeasureProperties(json, res);
15190    return res;
15191  }
15192
15193  protected void parseMeasureProperties(JsonObject json, Measure res) throws IOException, FHIRFormatError {
15194    parseDomainResourceProperties(json, res);
15195    if (json.has("url"))
15196      res.setUrlElement(parseUri(json.get("url").getAsString()));
15197    if (json.has("_url"))
15198      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
15199    if (json.has("identifier")) {
15200      JsonArray array = json.getAsJsonArray("identifier");
15201      for (int i = 0; i < array.size(); i++) {
15202        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15203      }
15204    };
15205    if (json.has("version"))
15206      res.setVersionElement(parseString(json.get("version").getAsString()));
15207    if (json.has("_version"))
15208      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
15209    if (json.has("name"))
15210      res.setNameElement(parseString(json.get("name").getAsString()));
15211    if (json.has("_name"))
15212      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15213    if (json.has("title"))
15214      res.setTitleElement(parseString(json.get("title").getAsString()));
15215    if (json.has("_title"))
15216      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
15217    if (json.has("subtitle"))
15218      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
15219    if (json.has("_subtitle"))
15220      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
15221    if (json.has("status"))
15222      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
15223    if (json.has("_status"))
15224      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15225    if (json.has("experimental"))
15226      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
15227    if (json.has("_experimental"))
15228      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
15229    Type subject = parseType("subject", json);
15230    if (subject != null)
15231      res.setSubject(subject);
15232    if (json.has("date"))
15233      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15234    if (json.has("_date"))
15235      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
15236    if (json.has("publisher"))
15237      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
15238    if (json.has("_publisher"))
15239      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
15240    if (json.has("contact")) {
15241      JsonArray array = json.getAsJsonArray("contact");
15242      for (int i = 0; i < array.size(); i++) {
15243        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
15244      }
15245    };
15246    if (json.has("description"))
15247      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
15248    if (json.has("_description"))
15249      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15250    if (json.has("useContext")) {
15251      JsonArray array = json.getAsJsonArray("useContext");
15252      for (int i = 0; i < array.size(); i++) {
15253        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
15254      }
15255    };
15256    if (json.has("jurisdiction")) {
15257      JsonArray array = json.getAsJsonArray("jurisdiction");
15258      for (int i = 0; i < array.size(); i++) {
15259        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15260      }
15261    };
15262    if (json.has("purpose"))
15263      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
15264    if (json.has("_purpose"))
15265      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
15266    if (json.has("usage"))
15267      res.setUsageElement(parseString(json.get("usage").getAsString()));
15268    if (json.has("_usage"))
15269      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
15270    if (json.has("copyright"))
15271      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
15272    if (json.has("_copyright"))
15273      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
15274    if (json.has("approvalDate"))
15275      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
15276    if (json.has("_approvalDate"))
15277      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
15278    if (json.has("lastReviewDate"))
15279      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
15280    if (json.has("_lastReviewDate"))
15281      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
15282    if (json.has("effectivePeriod"))
15283      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
15284    if (json.has("topic")) {
15285      JsonArray array = json.getAsJsonArray("topic");
15286      for (int i = 0; i < array.size(); i++) {
15287        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15288      }
15289    };
15290    if (json.has("author")) {
15291      JsonArray array = json.getAsJsonArray("author");
15292      for (int i = 0; i < array.size(); i++) {
15293        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
15294      }
15295    };
15296    if (json.has("editor")) {
15297      JsonArray array = json.getAsJsonArray("editor");
15298      for (int i = 0; i < array.size(); i++) {
15299        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
15300      }
15301    };
15302    if (json.has("reviewer")) {
15303      JsonArray array = json.getAsJsonArray("reviewer");
15304      for (int i = 0; i < array.size(); i++) {
15305        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
15306      }
15307    };
15308    if (json.has("endorser")) {
15309      JsonArray array = json.getAsJsonArray("endorser");
15310      for (int i = 0; i < array.size(); i++) {
15311        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
15312      }
15313    };
15314    if (json.has("relatedArtifact")) {
15315      JsonArray array = json.getAsJsonArray("relatedArtifact");
15316      for (int i = 0; i < array.size(); i++) {
15317        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
15318      }
15319    };
15320    if (json.has("library")) {
15321      JsonArray array = json.getAsJsonArray("library");
15322      for (int i = 0; i < array.size(); i++) {
15323        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
15324      }
15325    };
15326    if (json.has("_library")) {
15327      JsonArray array = json.getAsJsonArray("_library");
15328      for (int i = 0; i < array.size(); i++) {
15329        if (i == res.getLibrary().size())
15330          res.getLibrary().add(parseCanonical(null));
15331        if (array.get(i) instanceof JsonObject) 
15332          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
15333      }
15334    };
15335    if (json.has("disclaimer"))
15336      res.setDisclaimerElement(parseMarkdown(json.get("disclaimer").getAsString()));
15337    if (json.has("_disclaimer"))
15338      parseElementProperties(json.getAsJsonObject("_disclaimer"), res.getDisclaimerElement());
15339    if (json.has("scoring"))
15340      res.setScoring(parseCodeableConcept(json.getAsJsonObject("scoring")));
15341    if (json.has("compositeScoring"))
15342      res.setCompositeScoring(parseCodeableConcept(json.getAsJsonObject("compositeScoring")));
15343    if (json.has("type")) {
15344      JsonArray array = json.getAsJsonArray("type");
15345      for (int i = 0; i < array.size(); i++) {
15346        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15347      }
15348    };
15349    if (json.has("riskAdjustment"))
15350      res.setRiskAdjustmentElement(parseString(json.get("riskAdjustment").getAsString()));
15351    if (json.has("_riskAdjustment"))
15352      parseElementProperties(json.getAsJsonObject("_riskAdjustment"), res.getRiskAdjustmentElement());
15353    if (json.has("rateAggregation"))
15354      res.setRateAggregationElement(parseString(json.get("rateAggregation").getAsString()));
15355    if (json.has("_rateAggregation"))
15356      parseElementProperties(json.getAsJsonObject("_rateAggregation"), res.getRateAggregationElement());
15357    if (json.has("rationale"))
15358      res.setRationaleElement(parseMarkdown(json.get("rationale").getAsString()));
15359    if (json.has("_rationale"))
15360      parseElementProperties(json.getAsJsonObject("_rationale"), res.getRationaleElement());
15361    if (json.has("clinicalRecommendationStatement"))
15362      res.setClinicalRecommendationStatementElement(parseMarkdown(json.get("clinicalRecommendationStatement").getAsString()));
15363    if (json.has("_clinicalRecommendationStatement"))
15364      parseElementProperties(json.getAsJsonObject("_clinicalRecommendationStatement"), res.getClinicalRecommendationStatementElement());
15365    if (json.has("improvementNotation"))
15366      res.setImprovementNotation(parseCodeableConcept(json.getAsJsonObject("improvementNotation")));
15367    if (json.has("definition")) {
15368      JsonArray array = json.getAsJsonArray("definition");
15369      for (int i = 0; i < array.size(); i++) {
15370        res.getDefinition().add(parseMarkdown(array.get(i).getAsString()));
15371      }
15372    };
15373    if (json.has("_definition")) {
15374      JsonArray array = json.getAsJsonArray("_definition");
15375      for (int i = 0; i < array.size(); i++) {
15376        if (i == res.getDefinition().size())
15377          res.getDefinition().add(parseMarkdown(null));
15378        if (array.get(i) instanceof JsonObject) 
15379          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinition().get(i));
15380      }
15381    };
15382    if (json.has("guidance"))
15383      res.setGuidanceElement(parseMarkdown(json.get("guidance").getAsString()));
15384    if (json.has("_guidance"))
15385      parseElementProperties(json.getAsJsonObject("_guidance"), res.getGuidanceElement());
15386    if (json.has("group")) {
15387      JsonArray array = json.getAsJsonArray("group");
15388      for (int i = 0; i < array.size(); i++) {
15389        res.getGroup().add(parseMeasureMeasureGroupComponent(array.get(i).getAsJsonObject(), res));
15390      }
15391    };
15392    if (json.has("supplementalData")) {
15393      JsonArray array = json.getAsJsonArray("supplementalData");
15394      for (int i = 0; i < array.size(); i++) {
15395        res.getSupplementalData().add(parseMeasureMeasureSupplementalDataComponent(array.get(i).getAsJsonObject(), res));
15396      }
15397    };
15398  }
15399
15400  protected Measure.MeasureGroupComponent parseMeasureMeasureGroupComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
15401    Measure.MeasureGroupComponent res = new Measure.MeasureGroupComponent();
15402    parseMeasureMeasureGroupComponentProperties(json, owner, res);
15403    return res;
15404  }
15405
15406  protected void parseMeasureMeasureGroupComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupComponent res) throws IOException, FHIRFormatError {
15407    parseBackboneElementProperties(json, res);
15408    if (json.has("code"))
15409      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15410    if (json.has("description"))
15411      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15412    if (json.has("_description"))
15413      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15414    if (json.has("population")) {
15415      JsonArray array = json.getAsJsonArray("population");
15416      for (int i = 0; i < array.size(); i++) {
15417        res.getPopulation().add(parseMeasureMeasureGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
15418      }
15419    };
15420    if (json.has("stratifier")) {
15421      JsonArray array = json.getAsJsonArray("stratifier");
15422      for (int i = 0; i < array.size(); i++) {
15423        res.getStratifier().add(parseMeasureMeasureGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
15424      }
15425    };
15426  }
15427
15428  protected Measure.MeasureGroupPopulationComponent parseMeasureMeasureGroupPopulationComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
15429    Measure.MeasureGroupPopulationComponent res = new Measure.MeasureGroupPopulationComponent();
15430    parseMeasureMeasureGroupPopulationComponentProperties(json, owner, res);
15431    return res;
15432  }
15433
15434  protected void parseMeasureMeasureGroupPopulationComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupPopulationComponent res) throws IOException, FHIRFormatError {
15435    parseBackboneElementProperties(json, res);
15436    if (json.has("code"))
15437      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15438    if (json.has("description"))
15439      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15440    if (json.has("_description"))
15441      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15442    if (json.has("criteria"))
15443      res.setCriteria(parseExpression(json.getAsJsonObject("criteria")));
15444  }
15445
15446  protected Measure.MeasureGroupStratifierComponent parseMeasureMeasureGroupStratifierComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
15447    Measure.MeasureGroupStratifierComponent res = new Measure.MeasureGroupStratifierComponent();
15448    parseMeasureMeasureGroupStratifierComponentProperties(json, owner, res);
15449    return res;
15450  }
15451
15452  protected void parseMeasureMeasureGroupStratifierComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupStratifierComponent res) throws IOException, FHIRFormatError {
15453    parseBackboneElementProperties(json, res);
15454    if (json.has("code"))
15455      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15456    if (json.has("description"))
15457      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15458    if (json.has("_description"))
15459      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15460    if (json.has("criteria"))
15461      res.setCriteria(parseExpression(json.getAsJsonObject("criteria")));
15462    if (json.has("component")) {
15463      JsonArray array = json.getAsJsonArray("component");
15464      for (int i = 0; i < array.size(); i++) {
15465        res.getComponent().add(parseMeasureMeasureGroupStratifierComponentComponent(array.get(i).getAsJsonObject(), owner));
15466      }
15467    };
15468  }
15469
15470  protected Measure.MeasureGroupStratifierComponentComponent parseMeasureMeasureGroupStratifierComponentComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
15471    Measure.MeasureGroupStratifierComponentComponent res = new Measure.MeasureGroupStratifierComponentComponent();
15472    parseMeasureMeasureGroupStratifierComponentComponentProperties(json, owner, res);
15473    return res;
15474  }
15475
15476  protected void parseMeasureMeasureGroupStratifierComponentComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupStratifierComponentComponent res) throws IOException, FHIRFormatError {
15477    parseBackboneElementProperties(json, res);
15478    if (json.has("code"))
15479      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15480    if (json.has("description"))
15481      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15482    if (json.has("_description"))
15483      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15484    if (json.has("criteria"))
15485      res.setCriteria(parseExpression(json.getAsJsonObject("criteria")));
15486  }
15487
15488  protected Measure.MeasureSupplementalDataComponent parseMeasureMeasureSupplementalDataComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
15489    Measure.MeasureSupplementalDataComponent res = new Measure.MeasureSupplementalDataComponent();
15490    parseMeasureMeasureSupplementalDataComponentProperties(json, owner, res);
15491    return res;
15492  }
15493
15494  protected void parseMeasureMeasureSupplementalDataComponentProperties(JsonObject json, Measure owner, Measure.MeasureSupplementalDataComponent res) throws IOException, FHIRFormatError {
15495    parseBackboneElementProperties(json, res);
15496    if (json.has("code"))
15497      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15498    if (json.has("usage")) {
15499      JsonArray array = json.getAsJsonArray("usage");
15500      for (int i = 0; i < array.size(); i++) {
15501        res.getUsage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15502      }
15503    };
15504    if (json.has("description"))
15505      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15506    if (json.has("_description"))
15507      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15508    if (json.has("criteria"))
15509      res.setCriteria(parseExpression(json.getAsJsonObject("criteria")));
15510  }
15511
15512  protected MeasureReport parseMeasureReport(JsonObject json) throws IOException, FHIRFormatError {
15513    MeasureReport res = new MeasureReport();
15514    parseMeasureReportProperties(json, res);
15515    return res;
15516  }
15517
15518  protected void parseMeasureReportProperties(JsonObject json, MeasureReport res) throws IOException, FHIRFormatError {
15519    parseDomainResourceProperties(json, res);
15520    if (json.has("identifier")) {
15521      JsonArray array = json.getAsJsonArray("identifier");
15522      for (int i = 0; i < array.size(); i++) {
15523        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15524      }
15525    };
15526    if (json.has("status"))
15527      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MeasureReport.MeasureReportStatus.NULL, new MeasureReport.MeasureReportStatusEnumFactory()));
15528    if (json.has("_status"))
15529      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15530    if (json.has("type"))
15531      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MeasureReport.MeasureReportType.NULL, new MeasureReport.MeasureReportTypeEnumFactory()));
15532    if (json.has("_type"))
15533      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
15534    if (json.has("measure"))
15535      res.setMeasureElement(parseCanonical(json.get("measure").getAsString()));
15536    if (json.has("_measure"))
15537      parseElementProperties(json.getAsJsonObject("_measure"), res.getMeasureElement());
15538    if (json.has("subject"))
15539      res.setSubject(parseReference(json.getAsJsonObject("subject")));
15540    if (json.has("date"))
15541      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15542    if (json.has("_date"))
15543      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
15544    if (json.has("reporter"))
15545      res.setReporter(parseReference(json.getAsJsonObject("reporter")));
15546    if (json.has("period"))
15547      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
15548    if (json.has("improvementNotation"))
15549      res.setImprovementNotation(parseCodeableConcept(json.getAsJsonObject("improvementNotation")));
15550    if (json.has("group")) {
15551      JsonArray array = json.getAsJsonArray("group");
15552      for (int i = 0; i < array.size(); i++) {
15553        res.getGroup().add(parseMeasureReportMeasureReportGroupComponent(array.get(i).getAsJsonObject(), res));
15554      }
15555    };
15556    if (json.has("evaluatedResource")) {
15557      JsonArray array = json.getAsJsonArray("evaluatedResource");
15558      for (int i = 0; i < array.size(); i++) {
15559        res.getEvaluatedResource().add(parseReference(array.get(i).getAsJsonObject()));
15560      }
15561    };
15562  }
15563
15564  protected MeasureReport.MeasureReportGroupComponent parseMeasureReportMeasureReportGroupComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
15565    MeasureReport.MeasureReportGroupComponent res = new MeasureReport.MeasureReportGroupComponent();
15566    parseMeasureReportMeasureReportGroupComponentProperties(json, owner, res);
15567    return res;
15568  }
15569
15570  protected void parseMeasureReportMeasureReportGroupComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupComponent res) throws IOException, FHIRFormatError {
15571    parseBackboneElementProperties(json, res);
15572    if (json.has("code"))
15573      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15574    if (json.has("population")) {
15575      JsonArray array = json.getAsJsonArray("population");
15576      for (int i = 0; i < array.size(); i++) {
15577        res.getPopulation().add(parseMeasureReportMeasureReportGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
15578      }
15579    };
15580    if (json.has("measureScore"))
15581      res.setMeasureScore(parseQuantity(json.getAsJsonObject("measureScore")));
15582    if (json.has("stratifier")) {
15583      JsonArray array = json.getAsJsonArray("stratifier");
15584      for (int i = 0; i < array.size(); i++) {
15585        res.getStratifier().add(parseMeasureReportMeasureReportGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
15586      }
15587    };
15588  }
15589
15590  protected MeasureReport.MeasureReportGroupPopulationComponent parseMeasureReportMeasureReportGroupPopulationComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
15591    MeasureReport.MeasureReportGroupPopulationComponent res = new MeasureReport.MeasureReportGroupPopulationComponent();
15592    parseMeasureReportMeasureReportGroupPopulationComponentProperties(json, owner, res);
15593    return res;
15594  }
15595
15596  protected void parseMeasureReportMeasureReportGroupPopulationComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupPopulationComponent res) throws IOException, FHIRFormatError {
15597    parseBackboneElementProperties(json, res);
15598    if (json.has("code"))
15599      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15600    if (json.has("count"))
15601      res.setCountElement(parseInteger(json.get("count").getAsLong()));
15602    if (json.has("_count"))
15603      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
15604    if (json.has("subjectResults"))
15605      res.setSubjectResults(parseReference(json.getAsJsonObject("subjectResults")));
15606  }
15607
15608  protected MeasureReport.MeasureReportGroupStratifierComponent parseMeasureReportMeasureReportGroupStratifierComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
15609    MeasureReport.MeasureReportGroupStratifierComponent res = new MeasureReport.MeasureReportGroupStratifierComponent();
15610    parseMeasureReportMeasureReportGroupStratifierComponentProperties(json, owner, res);
15611    return res;
15612  }
15613
15614  protected void parseMeasureReportMeasureReportGroupStratifierComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupStratifierComponent res) throws IOException, FHIRFormatError {
15615    parseBackboneElementProperties(json, res);
15616    if (json.has("code")) {
15617      JsonArray array = json.getAsJsonArray("code");
15618      for (int i = 0; i < array.size(); i++) {
15619        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15620      }
15621    };
15622    if (json.has("stratum")) {
15623      JsonArray array = json.getAsJsonArray("stratum");
15624      for (int i = 0; i < array.size(); i++) {
15625        res.getStratum().add(parseMeasureReportStratifierGroupComponent(array.get(i).getAsJsonObject(), owner));
15626      }
15627    };
15628  }
15629
15630  protected MeasureReport.StratifierGroupComponent parseMeasureReportStratifierGroupComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
15631    MeasureReport.StratifierGroupComponent res = new MeasureReport.StratifierGroupComponent();
15632    parseMeasureReportStratifierGroupComponentProperties(json, owner, res);
15633    return res;
15634  }
15635
15636  protected void parseMeasureReportStratifierGroupComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupComponent res) throws IOException, FHIRFormatError {
15637    parseBackboneElementProperties(json, res);
15638    if (json.has("value"))
15639      res.setValue(parseCodeableConcept(json.getAsJsonObject("value")));
15640    if (json.has("component")) {
15641      JsonArray array = json.getAsJsonArray("component");
15642      for (int i = 0; i < array.size(); i++) {
15643        res.getComponent().add(parseMeasureReportStratifierGroupComponentComponent(array.get(i).getAsJsonObject(), owner));
15644      }
15645    };
15646    if (json.has("population")) {
15647      JsonArray array = json.getAsJsonArray("population");
15648      for (int i = 0; i < array.size(); i++) {
15649        res.getPopulation().add(parseMeasureReportStratifierGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
15650      }
15651    };
15652    if (json.has("measureScore"))
15653      res.setMeasureScore(parseQuantity(json.getAsJsonObject("measureScore")));
15654  }
15655
15656  protected MeasureReport.StratifierGroupComponentComponent parseMeasureReportStratifierGroupComponentComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
15657    MeasureReport.StratifierGroupComponentComponent res = new MeasureReport.StratifierGroupComponentComponent();
15658    parseMeasureReportStratifierGroupComponentComponentProperties(json, owner, res);
15659    return res;
15660  }
15661
15662  protected void parseMeasureReportStratifierGroupComponentComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupComponentComponent res) throws IOException, FHIRFormatError {
15663    parseBackboneElementProperties(json, res);
15664    if (json.has("code"))
15665      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15666    if (json.has("value"))
15667      res.setValue(parseCodeableConcept(json.getAsJsonObject("value")));
15668  }
15669
15670  protected MeasureReport.StratifierGroupPopulationComponent parseMeasureReportStratifierGroupPopulationComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
15671    MeasureReport.StratifierGroupPopulationComponent res = new MeasureReport.StratifierGroupPopulationComponent();
15672    parseMeasureReportStratifierGroupPopulationComponentProperties(json, owner, res);
15673    return res;
15674  }
15675
15676  protected void parseMeasureReportStratifierGroupPopulationComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupPopulationComponent res) throws IOException, FHIRFormatError {
15677    parseBackboneElementProperties(json, res);
15678    if (json.has("code"))
15679      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15680    if (json.has("count"))
15681      res.setCountElement(parseInteger(json.get("count").getAsLong()));
15682    if (json.has("_count"))
15683      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
15684    if (json.has("subjectResults"))
15685      res.setSubjectResults(parseReference(json.getAsJsonObject("subjectResults")));
15686  }
15687
15688  protected Media parseMedia(JsonObject json) throws IOException, FHIRFormatError {
15689    Media res = new Media();
15690    parseMediaProperties(json, res);
15691    return res;
15692  }
15693
15694  protected void parseMediaProperties(JsonObject json, Media res) throws IOException, FHIRFormatError {
15695    parseDomainResourceProperties(json, res);
15696    if (json.has("identifier")) {
15697      JsonArray array = json.getAsJsonArray("identifier");
15698      for (int i = 0; i < array.size(); i++) {
15699        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15700      }
15701    };
15702    if (json.has("basedOn")) {
15703      JsonArray array = json.getAsJsonArray("basedOn");
15704      for (int i = 0; i < array.size(); i++) {
15705        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
15706      }
15707    };
15708    if (json.has("partOf")) {
15709      JsonArray array = json.getAsJsonArray("partOf");
15710      for (int i = 0; i < array.size(); i++) {
15711        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
15712      }
15713    };
15714    if (json.has("status"))
15715      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Media.MediaStatus.NULL, new Media.MediaStatusEnumFactory()));
15716    if (json.has("_status"))
15717      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15718    if (json.has("type"))
15719      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15720    if (json.has("modality"))
15721      res.setModality(parseCodeableConcept(json.getAsJsonObject("modality")));
15722    if (json.has("view"))
15723      res.setView(parseCodeableConcept(json.getAsJsonObject("view")));
15724    if (json.has("subject"))
15725      res.setSubject(parseReference(json.getAsJsonObject("subject")));
15726    if (json.has("encounter"))
15727      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
15728    Type created = parseType("created", json);
15729    if (created != null)
15730      res.setCreated(created);
15731    if (json.has("issued"))
15732      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
15733    if (json.has("_issued"))
15734      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
15735    if (json.has("operator"))
15736      res.setOperator(parseReference(json.getAsJsonObject("operator")));
15737    if (json.has("reasonCode")) {
15738      JsonArray array = json.getAsJsonArray("reasonCode");
15739      for (int i = 0; i < array.size(); i++) {
15740        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15741      }
15742    };
15743    if (json.has("bodySite"))
15744      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
15745    if (json.has("deviceName"))
15746      res.setDeviceNameElement(parseString(json.get("deviceName").getAsString()));
15747    if (json.has("_deviceName"))
15748      parseElementProperties(json.getAsJsonObject("_deviceName"), res.getDeviceNameElement());
15749    if (json.has("device"))
15750      res.setDevice(parseReference(json.getAsJsonObject("device")));
15751    if (json.has("height"))
15752      res.setHeightElement(parsePositiveInt(json.get("height").getAsString()));
15753    if (json.has("_height"))
15754      parseElementProperties(json.getAsJsonObject("_height"), res.getHeightElement());
15755    if (json.has("width"))
15756      res.setWidthElement(parsePositiveInt(json.get("width").getAsString()));
15757    if (json.has("_width"))
15758      parseElementProperties(json.getAsJsonObject("_width"), res.getWidthElement());
15759    if (json.has("frames"))
15760      res.setFramesElement(parsePositiveInt(json.get("frames").getAsString()));
15761    if (json.has("_frames"))
15762      parseElementProperties(json.getAsJsonObject("_frames"), res.getFramesElement());
15763    if (json.has("duration"))
15764      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
15765    if (json.has("_duration"))
15766      parseElementProperties(json.getAsJsonObject("_duration"), res.getDurationElement());
15767    if (json.has("content"))
15768      res.setContent(parseAttachment(json.getAsJsonObject("content")));
15769    if (json.has("note")) {
15770      JsonArray array = json.getAsJsonArray("note");
15771      for (int i = 0; i < array.size(); i++) {
15772        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15773      }
15774    };
15775  }
15776
15777  protected Medication parseMedication(JsonObject json) throws IOException, FHIRFormatError {
15778    Medication res = new Medication();
15779    parseMedicationProperties(json, res);
15780    return res;
15781  }
15782
15783  protected void parseMedicationProperties(JsonObject json, Medication res) throws IOException, FHIRFormatError {
15784    parseDomainResourceProperties(json, res);
15785    if (json.has("identifier")) {
15786      JsonArray array = json.getAsJsonArray("identifier");
15787      for (int i = 0; i < array.size(); i++) {
15788        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15789      }
15790    };
15791    if (json.has("code"))
15792      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15793    if (json.has("status"))
15794      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Medication.MedicationStatus.NULL, new Medication.MedicationStatusEnumFactory()));
15795    if (json.has("_status"))
15796      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15797    if (json.has("manufacturer"))
15798      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
15799    if (json.has("form"))
15800      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
15801    if (json.has("amount"))
15802      res.setAmount(parseRatio(json.getAsJsonObject("amount")));
15803    if (json.has("ingredient")) {
15804      JsonArray array = json.getAsJsonArray("ingredient");
15805      for (int i = 0; i < array.size(); i++) {
15806        res.getIngredient().add(parseMedicationMedicationIngredientComponent(array.get(i).getAsJsonObject(), res));
15807      }
15808    };
15809    if (json.has("batch"))
15810      res.setBatch(parseMedicationMedicationBatchComponent(json.getAsJsonObject("batch"), res));
15811  }
15812
15813  protected Medication.MedicationIngredientComponent parseMedicationMedicationIngredientComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
15814    Medication.MedicationIngredientComponent res = new Medication.MedicationIngredientComponent();
15815    parseMedicationMedicationIngredientComponentProperties(json, owner, res);
15816    return res;
15817  }
15818
15819  protected void parseMedicationMedicationIngredientComponentProperties(JsonObject json, Medication owner, Medication.MedicationIngredientComponent res) throws IOException, FHIRFormatError {
15820    parseBackboneElementProperties(json, res);
15821    Type item = parseType("item", json);
15822    if (item != null)
15823      res.setItem(item);
15824    if (json.has("isActive"))
15825      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
15826    if (json.has("_isActive"))
15827      parseElementProperties(json.getAsJsonObject("_isActive"), res.getIsActiveElement());
15828    if (json.has("strength"))
15829      res.setStrength(parseRatio(json.getAsJsonObject("strength")));
15830  }
15831
15832  protected Medication.MedicationBatchComponent parseMedicationMedicationBatchComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
15833    Medication.MedicationBatchComponent res = new Medication.MedicationBatchComponent();
15834    parseMedicationMedicationBatchComponentProperties(json, owner, res);
15835    return res;
15836  }
15837
15838  protected void parseMedicationMedicationBatchComponentProperties(JsonObject json, Medication owner, Medication.MedicationBatchComponent res) throws IOException, FHIRFormatError {
15839    parseBackboneElementProperties(json, res);
15840    if (json.has("lotNumber"))
15841      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
15842    if (json.has("_lotNumber"))
15843      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
15844    if (json.has("expirationDate"))
15845      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
15846    if (json.has("_expirationDate"))
15847      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
15848  }
15849
15850  protected MedicationAdministration parseMedicationAdministration(JsonObject json) throws IOException, FHIRFormatError {
15851    MedicationAdministration res = new MedicationAdministration();
15852    parseMedicationAdministrationProperties(json, res);
15853    return res;
15854  }
15855
15856  protected void parseMedicationAdministrationProperties(JsonObject json, MedicationAdministration res) throws IOException, FHIRFormatError {
15857    parseDomainResourceProperties(json, res);
15858    if (json.has("identifier")) {
15859      JsonArray array = json.getAsJsonArray("identifier");
15860      for (int i = 0; i < array.size(); i++) {
15861        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15862      }
15863    };
15864    if (json.has("instantiates")) {
15865      JsonArray array = json.getAsJsonArray("instantiates");
15866      for (int i = 0; i < array.size(); i++) {
15867        res.getInstantiates().add(parseUri(array.get(i).getAsString()));
15868      }
15869    };
15870    if (json.has("_instantiates")) {
15871      JsonArray array = json.getAsJsonArray("_instantiates");
15872      for (int i = 0; i < array.size(); i++) {
15873        if (i == res.getInstantiates().size())
15874          res.getInstantiates().add(parseUri(null));
15875        if (array.get(i) instanceof JsonObject) 
15876          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
15877      }
15878    };
15879    if (json.has("partOf")) {
15880      JsonArray array = json.getAsJsonArray("partOf");
15881      for (int i = 0; i < array.size(); i++) {
15882        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
15883      }
15884    };
15885    if (json.has("status"))
15886      res.setStatusElement(parseCode(json.get("status").getAsString()));
15887    if (json.has("_status"))
15888      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15889    if (json.has("statusReason")) {
15890      JsonArray array = json.getAsJsonArray("statusReason");
15891      for (int i = 0; i < array.size(); i++) {
15892        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15893      }
15894    };
15895    if (json.has("category"))
15896      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
15897    Type medication = parseType("medication", json);
15898    if (medication != null)
15899      res.setMedication(medication);
15900    if (json.has("subject"))
15901      res.setSubject(parseReference(json.getAsJsonObject("subject")));
15902    if (json.has("context"))
15903      res.setContext(parseReference(json.getAsJsonObject("context")));
15904    if (json.has("supportingInformation")) {
15905      JsonArray array = json.getAsJsonArray("supportingInformation");
15906      for (int i = 0; i < array.size(); i++) {
15907        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
15908      }
15909    };
15910    Type effective = parseType("effective", json);
15911    if (effective != null)
15912      res.setEffective(effective);
15913    if (json.has("performer")) {
15914      JsonArray array = json.getAsJsonArray("performer");
15915      for (int i = 0; i < array.size(); i++) {
15916        res.getPerformer().add(parseMedicationAdministrationMedicationAdministrationPerformerComponent(array.get(i).getAsJsonObject(), res));
15917      }
15918    };
15919    if (json.has("reasonCode")) {
15920      JsonArray array = json.getAsJsonArray("reasonCode");
15921      for (int i = 0; i < array.size(); i++) {
15922        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15923      }
15924    };
15925    if (json.has("reasonReference")) {
15926      JsonArray array = json.getAsJsonArray("reasonReference");
15927      for (int i = 0; i < array.size(); i++) {
15928        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
15929      }
15930    };
15931    if (json.has("request"))
15932      res.setRequest(parseReference(json.getAsJsonObject("request")));
15933    if (json.has("device")) {
15934      JsonArray array = json.getAsJsonArray("device");
15935      for (int i = 0; i < array.size(); i++) {
15936        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
15937      }
15938    };
15939    if (json.has("note")) {
15940      JsonArray array = json.getAsJsonArray("note");
15941      for (int i = 0; i < array.size(); i++) {
15942        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15943      }
15944    };
15945    if (json.has("dosage"))
15946      res.setDosage(parseMedicationAdministrationMedicationAdministrationDosageComponent(json.getAsJsonObject("dosage"), res));
15947    if (json.has("eventHistory")) {
15948      JsonArray array = json.getAsJsonArray("eventHistory");
15949      for (int i = 0; i < array.size(); i++) {
15950        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
15951      }
15952    };
15953  }
15954
15955  protected MedicationAdministration.MedicationAdministrationPerformerComponent parseMedicationAdministrationMedicationAdministrationPerformerComponent(JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
15956    MedicationAdministration.MedicationAdministrationPerformerComponent res = new MedicationAdministration.MedicationAdministrationPerformerComponent();
15957    parseMedicationAdministrationMedicationAdministrationPerformerComponentProperties(json, owner, res);
15958    return res;
15959  }
15960
15961  protected void parseMedicationAdministrationMedicationAdministrationPerformerComponentProperties(JsonObject json, MedicationAdministration owner, MedicationAdministration.MedicationAdministrationPerformerComponent res) throws IOException, FHIRFormatError {
15962    parseBackboneElementProperties(json, res);
15963    if (json.has("function"))
15964      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
15965    if (json.has("actor"))
15966      res.setActor(parseReference(json.getAsJsonObject("actor")));
15967  }
15968
15969  protected MedicationAdministration.MedicationAdministrationDosageComponent parseMedicationAdministrationMedicationAdministrationDosageComponent(JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
15970    MedicationAdministration.MedicationAdministrationDosageComponent res = new MedicationAdministration.MedicationAdministrationDosageComponent();
15971    parseMedicationAdministrationMedicationAdministrationDosageComponentProperties(json, owner, res);
15972    return res;
15973  }
15974
15975  protected void parseMedicationAdministrationMedicationAdministrationDosageComponentProperties(JsonObject json, MedicationAdministration owner, MedicationAdministration.MedicationAdministrationDosageComponent res) throws IOException, FHIRFormatError {
15976    parseBackboneElementProperties(json, res);
15977    if (json.has("text"))
15978      res.setTextElement(parseString(json.get("text").getAsString()));
15979    if (json.has("_text"))
15980      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
15981    if (json.has("site"))
15982      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
15983    if (json.has("route"))
15984      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
15985    if (json.has("method"))
15986      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
15987    if (json.has("dose"))
15988      res.setDose(parseQuantity(json.getAsJsonObject("dose")));
15989    Type rate = parseType("rate", json);
15990    if (rate != null)
15991      res.setRate(rate);
15992  }
15993
15994  protected MedicationDispense parseMedicationDispense(JsonObject json) throws IOException, FHIRFormatError {
15995    MedicationDispense res = new MedicationDispense();
15996    parseMedicationDispenseProperties(json, res);
15997    return res;
15998  }
15999
16000  protected void parseMedicationDispenseProperties(JsonObject json, MedicationDispense res) throws IOException, FHIRFormatError {
16001    parseDomainResourceProperties(json, res);
16002    if (json.has("identifier")) {
16003      JsonArray array = json.getAsJsonArray("identifier");
16004      for (int i = 0; i < array.size(); i++) {
16005        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16006      }
16007    };
16008    if (json.has("partOf")) {
16009      JsonArray array = json.getAsJsonArray("partOf");
16010      for (int i = 0; i < array.size(); i++) {
16011        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
16012      }
16013    };
16014    if (json.has("status"))
16015      res.setStatusElement(parseCode(json.get("status").getAsString()));
16016    if (json.has("_status"))
16017      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16018    Type statusReason = parseType("statusReason", json);
16019    if (statusReason != null)
16020      res.setStatusReason(statusReason);
16021    if (json.has("category"))
16022      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
16023    Type medication = parseType("medication", json);
16024    if (medication != null)
16025      res.setMedication(medication);
16026    if (json.has("subject"))
16027      res.setSubject(parseReference(json.getAsJsonObject("subject")));
16028    if (json.has("context"))
16029      res.setContext(parseReference(json.getAsJsonObject("context")));
16030    if (json.has("supportingInformation")) {
16031      JsonArray array = json.getAsJsonArray("supportingInformation");
16032      for (int i = 0; i < array.size(); i++) {
16033        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
16034      }
16035    };
16036    if (json.has("performer")) {
16037      JsonArray array = json.getAsJsonArray("performer");
16038      for (int i = 0; i < array.size(); i++) {
16039        res.getPerformer().add(parseMedicationDispenseMedicationDispensePerformerComponent(array.get(i).getAsJsonObject(), res));
16040      }
16041    };
16042    if (json.has("location"))
16043      res.setLocation(parseReference(json.getAsJsonObject("location")));
16044    if (json.has("authorizingPrescription")) {
16045      JsonArray array = json.getAsJsonArray("authorizingPrescription");
16046      for (int i = 0; i < array.size(); i++) {
16047        res.getAuthorizingPrescription().add(parseReference(array.get(i).getAsJsonObject()));
16048      }
16049    };
16050    if (json.has("type"))
16051      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16052    if (json.has("quantity"))
16053      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
16054    if (json.has("daysSupply"))
16055      res.setDaysSupply(parseQuantity(json.getAsJsonObject("daysSupply")));
16056    if (json.has("whenPrepared"))
16057      res.setWhenPreparedElement(parseDateTime(json.get("whenPrepared").getAsString()));
16058    if (json.has("_whenPrepared"))
16059      parseElementProperties(json.getAsJsonObject("_whenPrepared"), res.getWhenPreparedElement());
16060    if (json.has("whenHandedOver"))
16061      res.setWhenHandedOverElement(parseDateTime(json.get("whenHandedOver").getAsString()));
16062    if (json.has("_whenHandedOver"))
16063      parseElementProperties(json.getAsJsonObject("_whenHandedOver"), res.getWhenHandedOverElement());
16064    if (json.has("destination"))
16065      res.setDestination(parseReference(json.getAsJsonObject("destination")));
16066    if (json.has("receiver")) {
16067      JsonArray array = json.getAsJsonArray("receiver");
16068      for (int i = 0; i < array.size(); i++) {
16069        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
16070      }
16071    };
16072    if (json.has("note")) {
16073      JsonArray array = json.getAsJsonArray("note");
16074      for (int i = 0; i < array.size(); i++) {
16075        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16076      }
16077    };
16078    if (json.has("dosageInstruction")) {
16079      JsonArray array = json.getAsJsonArray("dosageInstruction");
16080      for (int i = 0; i < array.size(); i++) {
16081        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
16082      }
16083    };
16084    if (json.has("substitution"))
16085      res.setSubstitution(parseMedicationDispenseMedicationDispenseSubstitutionComponent(json.getAsJsonObject("substitution"), res));
16086    if (json.has("detectedIssue")) {
16087      JsonArray array = json.getAsJsonArray("detectedIssue");
16088      for (int i = 0; i < array.size(); i++) {
16089        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
16090      }
16091    };
16092    if (json.has("eventHistory")) {
16093      JsonArray array = json.getAsJsonArray("eventHistory");
16094      for (int i = 0; i < array.size(); i++) {
16095        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
16096      }
16097    };
16098  }
16099
16100  protected MedicationDispense.MedicationDispensePerformerComponent parseMedicationDispenseMedicationDispensePerformerComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
16101    MedicationDispense.MedicationDispensePerformerComponent res = new MedicationDispense.MedicationDispensePerformerComponent();
16102    parseMedicationDispenseMedicationDispensePerformerComponentProperties(json, owner, res);
16103    return res;
16104  }
16105
16106  protected void parseMedicationDispenseMedicationDispensePerformerComponentProperties(JsonObject json, MedicationDispense owner, MedicationDispense.MedicationDispensePerformerComponent res) throws IOException, FHIRFormatError {
16107    parseBackboneElementProperties(json, res);
16108    if (json.has("function"))
16109      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
16110    if (json.has("actor"))
16111      res.setActor(parseReference(json.getAsJsonObject("actor")));
16112  }
16113
16114  protected MedicationDispense.MedicationDispenseSubstitutionComponent parseMedicationDispenseMedicationDispenseSubstitutionComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
16115    MedicationDispense.MedicationDispenseSubstitutionComponent res = new MedicationDispense.MedicationDispenseSubstitutionComponent();
16116    parseMedicationDispenseMedicationDispenseSubstitutionComponentProperties(json, owner, res);
16117    return res;
16118  }
16119
16120  protected void parseMedicationDispenseMedicationDispenseSubstitutionComponentProperties(JsonObject json, MedicationDispense owner, MedicationDispense.MedicationDispenseSubstitutionComponent res) throws IOException, FHIRFormatError {
16121    parseBackboneElementProperties(json, res);
16122    if (json.has("wasSubstituted"))
16123      res.setWasSubstitutedElement(parseBoolean(json.get("wasSubstituted").getAsBoolean()));
16124    if (json.has("_wasSubstituted"))
16125      parseElementProperties(json.getAsJsonObject("_wasSubstituted"), res.getWasSubstitutedElement());
16126    if (json.has("type"))
16127      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16128    if (json.has("reason")) {
16129      JsonArray array = json.getAsJsonArray("reason");
16130      for (int i = 0; i < array.size(); i++) {
16131        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16132      }
16133    };
16134    if (json.has("responsibleParty")) {
16135      JsonArray array = json.getAsJsonArray("responsibleParty");
16136      for (int i = 0; i < array.size(); i++) {
16137        res.getResponsibleParty().add(parseReference(array.get(i).getAsJsonObject()));
16138      }
16139    };
16140  }
16141
16142  protected MedicationKnowledge parseMedicationKnowledge(JsonObject json) throws IOException, FHIRFormatError {
16143    MedicationKnowledge res = new MedicationKnowledge();
16144    parseMedicationKnowledgeProperties(json, res);
16145    return res;
16146  }
16147
16148  protected void parseMedicationKnowledgeProperties(JsonObject json, MedicationKnowledge res) throws IOException, FHIRFormatError {
16149    parseDomainResourceProperties(json, res);
16150    if (json.has("code"))
16151      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16152    if (json.has("status"))
16153      res.setStatusElement(parseCode(json.get("status").getAsString()));
16154    if (json.has("_status"))
16155      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16156    if (json.has("manufacturer"))
16157      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
16158    if (json.has("doseForm"))
16159      res.setDoseForm(parseCodeableConcept(json.getAsJsonObject("doseForm")));
16160    if (json.has("amount"))
16161      res.setAmount(parseQuantity(json.getAsJsonObject("amount")));
16162    if (json.has("synonym")) {
16163      JsonArray array = json.getAsJsonArray("synonym");
16164      for (int i = 0; i < array.size(); i++) {
16165        res.getSynonym().add(parseString(array.get(i).getAsString()));
16166      }
16167    };
16168    if (json.has("_synonym")) {
16169      JsonArray array = json.getAsJsonArray("_synonym");
16170      for (int i = 0; i < array.size(); i++) {
16171        if (i == res.getSynonym().size())
16172          res.getSynonym().add(parseString(null));
16173        if (array.get(i) instanceof JsonObject) 
16174          parseElementProperties(array.get(i).getAsJsonObject(), res.getSynonym().get(i));
16175      }
16176    };
16177    if (json.has("relatedMedicationKnowledge")) {
16178      JsonArray array = json.getAsJsonArray("relatedMedicationKnowledge");
16179      for (int i = 0; i < array.size(); i++) {
16180        res.getRelatedMedicationKnowledge().add(parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(array.get(i).getAsJsonObject(), res));
16181      }
16182    };
16183    if (json.has("associatedMedication")) {
16184      JsonArray array = json.getAsJsonArray("associatedMedication");
16185      for (int i = 0; i < array.size(); i++) {
16186        res.getAssociatedMedication().add(parseReference(array.get(i).getAsJsonObject()));
16187      }
16188    };
16189    if (json.has("productType")) {
16190      JsonArray array = json.getAsJsonArray("productType");
16191      for (int i = 0; i < array.size(); i++) {
16192        res.getProductType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16193      }
16194    };
16195    if (json.has("monograph")) {
16196      JsonArray array = json.getAsJsonArray("monograph");
16197      for (int i = 0; i < array.size(); i++) {
16198        res.getMonograph().add(parseMedicationKnowledgeMedicationKnowledgeMonographComponent(array.get(i).getAsJsonObject(), res));
16199      }
16200    };
16201    if (json.has("ingredient")) {
16202      JsonArray array = json.getAsJsonArray("ingredient");
16203      for (int i = 0; i < array.size(); i++) {
16204        res.getIngredient().add(parseMedicationKnowledgeMedicationKnowledgeIngredientComponent(array.get(i).getAsJsonObject(), res));
16205      }
16206    };
16207    if (json.has("preparationInstruction"))
16208      res.setPreparationInstructionElement(parseMarkdown(json.get("preparationInstruction").getAsString()));
16209    if (json.has("_preparationInstruction"))
16210      parseElementProperties(json.getAsJsonObject("_preparationInstruction"), res.getPreparationInstructionElement());
16211    if (json.has("intendedRoute")) {
16212      JsonArray array = json.getAsJsonArray("intendedRoute");
16213      for (int i = 0; i < array.size(); i++) {
16214        res.getIntendedRoute().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16215      }
16216    };
16217    if (json.has("cost")) {
16218      JsonArray array = json.getAsJsonArray("cost");
16219      for (int i = 0; i < array.size(); i++) {
16220        res.getCost().add(parseMedicationKnowledgeMedicationKnowledgeCostComponent(array.get(i).getAsJsonObject(), res));
16221      }
16222    };
16223    if (json.has("monitoringProgram")) {
16224      JsonArray array = json.getAsJsonArray("monitoringProgram");
16225      for (int i = 0; i < array.size(); i++) {
16226        res.getMonitoringProgram().add(parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(array.get(i).getAsJsonObject(), res));
16227      }
16228    };
16229    if (json.has("administrationGuidelines")) {
16230      JsonArray array = json.getAsJsonArray("administrationGuidelines");
16231      for (int i = 0; i < array.size(); i++) {
16232        res.getAdministrationGuidelines().add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(array.get(i).getAsJsonObject(), res));
16233      }
16234    };
16235    if (json.has("medicineClassification")) {
16236      JsonArray array = json.getAsJsonArray("medicineClassification");
16237      for (int i = 0; i < array.size(); i++) {
16238        res.getMedicineClassification().add(parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(array.get(i).getAsJsonObject(), res));
16239      }
16240    };
16241    if (json.has("packaging"))
16242      res.setPackaging(parseMedicationKnowledgeMedicationKnowledgePackagingComponent(json.getAsJsonObject("packaging"), res));
16243    if (json.has("drugCharacteristic")) {
16244      JsonArray array = json.getAsJsonArray("drugCharacteristic");
16245      for (int i = 0; i < array.size(); i++) {
16246        res.getDrugCharacteristic().add(parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(array.get(i).getAsJsonObject(), res));
16247      }
16248    };
16249    if (json.has("contraindication")) {
16250      JsonArray array = json.getAsJsonArray("contraindication");
16251      for (int i = 0; i < array.size(); i++) {
16252        res.getContraindication().add(parseReference(array.get(i).getAsJsonObject()));
16253      }
16254    };
16255    if (json.has("regulatory")) {
16256      JsonArray array = json.getAsJsonArray("regulatory");
16257      for (int i = 0; i < array.size(); i++) {
16258        res.getRegulatory().add(parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(array.get(i).getAsJsonObject(), res));
16259      }
16260    };
16261    if (json.has("kinetics")) {
16262      JsonArray array = json.getAsJsonArray("kinetics");
16263      for (int i = 0; i < array.size(); i++) {
16264        res.getKinetics().add(parseMedicationKnowledgeMedicationKnowledgeKineticsComponent(array.get(i).getAsJsonObject(), res));
16265      }
16266    };
16267  }
16268
16269  protected MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16270    MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent res = new MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent();
16271    parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(json, owner, res);
16272    return res;
16273  }
16274
16275  protected void parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent res) throws IOException, FHIRFormatError {
16276    parseBackboneElementProperties(json, res);
16277    if (json.has("type"))
16278      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16279    if (json.has("reference")) {
16280      JsonArray array = json.getAsJsonArray("reference");
16281      for (int i = 0; i < array.size(); i++) {
16282        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
16283      }
16284    };
16285  }
16286
16287  protected MedicationKnowledge.MedicationKnowledgeMonographComponent parseMedicationKnowledgeMedicationKnowledgeMonographComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16288    MedicationKnowledge.MedicationKnowledgeMonographComponent res = new MedicationKnowledge.MedicationKnowledgeMonographComponent();
16289    parseMedicationKnowledgeMedicationKnowledgeMonographComponentProperties(json, owner, res);
16290    return res;
16291  }
16292
16293  protected void parseMedicationKnowledgeMedicationKnowledgeMonographComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMonographComponent res) throws IOException, FHIRFormatError {
16294    parseBackboneElementProperties(json, res);
16295    if (json.has("type"))
16296      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16297    if (json.has("source"))
16298      res.setSource(parseReference(json.getAsJsonObject("source")));
16299  }
16300
16301  protected MedicationKnowledge.MedicationKnowledgeIngredientComponent parseMedicationKnowledgeMedicationKnowledgeIngredientComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16302    MedicationKnowledge.MedicationKnowledgeIngredientComponent res = new MedicationKnowledge.MedicationKnowledgeIngredientComponent();
16303    parseMedicationKnowledgeMedicationKnowledgeIngredientComponentProperties(json, owner, res);
16304    return res;
16305  }
16306
16307  protected void parseMedicationKnowledgeMedicationKnowledgeIngredientComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeIngredientComponent res) throws IOException, FHIRFormatError {
16308    parseBackboneElementProperties(json, res);
16309    Type item = parseType("item", json);
16310    if (item != null)
16311      res.setItem(item);
16312    if (json.has("isActive"))
16313      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
16314    if (json.has("_isActive"))
16315      parseElementProperties(json.getAsJsonObject("_isActive"), res.getIsActiveElement());
16316    if (json.has("strength"))
16317      res.setStrength(parseRatio(json.getAsJsonObject("strength")));
16318  }
16319
16320  protected MedicationKnowledge.MedicationKnowledgeCostComponent parseMedicationKnowledgeMedicationKnowledgeCostComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16321    MedicationKnowledge.MedicationKnowledgeCostComponent res = new MedicationKnowledge.MedicationKnowledgeCostComponent();
16322    parseMedicationKnowledgeMedicationKnowledgeCostComponentProperties(json, owner, res);
16323    return res;
16324  }
16325
16326  protected void parseMedicationKnowledgeMedicationKnowledgeCostComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeCostComponent res) throws IOException, FHIRFormatError {
16327    parseBackboneElementProperties(json, res);
16328    if (json.has("type"))
16329      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16330    if (json.has("source"))
16331      res.setSourceElement(parseString(json.get("source").getAsString()));
16332    if (json.has("_source"))
16333      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
16334    if (json.has("cost"))
16335      res.setCost(parseMoney(json.getAsJsonObject("cost")));
16336  }
16337
16338  protected MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16339    MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res = new MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent();
16340    parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentProperties(json, owner, res);
16341    return res;
16342  }
16343
16344  protected void parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res) throws IOException, FHIRFormatError {
16345    parseBackboneElementProperties(json, res);
16346    if (json.has("type"))
16347      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16348    if (json.has("name"))
16349      res.setNameElement(parseString(json.get("name").getAsString()));
16350    if (json.has("_name"))
16351      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
16352  }
16353
16354  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16355    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent();
16356    parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentProperties(json, owner, res);
16357    return res;
16358  }
16359
16360  protected void parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent res) throws IOException, FHIRFormatError {
16361    parseBackboneElementProperties(json, res);
16362    if (json.has("dosage")) {
16363      JsonArray array = json.getAsJsonArray("dosage");
16364      for (int i = 0; i < array.size(); i++) {
16365        res.getDosage().add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(array.get(i).getAsJsonObject(), owner));
16366      }
16367    };
16368    Type indication = parseType("indication", json);
16369    if (indication != null)
16370      res.setIndication(indication);
16371    if (json.has("patientCharacteristics")) {
16372      JsonArray array = json.getAsJsonArray("patientCharacteristics");
16373      for (int i = 0; i < array.size(); i++) {
16374        res.getPatientCharacteristics().add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(array.get(i).getAsJsonObject(), owner));
16375      }
16376    };
16377  }
16378
16379  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16380    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent();
16381    parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentProperties(json, owner, res);
16382    return res;
16383  }
16384
16385  protected void parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent res) throws IOException, FHIRFormatError {
16386    parseBackboneElementProperties(json, res);
16387    if (json.has("type"))
16388      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16389    if (json.has("dosage")) {
16390      JsonArray array = json.getAsJsonArray("dosage");
16391      for (int i = 0; i < array.size(); i++) {
16392        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
16393      }
16394    };
16395  }
16396
16397  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16398    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent();
16399    parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentProperties(json, owner, res);
16400    return res;
16401  }
16402
16403  protected void parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent res) throws IOException, FHIRFormatError {
16404    parseBackboneElementProperties(json, res);
16405    Type characteristic = parseType("characteristic", json);
16406    if (characteristic != null)
16407      res.setCharacteristic(characteristic);
16408    if (json.has("value")) {
16409      JsonArray array = json.getAsJsonArray("value");
16410      for (int i = 0; i < array.size(); i++) {
16411        res.getValue().add(parseString(array.get(i).getAsString()));
16412      }
16413    };
16414    if (json.has("_value")) {
16415      JsonArray array = json.getAsJsonArray("_value");
16416      for (int i = 0; i < array.size(); i++) {
16417        if (i == res.getValue().size())
16418          res.getValue().add(parseString(null));
16419        if (array.get(i) instanceof JsonObject) 
16420          parseElementProperties(array.get(i).getAsJsonObject(), res.getValue().get(i));
16421      }
16422    };
16423  }
16424
16425  protected MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16426    MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res = new MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent();
16427    parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentProperties(json, owner, res);
16428    return res;
16429  }
16430
16431  protected void parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res) throws IOException, FHIRFormatError {
16432    parseBackboneElementProperties(json, res);
16433    if (json.has("type"))
16434      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16435    if (json.has("classification")) {
16436      JsonArray array = json.getAsJsonArray("classification");
16437      for (int i = 0; i < array.size(); i++) {
16438        res.getClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16439      }
16440    };
16441  }
16442
16443  protected MedicationKnowledge.MedicationKnowledgePackagingComponent parseMedicationKnowledgeMedicationKnowledgePackagingComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16444    MedicationKnowledge.MedicationKnowledgePackagingComponent res = new MedicationKnowledge.MedicationKnowledgePackagingComponent();
16445    parseMedicationKnowledgeMedicationKnowledgePackagingComponentProperties(json, owner, res);
16446    return res;
16447  }
16448
16449  protected void parseMedicationKnowledgeMedicationKnowledgePackagingComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgePackagingComponent res) throws IOException, FHIRFormatError {
16450    parseBackboneElementProperties(json, res);
16451    if (json.has("type"))
16452      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16453    if (json.has("quantity"))
16454      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
16455  }
16456
16457  protected MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16458    MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent res = new MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent();
16459    parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentProperties(json, owner, res);
16460    return res;
16461  }
16462
16463  protected void parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent res) throws IOException, FHIRFormatError {
16464    parseBackboneElementProperties(json, res);
16465    if (json.has("type"))
16466      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16467    Type value = parseType("value", json);
16468    if (value != null)
16469      res.setValue(value);
16470  }
16471
16472  protected MedicationKnowledge.MedicationKnowledgeRegulatoryComponent parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16473    MedicationKnowledge.MedicationKnowledgeRegulatoryComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryComponent();
16474    parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponentProperties(json, owner, res);
16475    return res;
16476  }
16477
16478  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatoryComponent res) throws IOException, FHIRFormatError {
16479    parseBackboneElementProperties(json, res);
16480    if (json.has("regulatoryAuthority"))
16481      res.setRegulatoryAuthority(parseReference(json.getAsJsonObject("regulatoryAuthority")));
16482    if (json.has("substitution")) {
16483      JsonArray array = json.getAsJsonArray("substitution");
16484      for (int i = 0; i < array.size(); i++) {
16485        res.getSubstitution().add(parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(array.get(i).getAsJsonObject(), owner));
16486      }
16487    };
16488    if (json.has("schedule")) {
16489      JsonArray array = json.getAsJsonArray("schedule");
16490      for (int i = 0; i < array.size(); i++) {
16491        res.getSchedule().add(parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(array.get(i).getAsJsonObject(), owner));
16492      }
16493    };
16494    if (json.has("maxDispense"))
16495      res.setMaxDispense(parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(json.getAsJsonObject("maxDispense"), owner));
16496  }
16497
16498  protected MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16499    MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent();
16500    parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentProperties(json, owner, res);
16501    return res;
16502  }
16503
16504  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent res) throws IOException, FHIRFormatError {
16505    parseBackboneElementProperties(json, res);
16506    if (json.has("type"))
16507      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16508    if (json.has("allowed"))
16509      res.setAllowedElement(parseBoolean(json.get("allowed").getAsBoolean()));
16510    if (json.has("_allowed"))
16511      parseElementProperties(json.getAsJsonObject("_allowed"), res.getAllowedElement());
16512  }
16513
16514  protected MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16515    MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent();
16516    parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentProperties(json, owner, res);
16517    return res;
16518  }
16519
16520  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent res) throws IOException, FHIRFormatError {
16521    parseBackboneElementProperties(json, res);
16522    if (json.has("schedule"))
16523      res.setSchedule(parseCodeableConcept(json.getAsJsonObject("schedule")));
16524  }
16525
16526  protected MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16527    MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent();
16528    parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(json, owner, res);
16529    return res;
16530  }
16531
16532  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent res) throws IOException, FHIRFormatError {
16533    parseBackboneElementProperties(json, res);
16534    if (json.has("quantity"))
16535      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
16536    if (json.has("period"))
16537      res.setPeriod(parseDuration(json.getAsJsonObject("period")));
16538  }
16539
16540  protected MedicationKnowledge.MedicationKnowledgeKineticsComponent parseMedicationKnowledgeMedicationKnowledgeKineticsComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
16541    MedicationKnowledge.MedicationKnowledgeKineticsComponent res = new MedicationKnowledge.MedicationKnowledgeKineticsComponent();
16542    parseMedicationKnowledgeMedicationKnowledgeKineticsComponentProperties(json, owner, res);
16543    return res;
16544  }
16545
16546  protected void parseMedicationKnowledgeMedicationKnowledgeKineticsComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeKineticsComponent res) throws IOException, FHIRFormatError {
16547    parseBackboneElementProperties(json, res);
16548    if (json.has("areaUnderCurve")) {
16549      JsonArray array = json.getAsJsonArray("areaUnderCurve");
16550      for (int i = 0; i < array.size(); i++) {
16551        res.getAreaUnderCurve().add(parseQuantity(array.get(i).getAsJsonObject()));
16552      }
16553    };
16554    if (json.has("lethalDose50")) {
16555      JsonArray array = json.getAsJsonArray("lethalDose50");
16556      for (int i = 0; i < array.size(); i++) {
16557        res.getLethalDose50().add(parseQuantity(array.get(i).getAsJsonObject()));
16558      }
16559    };
16560    if (json.has("halfLifePeriod"))
16561      res.setHalfLifePeriod(parseDuration(json.getAsJsonObject("halfLifePeriod")));
16562  }
16563
16564  protected MedicationRequest parseMedicationRequest(JsonObject json) throws IOException, FHIRFormatError {
16565    MedicationRequest res = new MedicationRequest();
16566    parseMedicationRequestProperties(json, res);
16567    return res;
16568  }
16569
16570  protected void parseMedicationRequestProperties(JsonObject json, MedicationRequest res) throws IOException, FHIRFormatError {
16571    parseDomainResourceProperties(json, res);
16572    if (json.has("identifier")) {
16573      JsonArray array = json.getAsJsonArray("identifier");
16574      for (int i = 0; i < array.size(); i++) {
16575        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16576      }
16577    };
16578    if (json.has("status"))
16579      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationRequest.MedicationRequestStatus.NULL, new MedicationRequest.MedicationRequestStatusEnumFactory()));
16580    if (json.has("_status"))
16581      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16582    if (json.has("statusReason"))
16583      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
16584    if (json.has("intent"))
16585      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), MedicationRequest.MedicationRequestIntent.NULL, new MedicationRequest.MedicationRequestIntentEnumFactory()));
16586    if (json.has("_intent"))
16587      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
16588    if (json.has("category")) {
16589      JsonArray array = json.getAsJsonArray("category");
16590      for (int i = 0; i < array.size(); i++) {
16591        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16592      }
16593    };
16594    if (json.has("priority"))
16595      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), MedicationRequest.MedicationRequestPriority.NULL, new MedicationRequest.MedicationRequestPriorityEnumFactory()));
16596    if (json.has("_priority"))
16597      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
16598    if (json.has("doNotPerform"))
16599      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
16600    if (json.has("_doNotPerform"))
16601      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
16602    Type reported = parseType("reported", json);
16603    if (reported != null)
16604      res.setReported(reported);
16605    Type medication = parseType("medication", json);
16606    if (medication != null)
16607      res.setMedication(medication);
16608    if (json.has("subject"))
16609      res.setSubject(parseReference(json.getAsJsonObject("subject")));
16610    if (json.has("encounter"))
16611      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
16612    if (json.has("supportingInformation")) {
16613      JsonArray array = json.getAsJsonArray("supportingInformation");
16614      for (int i = 0; i < array.size(); i++) {
16615        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
16616      }
16617    };
16618    if (json.has("authoredOn"))
16619      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
16620    if (json.has("_authoredOn"))
16621      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
16622    if (json.has("requester"))
16623      res.setRequester(parseReference(json.getAsJsonObject("requester")));
16624    if (json.has("performer"))
16625      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
16626    if (json.has("performerType"))
16627      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
16628    if (json.has("recorder"))
16629      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
16630    if (json.has("reasonCode")) {
16631      JsonArray array = json.getAsJsonArray("reasonCode");
16632      for (int i = 0; i < array.size(); i++) {
16633        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16634      }
16635    };
16636    if (json.has("reasonReference")) {
16637      JsonArray array = json.getAsJsonArray("reasonReference");
16638      for (int i = 0; i < array.size(); i++) {
16639        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
16640      }
16641    };
16642    if (json.has("instantiatesCanonical")) {
16643      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
16644      for (int i = 0; i < array.size(); i++) {
16645        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
16646      }
16647    };
16648    if (json.has("_instantiatesCanonical")) {
16649      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
16650      for (int i = 0; i < array.size(); i++) {
16651        if (i == res.getInstantiatesCanonical().size())
16652          res.getInstantiatesCanonical().add(parseCanonical(null));
16653        if (array.get(i) instanceof JsonObject) 
16654          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
16655      }
16656    };
16657    if (json.has("instantiatesUri")) {
16658      JsonArray array = json.getAsJsonArray("instantiatesUri");
16659      for (int i = 0; i < array.size(); i++) {
16660        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
16661      }
16662    };
16663    if (json.has("_instantiatesUri")) {
16664      JsonArray array = json.getAsJsonArray("_instantiatesUri");
16665      for (int i = 0; i < array.size(); i++) {
16666        if (i == res.getInstantiatesUri().size())
16667          res.getInstantiatesUri().add(parseUri(null));
16668        if (array.get(i) instanceof JsonObject) 
16669          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
16670      }
16671    };
16672    if (json.has("basedOn")) {
16673      JsonArray array = json.getAsJsonArray("basedOn");
16674      for (int i = 0; i < array.size(); i++) {
16675        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
16676      }
16677    };
16678    if (json.has("groupIdentifier"))
16679      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
16680    if (json.has("courseOfTherapyType"))
16681      res.setCourseOfTherapyType(parseCodeableConcept(json.getAsJsonObject("courseOfTherapyType")));
16682    if (json.has("insurance")) {
16683      JsonArray array = json.getAsJsonArray("insurance");
16684      for (int i = 0; i < array.size(); i++) {
16685        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
16686      }
16687    };
16688    if (json.has("note")) {
16689      JsonArray array = json.getAsJsonArray("note");
16690      for (int i = 0; i < array.size(); i++) {
16691        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16692      }
16693    };
16694    if (json.has("dosageInstruction")) {
16695      JsonArray array = json.getAsJsonArray("dosageInstruction");
16696      for (int i = 0; i < array.size(); i++) {
16697        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
16698      }
16699    };
16700    if (json.has("dispenseRequest"))
16701      res.setDispenseRequest(parseMedicationRequestMedicationRequestDispenseRequestComponent(json.getAsJsonObject("dispenseRequest"), res));
16702    if (json.has("substitution"))
16703      res.setSubstitution(parseMedicationRequestMedicationRequestSubstitutionComponent(json.getAsJsonObject("substitution"), res));
16704    if (json.has("priorPrescription"))
16705      res.setPriorPrescription(parseReference(json.getAsJsonObject("priorPrescription")));
16706    if (json.has("detectedIssue")) {
16707      JsonArray array = json.getAsJsonArray("detectedIssue");
16708      for (int i = 0; i < array.size(); i++) {
16709        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
16710      }
16711    };
16712    if (json.has("eventHistory")) {
16713      JsonArray array = json.getAsJsonArray("eventHistory");
16714      for (int i = 0; i < array.size(); i++) {
16715        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
16716      }
16717    };
16718  }
16719
16720  protected MedicationRequest.MedicationRequestDispenseRequestComponent parseMedicationRequestMedicationRequestDispenseRequestComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
16721    MedicationRequest.MedicationRequestDispenseRequestComponent res = new MedicationRequest.MedicationRequestDispenseRequestComponent();
16722    parseMedicationRequestMedicationRequestDispenseRequestComponentProperties(json, owner, res);
16723    return res;
16724  }
16725
16726  protected void parseMedicationRequestMedicationRequestDispenseRequestComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestDispenseRequestComponent res) throws IOException, FHIRFormatError {
16727    parseBackboneElementProperties(json, res);
16728    if (json.has("initialFill"))
16729      res.setInitialFill(parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponent(json.getAsJsonObject("initialFill"), owner));
16730    if (json.has("dispenseInterval"))
16731      res.setDispenseInterval(parseDuration(json.getAsJsonObject("dispenseInterval")));
16732    if (json.has("validityPeriod"))
16733      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
16734    if (json.has("numberOfRepeatsAllowed"))
16735      res.setNumberOfRepeatsAllowedElement(parseUnsignedInt(json.get("numberOfRepeatsAllowed").getAsString()));
16736    if (json.has("_numberOfRepeatsAllowed"))
16737      parseElementProperties(json.getAsJsonObject("_numberOfRepeatsAllowed"), res.getNumberOfRepeatsAllowedElement());
16738    if (json.has("quantity"))
16739      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
16740    if (json.has("expectedSupplyDuration"))
16741      res.setExpectedSupplyDuration(parseDuration(json.getAsJsonObject("expectedSupplyDuration")));
16742    if (json.has("performer"))
16743      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
16744  }
16745
16746  protected MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
16747    MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent res = new MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent();
16748    parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponentProperties(json, owner, res);
16749    return res;
16750  }
16751
16752  protected void parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent res) throws IOException, FHIRFormatError {
16753    parseBackboneElementProperties(json, res);
16754    if (json.has("quantity"))
16755      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
16756    if (json.has("duration"))
16757      res.setDuration(parseDuration(json.getAsJsonObject("duration")));
16758  }
16759
16760  protected MedicationRequest.MedicationRequestSubstitutionComponent parseMedicationRequestMedicationRequestSubstitutionComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
16761    MedicationRequest.MedicationRequestSubstitutionComponent res = new MedicationRequest.MedicationRequestSubstitutionComponent();
16762    parseMedicationRequestMedicationRequestSubstitutionComponentProperties(json, owner, res);
16763    return res;
16764  }
16765
16766  protected void parseMedicationRequestMedicationRequestSubstitutionComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestSubstitutionComponent res) throws IOException, FHIRFormatError {
16767    parseBackboneElementProperties(json, res);
16768    Type allowed = parseType("allowed", json);
16769    if (allowed != null)
16770      res.setAllowed(allowed);
16771    if (json.has("reason"))
16772      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
16773  }
16774
16775  protected MedicationStatement parseMedicationStatement(JsonObject json) throws IOException, FHIRFormatError {
16776    MedicationStatement res = new MedicationStatement();
16777    parseMedicationStatementProperties(json, res);
16778    return res;
16779  }
16780
16781  protected void parseMedicationStatementProperties(JsonObject json, MedicationStatement res) throws IOException, FHIRFormatError {
16782    parseDomainResourceProperties(json, res);
16783    if (json.has("identifier")) {
16784      JsonArray array = json.getAsJsonArray("identifier");
16785      for (int i = 0; i < array.size(); i++) {
16786        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16787      }
16788    };
16789    if (json.has("basedOn")) {
16790      JsonArray array = json.getAsJsonArray("basedOn");
16791      for (int i = 0; i < array.size(); i++) {
16792        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
16793      }
16794    };
16795    if (json.has("partOf")) {
16796      JsonArray array = json.getAsJsonArray("partOf");
16797      for (int i = 0; i < array.size(); i++) {
16798        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
16799      }
16800    };
16801    if (json.has("status"))
16802      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationStatement.MedicationStatementStatus.NULL, new MedicationStatement.MedicationStatementStatusEnumFactory()));
16803    if (json.has("_status"))
16804      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16805    if (json.has("statusReason")) {
16806      JsonArray array = json.getAsJsonArray("statusReason");
16807      for (int i = 0; i < array.size(); i++) {
16808        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16809      }
16810    };
16811    if (json.has("category"))
16812      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
16813    Type medication = parseType("medication", json);
16814    if (medication != null)
16815      res.setMedication(medication);
16816    if (json.has("subject"))
16817      res.setSubject(parseReference(json.getAsJsonObject("subject")));
16818    if (json.has("context"))
16819      res.setContext(parseReference(json.getAsJsonObject("context")));
16820    Type effective = parseType("effective", json);
16821    if (effective != null)
16822      res.setEffective(effective);
16823    if (json.has("dateAsserted"))
16824      res.setDateAssertedElement(parseDateTime(json.get("dateAsserted").getAsString()));
16825    if (json.has("_dateAsserted"))
16826      parseElementProperties(json.getAsJsonObject("_dateAsserted"), res.getDateAssertedElement());
16827    if (json.has("informationSource"))
16828      res.setInformationSource(parseReference(json.getAsJsonObject("informationSource")));
16829    if (json.has("derivedFrom")) {
16830      JsonArray array = json.getAsJsonArray("derivedFrom");
16831      for (int i = 0; i < array.size(); i++) {
16832        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
16833      }
16834    };
16835    if (json.has("reasonCode")) {
16836      JsonArray array = json.getAsJsonArray("reasonCode");
16837      for (int i = 0; i < array.size(); i++) {
16838        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16839      }
16840    };
16841    if (json.has("reasonReference")) {
16842      JsonArray array = json.getAsJsonArray("reasonReference");
16843      for (int i = 0; i < array.size(); i++) {
16844        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
16845      }
16846    };
16847    if (json.has("note")) {
16848      JsonArray array = json.getAsJsonArray("note");
16849      for (int i = 0; i < array.size(); i++) {
16850        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16851      }
16852    };
16853    if (json.has("dosage")) {
16854      JsonArray array = json.getAsJsonArray("dosage");
16855      for (int i = 0; i < array.size(); i++) {
16856        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
16857      }
16858    };
16859  }
16860
16861  protected MedicinalProduct parseMedicinalProduct(JsonObject json) throws IOException, FHIRFormatError {
16862    MedicinalProduct res = new MedicinalProduct();
16863    parseMedicinalProductProperties(json, res);
16864    return res;
16865  }
16866
16867  protected void parseMedicinalProductProperties(JsonObject json, MedicinalProduct res) throws IOException, FHIRFormatError {
16868    parseDomainResourceProperties(json, res);
16869    if (json.has("identifier")) {
16870      JsonArray array = json.getAsJsonArray("identifier");
16871      for (int i = 0; i < array.size(); i++) {
16872        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16873      }
16874    };
16875    if (json.has("type"))
16876      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16877    if (json.has("domain"))
16878      res.setDomain(parseCoding(json.getAsJsonObject("domain")));
16879    if (json.has("combinedPharmaceuticalDoseForm"))
16880      res.setCombinedPharmaceuticalDoseForm(parseCodeableConcept(json.getAsJsonObject("combinedPharmaceuticalDoseForm")));
16881    if (json.has("legalStatusOfSupply"))
16882      res.setLegalStatusOfSupply(parseCodeableConcept(json.getAsJsonObject("legalStatusOfSupply")));
16883    if (json.has("additionalMonitoringIndicator"))
16884      res.setAdditionalMonitoringIndicator(parseCodeableConcept(json.getAsJsonObject("additionalMonitoringIndicator")));
16885    if (json.has("specialMeasures")) {
16886      JsonArray array = json.getAsJsonArray("specialMeasures");
16887      for (int i = 0; i < array.size(); i++) {
16888        res.getSpecialMeasures().add(parseString(array.get(i).getAsString()));
16889      }
16890    };
16891    if (json.has("_specialMeasures")) {
16892      JsonArray array = json.getAsJsonArray("_specialMeasures");
16893      for (int i = 0; i < array.size(); i++) {
16894        if (i == res.getSpecialMeasures().size())
16895          res.getSpecialMeasures().add(parseString(null));
16896        if (array.get(i) instanceof JsonObject) 
16897          parseElementProperties(array.get(i).getAsJsonObject(), res.getSpecialMeasures().get(i));
16898      }
16899    };
16900    if (json.has("paediatricUseIndicator"))
16901      res.setPaediatricUseIndicator(parseCodeableConcept(json.getAsJsonObject("paediatricUseIndicator")));
16902    if (json.has("productClassification")) {
16903      JsonArray array = json.getAsJsonArray("productClassification");
16904      for (int i = 0; i < array.size(); i++) {
16905        res.getProductClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16906      }
16907    };
16908    if (json.has("marketingStatus")) {
16909      JsonArray array = json.getAsJsonArray("marketingStatus");
16910      for (int i = 0; i < array.size(); i++) {
16911        res.getMarketingStatus().add(parseMarketingStatus(array.get(i).getAsJsonObject()));
16912      }
16913    };
16914    if (json.has("pharmaceuticalProduct")) {
16915      JsonArray array = json.getAsJsonArray("pharmaceuticalProduct");
16916      for (int i = 0; i < array.size(); i++) {
16917        res.getPharmaceuticalProduct().add(parseReference(array.get(i).getAsJsonObject()));
16918      }
16919    };
16920    if (json.has("packagedMedicinalProduct")) {
16921      JsonArray array = json.getAsJsonArray("packagedMedicinalProduct");
16922      for (int i = 0; i < array.size(); i++) {
16923        res.getPackagedMedicinalProduct().add(parseReference(array.get(i).getAsJsonObject()));
16924      }
16925    };
16926    if (json.has("attachedDocument")) {
16927      JsonArray array = json.getAsJsonArray("attachedDocument");
16928      for (int i = 0; i < array.size(); i++) {
16929        res.getAttachedDocument().add(parseReference(array.get(i).getAsJsonObject()));
16930      }
16931    };
16932    if (json.has("masterFile")) {
16933      JsonArray array = json.getAsJsonArray("masterFile");
16934      for (int i = 0; i < array.size(); i++) {
16935        res.getMasterFile().add(parseReference(array.get(i).getAsJsonObject()));
16936      }
16937    };
16938    if (json.has("contact")) {
16939      JsonArray array = json.getAsJsonArray("contact");
16940      for (int i = 0; i < array.size(); i++) {
16941        res.getContact().add(parseReference(array.get(i).getAsJsonObject()));
16942      }
16943    };
16944    if (json.has("clinicalTrial")) {
16945      JsonArray array = json.getAsJsonArray("clinicalTrial");
16946      for (int i = 0; i < array.size(); i++) {
16947        res.getClinicalTrial().add(parseReference(array.get(i).getAsJsonObject()));
16948      }
16949    };
16950    if (json.has("name")) {
16951      JsonArray array = json.getAsJsonArray("name");
16952      for (int i = 0; i < array.size(); i++) {
16953        res.getName().add(parseMedicinalProductMedicinalProductNameComponent(array.get(i).getAsJsonObject(), res));
16954      }
16955    };
16956    if (json.has("crossReference")) {
16957      JsonArray array = json.getAsJsonArray("crossReference");
16958      for (int i = 0; i < array.size(); i++) {
16959        res.getCrossReference().add(parseIdentifier(array.get(i).getAsJsonObject()));
16960      }
16961    };
16962    if (json.has("manufacturingBusinessOperation")) {
16963      JsonArray array = json.getAsJsonArray("manufacturingBusinessOperation");
16964      for (int i = 0; i < array.size(); i++) {
16965        res.getManufacturingBusinessOperation().add(parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(array.get(i).getAsJsonObject(), res));
16966      }
16967    };
16968    if (json.has("specialDesignation")) {
16969      JsonArray array = json.getAsJsonArray("specialDesignation");
16970      for (int i = 0; i < array.size(); i++) {
16971        res.getSpecialDesignation().add(parseMedicinalProductMedicinalProductSpecialDesignationComponent(array.get(i).getAsJsonObject(), res));
16972      }
16973    };
16974  }
16975
16976  protected MedicinalProduct.MedicinalProductNameComponent parseMedicinalProductMedicinalProductNameComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
16977    MedicinalProduct.MedicinalProductNameComponent res = new MedicinalProduct.MedicinalProductNameComponent();
16978    parseMedicinalProductMedicinalProductNameComponentProperties(json, owner, res);
16979    return res;
16980  }
16981
16982  protected void parseMedicinalProductMedicinalProductNameComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductNameComponent res) throws IOException, FHIRFormatError {
16983    parseBackboneElementProperties(json, res);
16984    if (json.has("productName"))
16985      res.setProductNameElement(parseString(json.get("productName").getAsString()));
16986    if (json.has("_productName"))
16987      parseElementProperties(json.getAsJsonObject("_productName"), res.getProductNameElement());
16988    if (json.has("namePart")) {
16989      JsonArray array = json.getAsJsonArray("namePart");
16990      for (int i = 0; i < array.size(); i++) {
16991        res.getNamePart().add(parseMedicinalProductMedicinalProductNameNamePartComponent(array.get(i).getAsJsonObject(), owner));
16992      }
16993    };
16994    if (json.has("countryLanguage")) {
16995      JsonArray array = json.getAsJsonArray("countryLanguage");
16996      for (int i = 0; i < array.size(); i++) {
16997        res.getCountryLanguage().add(parseMedicinalProductMedicinalProductNameCountryLanguageComponent(array.get(i).getAsJsonObject(), owner));
16998      }
16999    };
17000  }
17001
17002  protected MedicinalProduct.MedicinalProductNameNamePartComponent parseMedicinalProductMedicinalProductNameNamePartComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
17003    MedicinalProduct.MedicinalProductNameNamePartComponent res = new MedicinalProduct.MedicinalProductNameNamePartComponent();
17004    parseMedicinalProductMedicinalProductNameNamePartComponentProperties(json, owner, res);
17005    return res;
17006  }
17007
17008  protected void parseMedicinalProductMedicinalProductNameNamePartComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductNameNamePartComponent res) throws IOException, FHIRFormatError {
17009    parseBackboneElementProperties(json, res);
17010    if (json.has("part"))
17011      res.setPartElement(parseString(json.get("part").getAsString()));
17012    if (json.has("_part"))
17013      parseElementProperties(json.getAsJsonObject("_part"), res.getPartElement());
17014    if (json.has("type"))
17015      res.setType(parseCoding(json.getAsJsonObject("type")));
17016  }
17017
17018  protected MedicinalProduct.MedicinalProductNameCountryLanguageComponent parseMedicinalProductMedicinalProductNameCountryLanguageComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
17019    MedicinalProduct.MedicinalProductNameCountryLanguageComponent res = new MedicinalProduct.MedicinalProductNameCountryLanguageComponent();
17020    parseMedicinalProductMedicinalProductNameCountryLanguageComponentProperties(json, owner, res);
17021    return res;
17022  }
17023
17024  protected void parseMedicinalProductMedicinalProductNameCountryLanguageComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductNameCountryLanguageComponent res) throws IOException, FHIRFormatError {
17025    parseBackboneElementProperties(json, res);
17026    if (json.has("country"))
17027      res.setCountry(parseCodeableConcept(json.getAsJsonObject("country")));
17028    if (json.has("jurisdiction"))
17029      res.setJurisdiction(parseCodeableConcept(json.getAsJsonObject("jurisdiction")));
17030    if (json.has("language"))
17031      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
17032  }
17033
17034  protected MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
17035    MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent res = new MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent();
17036    parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponentProperties(json, owner, res);
17037    return res;
17038  }
17039
17040  protected void parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent res) throws IOException, FHIRFormatError {
17041    parseBackboneElementProperties(json, res);
17042    if (json.has("operationType"))
17043      res.setOperationType(parseCodeableConcept(json.getAsJsonObject("operationType")));
17044    if (json.has("authorisationReferenceNumber"))
17045      res.setAuthorisationReferenceNumber(parseIdentifier(json.getAsJsonObject("authorisationReferenceNumber")));
17046    if (json.has("effectiveDate"))
17047      res.setEffectiveDateElement(parseDateTime(json.get("effectiveDate").getAsString()));
17048    if (json.has("_effectiveDate"))
17049      parseElementProperties(json.getAsJsonObject("_effectiveDate"), res.getEffectiveDateElement());
17050    if (json.has("confidentialityIndicator"))
17051      res.setConfidentialityIndicator(parseCodeableConcept(json.getAsJsonObject("confidentialityIndicator")));
17052    if (json.has("manufacturer")) {
17053      JsonArray array = json.getAsJsonArray("manufacturer");
17054      for (int i = 0; i < array.size(); i++) {
17055        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
17056      }
17057    };
17058    if (json.has("regulator"))
17059      res.setRegulator(parseReference(json.getAsJsonObject("regulator")));
17060  }
17061
17062  protected MedicinalProduct.MedicinalProductSpecialDesignationComponent parseMedicinalProductMedicinalProductSpecialDesignationComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
17063    MedicinalProduct.MedicinalProductSpecialDesignationComponent res = new MedicinalProduct.MedicinalProductSpecialDesignationComponent();
17064    parseMedicinalProductMedicinalProductSpecialDesignationComponentProperties(json, owner, res);
17065    return res;
17066  }
17067
17068  protected void parseMedicinalProductMedicinalProductSpecialDesignationComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductSpecialDesignationComponent res) throws IOException, FHIRFormatError {
17069    parseBackboneElementProperties(json, res);
17070    if (json.has("identifier")) {
17071      JsonArray array = json.getAsJsonArray("identifier");
17072      for (int i = 0; i < array.size(); i++) {
17073        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17074      }
17075    };
17076    if (json.has("type"))
17077      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17078    if (json.has("intendedUse"))
17079      res.setIntendedUse(parseCodeableConcept(json.getAsJsonObject("intendedUse")));
17080    Type indication = parseType("indication", json);
17081    if (indication != null)
17082      res.setIndication(indication);
17083    if (json.has("status"))
17084      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
17085    if (json.has("date"))
17086      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17087    if (json.has("_date"))
17088      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
17089    if (json.has("species"))
17090      res.setSpecies(parseCodeableConcept(json.getAsJsonObject("species")));
17091  }
17092
17093  protected MedicinalProductAuthorization parseMedicinalProductAuthorization(JsonObject json) throws IOException, FHIRFormatError {
17094    MedicinalProductAuthorization res = new MedicinalProductAuthorization();
17095    parseMedicinalProductAuthorizationProperties(json, res);
17096    return res;
17097  }
17098
17099  protected void parseMedicinalProductAuthorizationProperties(JsonObject json, MedicinalProductAuthorization res) throws IOException, FHIRFormatError {
17100    parseDomainResourceProperties(json, res);
17101    if (json.has("identifier")) {
17102      JsonArray array = json.getAsJsonArray("identifier");
17103      for (int i = 0; i < array.size(); i++) {
17104        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17105      }
17106    };
17107    if (json.has("subject"))
17108      res.setSubject(parseReference(json.getAsJsonObject("subject")));
17109    if (json.has("country")) {
17110      JsonArray array = json.getAsJsonArray("country");
17111      for (int i = 0; i < array.size(); i++) {
17112        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17113      }
17114    };
17115    if (json.has("jurisdiction")) {
17116      JsonArray array = json.getAsJsonArray("jurisdiction");
17117      for (int i = 0; i < array.size(); i++) {
17118        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17119      }
17120    };
17121    if (json.has("status"))
17122      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
17123    if (json.has("statusDate"))
17124      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
17125    if (json.has("_statusDate"))
17126      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
17127    if (json.has("restoreDate"))
17128      res.setRestoreDateElement(parseDateTime(json.get("restoreDate").getAsString()));
17129    if (json.has("_restoreDate"))
17130      parseElementProperties(json.getAsJsonObject("_restoreDate"), res.getRestoreDateElement());
17131    if (json.has("validityPeriod"))
17132      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
17133    if (json.has("dataExclusivityPeriod"))
17134      res.setDataExclusivityPeriod(parsePeriod(json.getAsJsonObject("dataExclusivityPeriod")));
17135    if (json.has("dateOfFirstAuthorization"))
17136      res.setDateOfFirstAuthorizationElement(parseDateTime(json.get("dateOfFirstAuthorization").getAsString()));
17137    if (json.has("_dateOfFirstAuthorization"))
17138      parseElementProperties(json.getAsJsonObject("_dateOfFirstAuthorization"), res.getDateOfFirstAuthorizationElement());
17139    if (json.has("internationalBirthDate"))
17140      res.setInternationalBirthDateElement(parseDateTime(json.get("internationalBirthDate").getAsString()));
17141    if (json.has("_internationalBirthDate"))
17142      parseElementProperties(json.getAsJsonObject("_internationalBirthDate"), res.getInternationalBirthDateElement());
17143    if (json.has("legalBasis"))
17144      res.setLegalBasis(parseCodeableConcept(json.getAsJsonObject("legalBasis")));
17145    if (json.has("jurisdictionalAuthorization")) {
17146      JsonArray array = json.getAsJsonArray("jurisdictionalAuthorization");
17147      for (int i = 0; i < array.size(); i++) {
17148        res.getJurisdictionalAuthorization().add(parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(array.get(i).getAsJsonObject(), res));
17149      }
17150    };
17151    if (json.has("holder"))
17152      res.setHolder(parseReference(json.getAsJsonObject("holder")));
17153    if (json.has("regulator"))
17154      res.setRegulator(parseReference(json.getAsJsonObject("regulator")));
17155    if (json.has("procedure"))
17156      res.setProcedure(parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(json.getAsJsonObject("procedure"), res));
17157  }
17158
17159  protected MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(JsonObject json, MedicinalProductAuthorization owner) throws IOException, FHIRFormatError {
17160    MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent res = new MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent();
17161    parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentProperties(json, owner, res);
17162    return res;
17163  }
17164
17165  protected void parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentProperties(JsonObject json, MedicinalProductAuthorization owner, MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent res) throws IOException, FHIRFormatError {
17166    parseBackboneElementProperties(json, res);
17167    if (json.has("identifier")) {
17168      JsonArray array = json.getAsJsonArray("identifier");
17169      for (int i = 0; i < array.size(); i++) {
17170        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17171      }
17172    };
17173    if (json.has("country"))
17174      res.setCountry(parseCodeableConcept(json.getAsJsonObject("country")));
17175    if (json.has("jurisdiction")) {
17176      JsonArray array = json.getAsJsonArray("jurisdiction");
17177      for (int i = 0; i < array.size(); i++) {
17178        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17179      }
17180    };
17181    if (json.has("legalStatusOfSupply"))
17182      res.setLegalStatusOfSupply(parseCodeableConcept(json.getAsJsonObject("legalStatusOfSupply")));
17183    if (json.has("validityPeriod"))
17184      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
17185  }
17186
17187  protected MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(JsonObject json, MedicinalProductAuthorization owner) throws IOException, FHIRFormatError {
17188    MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent res = new MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent();
17189    parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentProperties(json, owner, res);
17190    return res;
17191  }
17192
17193  protected void parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentProperties(JsonObject json, MedicinalProductAuthorization owner, MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent res) throws IOException, FHIRFormatError {
17194    parseBackboneElementProperties(json, res);
17195    if (json.has("identifier"))
17196      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
17197    if (json.has("type"))
17198      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17199    Type date = parseType("date", json);
17200    if (date != null)
17201      res.setDate(date);
17202    if (json.has("application")) {
17203      JsonArray array = json.getAsJsonArray("application");
17204      for (int i = 0; i < array.size(); i++) {
17205        res.getApplication().add(parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(array.get(i).getAsJsonObject(), owner));
17206      }
17207    };
17208  }
17209
17210  protected MedicinalProductContraindication parseMedicinalProductContraindication(JsonObject json) throws IOException, FHIRFormatError {
17211    MedicinalProductContraindication res = new MedicinalProductContraindication();
17212    parseMedicinalProductContraindicationProperties(json, res);
17213    return res;
17214  }
17215
17216  protected void parseMedicinalProductContraindicationProperties(JsonObject json, MedicinalProductContraindication res) throws IOException, FHIRFormatError {
17217    parseDomainResourceProperties(json, res);
17218    if (json.has("subject")) {
17219      JsonArray array = json.getAsJsonArray("subject");
17220      for (int i = 0; i < array.size(); i++) {
17221        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
17222      }
17223    };
17224    if (json.has("disease"))
17225      res.setDisease(parseCodeableConcept(json.getAsJsonObject("disease")));
17226    if (json.has("diseaseStatus"))
17227      res.setDiseaseStatus(parseCodeableConcept(json.getAsJsonObject("diseaseStatus")));
17228    if (json.has("comorbidity")) {
17229      JsonArray array = json.getAsJsonArray("comorbidity");
17230      for (int i = 0; i < array.size(); i++) {
17231        res.getComorbidity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17232      }
17233    };
17234    if (json.has("therapeuticIndication")) {
17235      JsonArray array = json.getAsJsonArray("therapeuticIndication");
17236      for (int i = 0; i < array.size(); i++) {
17237        res.getTherapeuticIndication().add(parseReference(array.get(i).getAsJsonObject()));
17238      }
17239    };
17240    if (json.has("otherTherapy")) {
17241      JsonArray array = json.getAsJsonArray("otherTherapy");
17242      for (int i = 0; i < array.size(); i++) {
17243        res.getOtherTherapy().add(parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(array.get(i).getAsJsonObject(), res));
17244      }
17245    };
17246    if (json.has("population")) {
17247      JsonArray array = json.getAsJsonArray("population");
17248      for (int i = 0; i < array.size(); i++) {
17249        res.getPopulation().add(parsePopulation(array.get(i).getAsJsonObject()));
17250      }
17251    };
17252  }
17253
17254  protected MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(JsonObject json, MedicinalProductContraindication owner) throws IOException, FHIRFormatError {
17255    MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent res = new MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent();
17256    parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentProperties(json, owner, res);
17257    return res;
17258  }
17259
17260  protected void parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentProperties(JsonObject json, MedicinalProductContraindication owner, MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent res) throws IOException, FHIRFormatError {
17261    parseBackboneElementProperties(json, res);
17262    if (json.has("therapyRelationshipType"))
17263      res.setTherapyRelationshipType(parseCodeableConcept(json.getAsJsonObject("therapyRelationshipType")));
17264    Type medication = parseType("medication", json);
17265    if (medication != null)
17266      res.setMedication(medication);
17267  }
17268
17269  protected MedicinalProductIndication parseMedicinalProductIndication(JsonObject json) throws IOException, FHIRFormatError {
17270    MedicinalProductIndication res = new MedicinalProductIndication();
17271    parseMedicinalProductIndicationProperties(json, res);
17272    return res;
17273  }
17274
17275  protected void parseMedicinalProductIndicationProperties(JsonObject json, MedicinalProductIndication res) throws IOException, FHIRFormatError {
17276    parseDomainResourceProperties(json, res);
17277    if (json.has("subject")) {
17278      JsonArray array = json.getAsJsonArray("subject");
17279      for (int i = 0; i < array.size(); i++) {
17280        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
17281      }
17282    };
17283    if (json.has("diseaseSymptomProcedure"))
17284      res.setDiseaseSymptomProcedure(parseCodeableConcept(json.getAsJsonObject("diseaseSymptomProcedure")));
17285    if (json.has("diseaseStatus"))
17286      res.setDiseaseStatus(parseCodeableConcept(json.getAsJsonObject("diseaseStatus")));
17287    if (json.has("comorbidity")) {
17288      JsonArray array = json.getAsJsonArray("comorbidity");
17289      for (int i = 0; i < array.size(); i++) {
17290        res.getComorbidity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17291      }
17292    };
17293    if (json.has("intendedEffect"))
17294      res.setIntendedEffect(parseCodeableConcept(json.getAsJsonObject("intendedEffect")));
17295    if (json.has("duration"))
17296      res.setDuration(parseQuantity(json.getAsJsonObject("duration")));
17297    if (json.has("otherTherapy")) {
17298      JsonArray array = json.getAsJsonArray("otherTherapy");
17299      for (int i = 0; i < array.size(); i++) {
17300        res.getOtherTherapy().add(parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(array.get(i).getAsJsonObject(), res));
17301      }
17302    };
17303    if (json.has("undesirableEffect")) {
17304      JsonArray array = json.getAsJsonArray("undesirableEffect");
17305      for (int i = 0; i < array.size(); i++) {
17306        res.getUndesirableEffect().add(parseReference(array.get(i).getAsJsonObject()));
17307      }
17308    };
17309    if (json.has("population")) {
17310      JsonArray array = json.getAsJsonArray("population");
17311      for (int i = 0; i < array.size(); i++) {
17312        res.getPopulation().add(parsePopulation(array.get(i).getAsJsonObject()));
17313      }
17314    };
17315  }
17316
17317  protected MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(JsonObject json, MedicinalProductIndication owner) throws IOException, FHIRFormatError {
17318    MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent res = new MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent();
17319    parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentProperties(json, owner, res);
17320    return res;
17321  }
17322
17323  protected void parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentProperties(JsonObject json, MedicinalProductIndication owner, MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent res) throws IOException, FHIRFormatError {
17324    parseBackboneElementProperties(json, res);
17325    if (json.has("therapyRelationshipType"))
17326      res.setTherapyRelationshipType(parseCodeableConcept(json.getAsJsonObject("therapyRelationshipType")));
17327    Type medication = parseType("medication", json);
17328    if (medication != null)
17329      res.setMedication(medication);
17330  }
17331
17332  protected MedicinalProductIngredient parseMedicinalProductIngredient(JsonObject json) throws IOException, FHIRFormatError {
17333    MedicinalProductIngredient res = new MedicinalProductIngredient();
17334    parseMedicinalProductIngredientProperties(json, res);
17335    return res;
17336  }
17337
17338  protected void parseMedicinalProductIngredientProperties(JsonObject json, MedicinalProductIngredient res) throws IOException, FHIRFormatError {
17339    parseDomainResourceProperties(json, res);
17340    if (json.has("identifier"))
17341      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
17342    if (json.has("role"))
17343      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
17344    if (json.has("allergenicIndicator"))
17345      res.setAllergenicIndicatorElement(parseBoolean(json.get("allergenicIndicator").getAsBoolean()));
17346    if (json.has("_allergenicIndicator"))
17347      parseElementProperties(json.getAsJsonObject("_allergenicIndicator"), res.getAllergenicIndicatorElement());
17348    if (json.has("manufacturer")) {
17349      JsonArray array = json.getAsJsonArray("manufacturer");
17350      for (int i = 0; i < array.size(); i++) {
17351        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
17352      }
17353    };
17354    if (json.has("specifiedSubstance")) {
17355      JsonArray array = json.getAsJsonArray("specifiedSubstance");
17356      for (int i = 0; i < array.size(); i++) {
17357        res.getSpecifiedSubstance().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(array.get(i).getAsJsonObject(), res));
17358      }
17359    };
17360    if (json.has("substance"))
17361      res.setSubstance(parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(json.getAsJsonObject("substance"), res));
17362  }
17363
17364  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
17365    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent();
17366    parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentProperties(json, owner, res);
17367    return res;
17368  }
17369
17370  protected void parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent res) throws IOException, FHIRFormatError {
17371    parseBackboneElementProperties(json, res);
17372    if (json.has("code"))
17373      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17374    if (json.has("group"))
17375      res.setGroup(parseCodeableConcept(json.getAsJsonObject("group")));
17376    if (json.has("confidentiality"))
17377      res.setConfidentiality(parseCodeableConcept(json.getAsJsonObject("confidentiality")));
17378    if (json.has("strength")) {
17379      JsonArray array = json.getAsJsonArray("strength");
17380      for (int i = 0; i < array.size(); i++) {
17381        res.getStrength().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(array.get(i).getAsJsonObject(), owner));
17382      }
17383    };
17384  }
17385
17386  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
17387    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent();
17388    parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentProperties(json, owner, res);
17389    return res;
17390  }
17391
17392  protected void parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent res) throws IOException, FHIRFormatError {
17393    parseBackboneElementProperties(json, res);
17394    if (json.has("presentation"))
17395      res.setPresentation(parseRatio(json.getAsJsonObject("presentation")));
17396    if (json.has("presentationLowLimit"))
17397      res.setPresentationLowLimit(parseRatio(json.getAsJsonObject("presentationLowLimit")));
17398    if (json.has("concentration"))
17399      res.setConcentration(parseRatio(json.getAsJsonObject("concentration")));
17400    if (json.has("concentrationLowLimit"))
17401      res.setConcentrationLowLimit(parseRatio(json.getAsJsonObject("concentrationLowLimit")));
17402    if (json.has("measurementPoint"))
17403      res.setMeasurementPointElement(parseString(json.get("measurementPoint").getAsString()));
17404    if (json.has("_measurementPoint"))
17405      parseElementProperties(json.getAsJsonObject("_measurementPoint"), res.getMeasurementPointElement());
17406    if (json.has("country")) {
17407      JsonArray array = json.getAsJsonArray("country");
17408      for (int i = 0; i < array.size(); i++) {
17409        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17410      }
17411    };
17412    if (json.has("referenceStrength")) {
17413      JsonArray array = json.getAsJsonArray("referenceStrength");
17414      for (int i = 0; i < array.size(); i++) {
17415        res.getReferenceStrength().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(array.get(i).getAsJsonObject(), owner));
17416      }
17417    };
17418  }
17419
17420  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
17421    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent();
17422    parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentProperties(json, owner, res);
17423    return res;
17424  }
17425
17426  protected void parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent res) throws IOException, FHIRFormatError {
17427    parseBackboneElementProperties(json, res);
17428    if (json.has("substance"))
17429      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
17430    if (json.has("strength"))
17431      res.setStrength(parseRatio(json.getAsJsonObject("strength")));
17432    if (json.has("strengthLowLimit"))
17433      res.setStrengthLowLimit(parseRatio(json.getAsJsonObject("strengthLowLimit")));
17434    if (json.has("measurementPoint"))
17435      res.setMeasurementPointElement(parseString(json.get("measurementPoint").getAsString()));
17436    if (json.has("_measurementPoint"))
17437      parseElementProperties(json.getAsJsonObject("_measurementPoint"), res.getMeasurementPointElement());
17438    if (json.has("country")) {
17439      JsonArray array = json.getAsJsonArray("country");
17440      for (int i = 0; i < array.size(); i++) {
17441        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17442      }
17443    };
17444  }
17445
17446  protected MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
17447    MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent();
17448    parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentProperties(json, owner, res);
17449    return res;
17450  }
17451
17452  protected void parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent res) throws IOException, FHIRFormatError {
17453    parseBackboneElementProperties(json, res);
17454    if (json.has("code"))
17455      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17456    if (json.has("strength")) {
17457      JsonArray array = json.getAsJsonArray("strength");
17458      for (int i = 0; i < array.size(); i++) {
17459        res.getStrength().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(array.get(i).getAsJsonObject(), owner));
17460      }
17461    };
17462  }
17463
17464  protected MedicinalProductInteraction parseMedicinalProductInteraction(JsonObject json) throws IOException, FHIRFormatError {
17465    MedicinalProductInteraction res = new MedicinalProductInteraction();
17466    parseMedicinalProductInteractionProperties(json, res);
17467    return res;
17468  }
17469
17470  protected void parseMedicinalProductInteractionProperties(JsonObject json, MedicinalProductInteraction res) throws IOException, FHIRFormatError {
17471    parseDomainResourceProperties(json, res);
17472    if (json.has("subject")) {
17473      JsonArray array = json.getAsJsonArray("subject");
17474      for (int i = 0; i < array.size(); i++) {
17475        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
17476      }
17477    };
17478    if (json.has("description"))
17479      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17480    if (json.has("_description"))
17481      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17482    if (json.has("interactant")) {
17483      JsonArray array = json.getAsJsonArray("interactant");
17484      for (int i = 0; i < array.size(); i++) {
17485        res.getInteractant().add(parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponent(array.get(i).getAsJsonObject(), res));
17486      }
17487    };
17488    if (json.has("type"))
17489      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17490    if (json.has("effect"))
17491      res.setEffect(parseCodeableConcept(json.getAsJsonObject("effect")));
17492    if (json.has("incidence"))
17493      res.setIncidence(parseCodeableConcept(json.getAsJsonObject("incidence")));
17494    if (json.has("management"))
17495      res.setManagement(parseCodeableConcept(json.getAsJsonObject("management")));
17496  }
17497
17498  protected MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponent(JsonObject json, MedicinalProductInteraction owner) throws IOException, FHIRFormatError {
17499    MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent res = new MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent();
17500    parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponentProperties(json, owner, res);
17501    return res;
17502  }
17503
17504  protected void parseMedicinalProductInteractionMedicinalProductInteractionInteractantComponentProperties(JsonObject json, MedicinalProductInteraction owner, MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent res) throws IOException, FHIRFormatError {
17505    parseBackboneElementProperties(json, res);
17506    Type item = parseType("item", json);
17507    if (item != null)
17508      res.setItem(item);
17509  }
17510
17511  protected MedicinalProductManufactured parseMedicinalProductManufactured(JsonObject json) throws IOException, FHIRFormatError {
17512    MedicinalProductManufactured res = new MedicinalProductManufactured();
17513    parseMedicinalProductManufacturedProperties(json, res);
17514    return res;
17515  }
17516
17517  protected void parseMedicinalProductManufacturedProperties(JsonObject json, MedicinalProductManufactured res) throws IOException, FHIRFormatError {
17518    parseDomainResourceProperties(json, res);
17519    if (json.has("manufacturedDoseForm"))
17520      res.setManufacturedDoseForm(parseCodeableConcept(json.getAsJsonObject("manufacturedDoseForm")));
17521    if (json.has("unitOfPresentation"))
17522      res.setUnitOfPresentation(parseCodeableConcept(json.getAsJsonObject("unitOfPresentation")));
17523    if (json.has("quantity"))
17524      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
17525    if (json.has("manufacturer")) {
17526      JsonArray array = json.getAsJsonArray("manufacturer");
17527      for (int i = 0; i < array.size(); i++) {
17528        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
17529      }
17530    };
17531    if (json.has("ingredient")) {
17532      JsonArray array = json.getAsJsonArray("ingredient");
17533      for (int i = 0; i < array.size(); i++) {
17534        res.getIngredient().add(parseReference(array.get(i).getAsJsonObject()));
17535      }
17536    };
17537    if (json.has("physicalCharacteristics"))
17538      res.setPhysicalCharacteristics(parseProdCharacteristic(json.getAsJsonObject("physicalCharacteristics")));
17539    if (json.has("otherCharacteristics")) {
17540      JsonArray array = json.getAsJsonArray("otherCharacteristics");
17541      for (int i = 0; i < array.size(); i++) {
17542        res.getOtherCharacteristics().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17543      }
17544    };
17545  }
17546
17547  protected MedicinalProductPackaged parseMedicinalProductPackaged(JsonObject json) throws IOException, FHIRFormatError {
17548    MedicinalProductPackaged res = new MedicinalProductPackaged();
17549    parseMedicinalProductPackagedProperties(json, res);
17550    return res;
17551  }
17552
17553  protected void parseMedicinalProductPackagedProperties(JsonObject json, MedicinalProductPackaged res) throws IOException, FHIRFormatError {
17554    parseDomainResourceProperties(json, res);
17555    if (json.has("identifier")) {
17556      JsonArray array = json.getAsJsonArray("identifier");
17557      for (int i = 0; i < array.size(); i++) {
17558        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17559      }
17560    };
17561    if (json.has("subject")) {
17562      JsonArray array = json.getAsJsonArray("subject");
17563      for (int i = 0; i < array.size(); i++) {
17564        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
17565      }
17566    };
17567    if (json.has("description"))
17568      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17569    if (json.has("_description"))
17570      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17571    if (json.has("legalStatusOfSupply"))
17572      res.setLegalStatusOfSupply(parseCodeableConcept(json.getAsJsonObject("legalStatusOfSupply")));
17573    if (json.has("marketingStatus")) {
17574      JsonArray array = json.getAsJsonArray("marketingStatus");
17575      for (int i = 0; i < array.size(); i++) {
17576        res.getMarketingStatus().add(parseMarketingStatus(array.get(i).getAsJsonObject()));
17577      }
17578    };
17579    if (json.has("marketingAuthorization"))
17580      res.setMarketingAuthorization(parseReference(json.getAsJsonObject("marketingAuthorization")));
17581    if (json.has("manufacturer")) {
17582      JsonArray array = json.getAsJsonArray("manufacturer");
17583      for (int i = 0; i < array.size(); i++) {
17584        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
17585      }
17586    };
17587    if (json.has("batchIdentifier")) {
17588      JsonArray array = json.getAsJsonArray("batchIdentifier");
17589      for (int i = 0; i < array.size(); i++) {
17590        res.getBatchIdentifier().add(parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(array.get(i).getAsJsonObject(), res));
17591      }
17592    };
17593    if (json.has("packageItem")) {
17594      JsonArray array = json.getAsJsonArray("packageItem");
17595      for (int i = 0; i < array.size(); i++) {
17596        res.getPackageItem().add(parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(array.get(i).getAsJsonObject(), res));
17597      }
17598    };
17599  }
17600
17601  protected MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(JsonObject json, MedicinalProductPackaged owner) throws IOException, FHIRFormatError {
17602    MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent res = new MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent();
17603    parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentProperties(json, owner, res);
17604    return res;
17605  }
17606
17607  protected void parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentProperties(JsonObject json, MedicinalProductPackaged owner, MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent res) throws IOException, FHIRFormatError {
17608    parseBackboneElementProperties(json, res);
17609    if (json.has("outerPackaging"))
17610      res.setOuterPackaging(parseIdentifier(json.getAsJsonObject("outerPackaging")));
17611    if (json.has("immediatePackaging"))
17612      res.setImmediatePackaging(parseIdentifier(json.getAsJsonObject("immediatePackaging")));
17613  }
17614
17615  protected MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(JsonObject json, MedicinalProductPackaged owner) throws IOException, FHIRFormatError {
17616    MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent res = new MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent();
17617    parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentProperties(json, owner, res);
17618    return res;
17619  }
17620
17621  protected void parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentProperties(JsonObject json, MedicinalProductPackaged owner, MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent res) throws IOException, FHIRFormatError {
17622    parseBackboneElementProperties(json, res);
17623    if (json.has("identifier")) {
17624      JsonArray array = json.getAsJsonArray("identifier");
17625      for (int i = 0; i < array.size(); i++) {
17626        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17627      }
17628    };
17629    if (json.has("type"))
17630      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17631    if (json.has("quantity"))
17632      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
17633    if (json.has("material")) {
17634      JsonArray array = json.getAsJsonArray("material");
17635      for (int i = 0; i < array.size(); i++) {
17636        res.getMaterial().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17637      }
17638    };
17639    if (json.has("alternateMaterial")) {
17640      JsonArray array = json.getAsJsonArray("alternateMaterial");
17641      for (int i = 0; i < array.size(); i++) {
17642        res.getAlternateMaterial().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17643      }
17644    };
17645    if (json.has("device")) {
17646      JsonArray array = json.getAsJsonArray("device");
17647      for (int i = 0; i < array.size(); i++) {
17648        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
17649      }
17650    };
17651    if (json.has("manufacturedItem")) {
17652      JsonArray array = json.getAsJsonArray("manufacturedItem");
17653      for (int i = 0; i < array.size(); i++) {
17654        res.getManufacturedItem().add(parseReference(array.get(i).getAsJsonObject()));
17655      }
17656    };
17657    if (json.has("packageItem")) {
17658      JsonArray array = json.getAsJsonArray("packageItem");
17659      for (int i = 0; i < array.size(); i++) {
17660        res.getPackageItem().add(parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(array.get(i).getAsJsonObject(), owner));
17661      }
17662    };
17663    if (json.has("physicalCharacteristics"))
17664      res.setPhysicalCharacteristics(parseProdCharacteristic(json.getAsJsonObject("physicalCharacteristics")));
17665    if (json.has("otherCharacteristics")) {
17666      JsonArray array = json.getAsJsonArray("otherCharacteristics");
17667      for (int i = 0; i < array.size(); i++) {
17668        res.getOtherCharacteristics().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17669      }
17670    };
17671    if (json.has("shelfLifeStorage")) {
17672      JsonArray array = json.getAsJsonArray("shelfLifeStorage");
17673      for (int i = 0; i < array.size(); i++) {
17674        res.getShelfLifeStorage().add(parseProductShelfLife(array.get(i).getAsJsonObject()));
17675      }
17676    };
17677    if (json.has("manufacturer")) {
17678      JsonArray array = json.getAsJsonArray("manufacturer");
17679      for (int i = 0; i < array.size(); i++) {
17680        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
17681      }
17682    };
17683  }
17684
17685  protected MedicinalProductPharmaceutical parseMedicinalProductPharmaceutical(JsonObject json) throws IOException, FHIRFormatError {
17686    MedicinalProductPharmaceutical res = new MedicinalProductPharmaceutical();
17687    parseMedicinalProductPharmaceuticalProperties(json, res);
17688    return res;
17689  }
17690
17691  protected void parseMedicinalProductPharmaceuticalProperties(JsonObject json, MedicinalProductPharmaceutical res) throws IOException, FHIRFormatError {
17692    parseDomainResourceProperties(json, res);
17693    if (json.has("identifier")) {
17694      JsonArray array = json.getAsJsonArray("identifier");
17695      for (int i = 0; i < array.size(); i++) {
17696        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17697      }
17698    };
17699    if (json.has("administrableDoseForm"))
17700      res.setAdministrableDoseForm(parseCodeableConcept(json.getAsJsonObject("administrableDoseForm")));
17701    if (json.has("unitOfPresentation"))
17702      res.setUnitOfPresentation(parseCodeableConcept(json.getAsJsonObject("unitOfPresentation")));
17703    if (json.has("ingredient")) {
17704      JsonArray array = json.getAsJsonArray("ingredient");
17705      for (int i = 0; i < array.size(); i++) {
17706        res.getIngredient().add(parseReference(array.get(i).getAsJsonObject()));
17707      }
17708    };
17709    if (json.has("device")) {
17710      JsonArray array = json.getAsJsonArray("device");
17711      for (int i = 0; i < array.size(); i++) {
17712        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
17713      }
17714    };
17715    if (json.has("characteristics")) {
17716      JsonArray array = json.getAsJsonArray("characteristics");
17717      for (int i = 0; i < array.size(); i++) {
17718        res.getCharacteristics().add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(array.get(i).getAsJsonObject(), res));
17719      }
17720    };
17721    if (json.has("routeOfAdministration")) {
17722      JsonArray array = json.getAsJsonArray("routeOfAdministration");
17723      for (int i = 0; i < array.size(); i++) {
17724        res.getRouteOfAdministration().add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(array.get(i).getAsJsonObject(), res));
17725      }
17726    };
17727  }
17728
17729  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
17730    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent();
17731    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentProperties(json, owner, res);
17732    return res;
17733  }
17734
17735  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentProperties(JsonObject json, MedicinalProductPharmaceutical owner, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent res) throws IOException, FHIRFormatError {
17736    parseBackboneElementProperties(json, res);
17737    if (json.has("code"))
17738      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17739    if (json.has("status"))
17740      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
17741  }
17742
17743  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
17744    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent();
17745    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentProperties(json, owner, res);
17746    return res;
17747  }
17748
17749  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentProperties(JsonObject json, MedicinalProductPharmaceutical owner, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent res) throws IOException, FHIRFormatError {
17750    parseBackboneElementProperties(json, res);
17751    if (json.has("code"))
17752      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17753    if (json.has("firstDose"))
17754      res.setFirstDose(parseQuantity(json.getAsJsonObject("firstDose")));
17755    if (json.has("maxSingleDose"))
17756      res.setMaxSingleDose(parseQuantity(json.getAsJsonObject("maxSingleDose")));
17757    if (json.has("maxDosePerDay"))
17758      res.setMaxDosePerDay(parseQuantity(json.getAsJsonObject("maxDosePerDay")));
17759    if (json.has("maxDosePerTreatmentPeriod"))
17760      res.setMaxDosePerTreatmentPeriod(parseRatio(json.getAsJsonObject("maxDosePerTreatmentPeriod")));
17761    if (json.has("maxTreatmentPeriod"))
17762      res.setMaxTreatmentPeriod(parseDuration(json.getAsJsonObject("maxTreatmentPeriod")));
17763    if (json.has("targetSpecies")) {
17764      JsonArray array = json.getAsJsonArray("targetSpecies");
17765      for (int i = 0; i < array.size(); i++) {
17766        res.getTargetSpecies().add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(array.get(i).getAsJsonObject(), owner));
17767      }
17768    };
17769  }
17770
17771  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
17772    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent();
17773    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentProperties(json, owner, res);
17774    return res;
17775  }
17776
17777  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentProperties(JsonObject json, MedicinalProductPharmaceutical owner, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent res) throws IOException, FHIRFormatError {
17778    parseBackboneElementProperties(json, res);
17779    if (json.has("code"))
17780      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17781    if (json.has("withdrawalPeriod")) {
17782      JsonArray array = json.getAsJsonArray("withdrawalPeriod");
17783      for (int i = 0; i < array.size(); i++) {
17784        res.getWithdrawalPeriod().add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(array.get(i).getAsJsonObject(), owner));
17785      }
17786    };
17787  }
17788
17789  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
17790    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent();
17791    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(json, owner, res);
17792    return res;
17793  }
17794
17795  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(JsonObject json, MedicinalProductPharmaceutical owner, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res) throws IOException, FHIRFormatError {
17796    parseBackboneElementProperties(json, res);
17797    if (json.has("tissue"))
17798      res.setTissue(parseCodeableConcept(json.getAsJsonObject("tissue")));
17799    if (json.has("value"))
17800      res.setValue(parseQuantity(json.getAsJsonObject("value")));
17801    if (json.has("supportingInformation"))
17802      res.setSupportingInformationElement(parseString(json.get("supportingInformation").getAsString()));
17803    if (json.has("_supportingInformation"))
17804      parseElementProperties(json.getAsJsonObject("_supportingInformation"), res.getSupportingInformationElement());
17805  }
17806
17807  protected MedicinalProductUndesirableEffect parseMedicinalProductUndesirableEffect(JsonObject json) throws IOException, FHIRFormatError {
17808    MedicinalProductUndesirableEffect res = new MedicinalProductUndesirableEffect();
17809    parseMedicinalProductUndesirableEffectProperties(json, res);
17810    return res;
17811  }
17812
17813  protected void parseMedicinalProductUndesirableEffectProperties(JsonObject json, MedicinalProductUndesirableEffect res) throws IOException, FHIRFormatError {
17814    parseDomainResourceProperties(json, res);
17815    if (json.has("subject")) {
17816      JsonArray array = json.getAsJsonArray("subject");
17817      for (int i = 0; i < array.size(); i++) {
17818        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
17819      }
17820    };
17821    if (json.has("symptomConditionEffect"))
17822      res.setSymptomConditionEffect(parseCodeableConcept(json.getAsJsonObject("symptomConditionEffect")));
17823    if (json.has("classification"))
17824      res.setClassification(parseCodeableConcept(json.getAsJsonObject("classification")));
17825    if (json.has("frequencyOfOccurrence"))
17826      res.setFrequencyOfOccurrence(parseCodeableConcept(json.getAsJsonObject("frequencyOfOccurrence")));
17827    if (json.has("population")) {
17828      JsonArray array = json.getAsJsonArray("population");
17829      for (int i = 0; i < array.size(); i++) {
17830        res.getPopulation().add(parsePopulation(array.get(i).getAsJsonObject()));
17831      }
17832    };
17833  }
17834
17835  protected MessageDefinition parseMessageDefinition(JsonObject json) throws IOException, FHIRFormatError {
17836    MessageDefinition res = new MessageDefinition();
17837    parseMessageDefinitionProperties(json, res);
17838    return res;
17839  }
17840
17841  protected void parseMessageDefinitionProperties(JsonObject json, MessageDefinition res) throws IOException, FHIRFormatError {
17842    parseDomainResourceProperties(json, res);
17843    if (json.has("url"))
17844      res.setUrlElement(parseUri(json.get("url").getAsString()));
17845    if (json.has("_url"))
17846      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
17847    if (json.has("identifier")) {
17848      JsonArray array = json.getAsJsonArray("identifier");
17849      for (int i = 0; i < array.size(); i++) {
17850        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17851      }
17852    };
17853    if (json.has("version"))
17854      res.setVersionElement(parseString(json.get("version").getAsString()));
17855    if (json.has("_version"))
17856      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
17857    if (json.has("name"))
17858      res.setNameElement(parseString(json.get("name").getAsString()));
17859    if (json.has("_name"))
17860      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
17861    if (json.has("title"))
17862      res.setTitleElement(parseString(json.get("title").getAsString()));
17863    if (json.has("_title"))
17864      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
17865    if (json.has("replaces")) {
17866      JsonArray array = json.getAsJsonArray("replaces");
17867      for (int i = 0; i < array.size(); i++) {
17868        res.getReplaces().add(parseCanonical(array.get(i).getAsString()));
17869      }
17870    };
17871    if (json.has("_replaces")) {
17872      JsonArray array = json.getAsJsonArray("_replaces");
17873      for (int i = 0; i < array.size(); i++) {
17874        if (i == res.getReplaces().size())
17875          res.getReplaces().add(parseCanonical(null));
17876        if (array.get(i) instanceof JsonObject) 
17877          parseElementProperties(array.get(i).getAsJsonObject(), res.getReplaces().get(i));
17878      }
17879    };
17880    if (json.has("status"))
17881      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
17882    if (json.has("_status"))
17883      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17884    if (json.has("experimental"))
17885      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
17886    if (json.has("_experimental"))
17887      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
17888    if (json.has("date"))
17889      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17890    if (json.has("_date"))
17891      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
17892    if (json.has("publisher"))
17893      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
17894    if (json.has("_publisher"))
17895      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
17896    if (json.has("contact")) {
17897      JsonArray array = json.getAsJsonArray("contact");
17898      for (int i = 0; i < array.size(); i++) {
17899        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
17900      }
17901    };
17902    if (json.has("description"))
17903      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
17904    if (json.has("_description"))
17905      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17906    if (json.has("useContext")) {
17907      JsonArray array = json.getAsJsonArray("useContext");
17908      for (int i = 0; i < array.size(); i++) {
17909        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
17910      }
17911    };
17912    if (json.has("jurisdiction")) {
17913      JsonArray array = json.getAsJsonArray("jurisdiction");
17914      for (int i = 0; i < array.size(); i++) {
17915        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17916      }
17917    };
17918    if (json.has("purpose"))
17919      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
17920    if (json.has("_purpose"))
17921      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
17922    if (json.has("copyright"))
17923      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
17924    if (json.has("_copyright"))
17925      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
17926    if (json.has("base"))
17927      res.setBaseElement(parseCanonical(json.get("base").getAsString()));
17928    if (json.has("_base"))
17929      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
17930    if (json.has("parent")) {
17931      JsonArray array = json.getAsJsonArray("parent");
17932      for (int i = 0; i < array.size(); i++) {
17933        res.getParent().add(parseCanonical(array.get(i).getAsString()));
17934      }
17935    };
17936    if (json.has("_parent")) {
17937      JsonArray array = json.getAsJsonArray("_parent");
17938      for (int i = 0; i < array.size(); i++) {
17939        if (i == res.getParent().size())
17940          res.getParent().add(parseCanonical(null));
17941        if (array.get(i) instanceof JsonObject) 
17942          parseElementProperties(array.get(i).getAsJsonObject(), res.getParent().get(i));
17943      }
17944    };
17945    Type event = parseType("event", json);
17946    if (event != null)
17947      res.setEvent(event);
17948    if (json.has("category"))
17949      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), MessageDefinition.MessageSignificanceCategory.NULL, new MessageDefinition.MessageSignificanceCategoryEnumFactory()));
17950    if (json.has("_category"))
17951      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
17952    if (json.has("focus")) {
17953      JsonArray array = json.getAsJsonArray("focus");
17954      for (int i = 0; i < array.size(); i++) {
17955        res.getFocus().add(parseMessageDefinitionMessageDefinitionFocusComponent(array.get(i).getAsJsonObject(), res));
17956      }
17957    };
17958    if (json.has("responseRequired"))
17959      res.setResponseRequiredElement(parseEnumeration(json.get("responseRequired").getAsString(), MessageDefinition.MessageheaderResponseRequest.NULL, new MessageDefinition.MessageheaderResponseRequestEnumFactory()));
17960    if (json.has("_responseRequired"))
17961      parseElementProperties(json.getAsJsonObject("_responseRequired"), res.getResponseRequiredElement());
17962    if (json.has("allowedResponse")) {
17963      JsonArray array = json.getAsJsonArray("allowedResponse");
17964      for (int i = 0; i < array.size(); i++) {
17965        res.getAllowedResponse().add(parseMessageDefinitionMessageDefinitionAllowedResponseComponent(array.get(i).getAsJsonObject(), res));
17966      }
17967    };
17968    if (json.has("graph")) {
17969      JsonArray array = json.getAsJsonArray("graph");
17970      for (int i = 0; i < array.size(); i++) {
17971        res.getGraph().add(parseCanonical(array.get(i).getAsString()));
17972      }
17973    };
17974    if (json.has("_graph")) {
17975      JsonArray array = json.getAsJsonArray("_graph");
17976      for (int i = 0; i < array.size(); i++) {
17977        if (i == res.getGraph().size())
17978          res.getGraph().add(parseCanonical(null));
17979        if (array.get(i) instanceof JsonObject) 
17980          parseElementProperties(array.get(i).getAsJsonObject(), res.getGraph().get(i));
17981      }
17982    };
17983  }
17984
17985  protected MessageDefinition.MessageDefinitionFocusComponent parseMessageDefinitionMessageDefinitionFocusComponent(JsonObject json, MessageDefinition owner) throws IOException, FHIRFormatError {
17986    MessageDefinition.MessageDefinitionFocusComponent res = new MessageDefinition.MessageDefinitionFocusComponent();
17987    parseMessageDefinitionMessageDefinitionFocusComponentProperties(json, owner, res);
17988    return res;
17989  }
17990
17991  protected void parseMessageDefinitionMessageDefinitionFocusComponentProperties(JsonObject json, MessageDefinition owner, MessageDefinition.MessageDefinitionFocusComponent res) throws IOException, FHIRFormatError {
17992    parseBackboneElementProperties(json, res);
17993    if (json.has("code"))
17994      res.setCodeElement(parseCode(json.get("code").getAsString()));
17995    if (json.has("_code"))
17996      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
17997    if (json.has("profile"))
17998      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
17999    if (json.has("_profile"))
18000      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
18001    if (json.has("min"))
18002      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
18003    if (json.has("_min"))
18004      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
18005    if (json.has("max"))
18006      res.setMaxElement(parseString(json.get("max").getAsString()));
18007    if (json.has("_max"))
18008      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
18009  }
18010
18011  protected MessageDefinition.MessageDefinitionAllowedResponseComponent parseMessageDefinitionMessageDefinitionAllowedResponseComponent(JsonObject json, MessageDefinition owner) throws IOException, FHIRFormatError {
18012    MessageDefinition.MessageDefinitionAllowedResponseComponent res = new MessageDefinition.MessageDefinitionAllowedResponseComponent();
18013    parseMessageDefinitionMessageDefinitionAllowedResponseComponentProperties(json, owner, res);
18014    return res;
18015  }
18016
18017  protected void parseMessageDefinitionMessageDefinitionAllowedResponseComponentProperties(JsonObject json, MessageDefinition owner, MessageDefinition.MessageDefinitionAllowedResponseComponent res) throws IOException, FHIRFormatError {
18018    parseBackboneElementProperties(json, res);
18019    if (json.has("message"))
18020      res.setMessageElement(parseCanonical(json.get("message").getAsString()));
18021    if (json.has("_message"))
18022      parseElementProperties(json.getAsJsonObject("_message"), res.getMessageElement());
18023    if (json.has("situation"))
18024      res.setSituationElement(parseMarkdown(json.get("situation").getAsString()));
18025    if (json.has("_situation"))
18026      parseElementProperties(json.getAsJsonObject("_situation"), res.getSituationElement());
18027  }
18028
18029  protected MessageHeader parseMessageHeader(JsonObject json) throws IOException, FHIRFormatError {
18030    MessageHeader res = new MessageHeader();
18031    parseMessageHeaderProperties(json, res);
18032    return res;
18033  }
18034
18035  protected void parseMessageHeaderProperties(JsonObject json, MessageHeader res) throws IOException, FHIRFormatError {
18036    parseDomainResourceProperties(json, res);
18037    Type event = parseType("event", json);
18038    if (event != null)
18039      res.setEvent(event);
18040    if (json.has("destination")) {
18041      JsonArray array = json.getAsJsonArray("destination");
18042      for (int i = 0; i < array.size(); i++) {
18043        res.getDestination().add(parseMessageHeaderMessageDestinationComponent(array.get(i).getAsJsonObject(), res));
18044      }
18045    };
18046    if (json.has("sender"))
18047      res.setSender(parseReference(json.getAsJsonObject("sender")));
18048    if (json.has("enterer"))
18049      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
18050    if (json.has("author"))
18051      res.setAuthor(parseReference(json.getAsJsonObject("author")));
18052    if (json.has("source"))
18053      res.setSource(parseMessageHeaderMessageSourceComponent(json.getAsJsonObject("source"), res));
18054    if (json.has("responsible"))
18055      res.setResponsible(parseReference(json.getAsJsonObject("responsible")));
18056    if (json.has("reason"))
18057      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
18058    if (json.has("response"))
18059      res.setResponse(parseMessageHeaderMessageHeaderResponseComponent(json.getAsJsonObject("response"), res));
18060    if (json.has("focus")) {
18061      JsonArray array = json.getAsJsonArray("focus");
18062      for (int i = 0; i < array.size(); i++) {
18063        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
18064      }
18065    };
18066    if (json.has("definition"))
18067      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
18068    if (json.has("_definition"))
18069      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
18070  }
18071
18072  protected MessageHeader.MessageDestinationComponent parseMessageHeaderMessageDestinationComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
18073    MessageHeader.MessageDestinationComponent res = new MessageHeader.MessageDestinationComponent();
18074    parseMessageHeaderMessageDestinationComponentProperties(json, owner, res);
18075    return res;
18076  }
18077
18078  protected void parseMessageHeaderMessageDestinationComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageDestinationComponent res) throws IOException, FHIRFormatError {
18079    parseBackboneElementProperties(json, res);
18080    if (json.has("name"))
18081      res.setNameElement(parseString(json.get("name").getAsString()));
18082    if (json.has("_name"))
18083      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18084    if (json.has("target"))
18085      res.setTarget(parseReference(json.getAsJsonObject("target")));
18086    if (json.has("endpoint"))
18087      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
18088    if (json.has("_endpoint"))
18089      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
18090    if (json.has("receiver"))
18091      res.setReceiver(parseReference(json.getAsJsonObject("receiver")));
18092  }
18093
18094  protected MessageHeader.MessageSourceComponent parseMessageHeaderMessageSourceComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
18095    MessageHeader.MessageSourceComponent res = new MessageHeader.MessageSourceComponent();
18096    parseMessageHeaderMessageSourceComponentProperties(json, owner, res);
18097    return res;
18098  }
18099
18100  protected void parseMessageHeaderMessageSourceComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageSourceComponent res) throws IOException, FHIRFormatError {
18101    parseBackboneElementProperties(json, res);
18102    if (json.has("name"))
18103      res.setNameElement(parseString(json.get("name").getAsString()));
18104    if (json.has("_name"))
18105      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18106    if (json.has("software"))
18107      res.setSoftwareElement(parseString(json.get("software").getAsString()));
18108    if (json.has("_software"))
18109      parseElementProperties(json.getAsJsonObject("_software"), res.getSoftwareElement());
18110    if (json.has("version"))
18111      res.setVersionElement(parseString(json.get("version").getAsString()));
18112    if (json.has("_version"))
18113      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
18114    if (json.has("contact"))
18115      res.setContact(parseContactPoint(json.getAsJsonObject("contact")));
18116    if (json.has("endpoint"))
18117      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
18118    if (json.has("_endpoint"))
18119      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
18120  }
18121
18122  protected MessageHeader.MessageHeaderResponseComponent parseMessageHeaderMessageHeaderResponseComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
18123    MessageHeader.MessageHeaderResponseComponent res = new MessageHeader.MessageHeaderResponseComponent();
18124    parseMessageHeaderMessageHeaderResponseComponentProperties(json, owner, res);
18125    return res;
18126  }
18127
18128  protected void parseMessageHeaderMessageHeaderResponseComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageHeaderResponseComponent res) throws IOException, FHIRFormatError {
18129    parseBackboneElementProperties(json, res);
18130    if (json.has("identifier"))
18131      res.setIdentifierElement(parseId(json.get("identifier").getAsString()));
18132    if (json.has("_identifier"))
18133      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
18134    if (json.has("code"))
18135      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), MessageHeader.ResponseType.NULL, new MessageHeader.ResponseTypeEnumFactory()));
18136    if (json.has("_code"))
18137      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
18138    if (json.has("details"))
18139      res.setDetails(parseReference(json.getAsJsonObject("details")));
18140  }
18141
18142  protected MolecularSequence parseMolecularSequence(JsonObject json) throws IOException, FHIRFormatError {
18143    MolecularSequence res = new MolecularSequence();
18144    parseMolecularSequenceProperties(json, res);
18145    return res;
18146  }
18147
18148  protected void parseMolecularSequenceProperties(JsonObject json, MolecularSequence res) throws IOException, FHIRFormatError {
18149    parseDomainResourceProperties(json, res);
18150    if (json.has("identifier")) {
18151      JsonArray array = json.getAsJsonArray("identifier");
18152      for (int i = 0; i < array.size(); i++) {
18153        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18154      }
18155    };
18156    if (json.has("type"))
18157      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.SequenceType.NULL, new MolecularSequence.SequenceTypeEnumFactory()));
18158    if (json.has("_type"))
18159      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
18160    if (json.has("coordinateSystem"))
18161      res.setCoordinateSystemElement(parseInteger(json.get("coordinateSystem").getAsLong()));
18162    if (json.has("_coordinateSystem"))
18163      parseElementProperties(json.getAsJsonObject("_coordinateSystem"), res.getCoordinateSystemElement());
18164    if (json.has("patient"))
18165      res.setPatient(parseReference(json.getAsJsonObject("patient")));
18166    if (json.has("specimen"))
18167      res.setSpecimen(parseReference(json.getAsJsonObject("specimen")));
18168    if (json.has("device"))
18169      res.setDevice(parseReference(json.getAsJsonObject("device")));
18170    if (json.has("performer"))
18171      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
18172    if (json.has("quantity"))
18173      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
18174    if (json.has("referenceSeq"))
18175      res.setReferenceSeq(parseMolecularSequenceMolecularSequenceReferenceSeqComponent(json.getAsJsonObject("referenceSeq"), res));
18176    if (json.has("variant")) {
18177      JsonArray array = json.getAsJsonArray("variant");
18178      for (int i = 0; i < array.size(); i++) {
18179        res.getVariant().add(parseMolecularSequenceMolecularSequenceVariantComponent(array.get(i).getAsJsonObject(), res));
18180      }
18181    };
18182    if (json.has("observedSeq"))
18183      res.setObservedSeqElement(parseString(json.get("observedSeq").getAsString()));
18184    if (json.has("_observedSeq"))
18185      parseElementProperties(json.getAsJsonObject("_observedSeq"), res.getObservedSeqElement());
18186    if (json.has("quality")) {
18187      JsonArray array = json.getAsJsonArray("quality");
18188      for (int i = 0; i < array.size(); i++) {
18189        res.getQuality().add(parseMolecularSequenceMolecularSequenceQualityComponent(array.get(i).getAsJsonObject(), res));
18190      }
18191    };
18192    if (json.has("readCoverage"))
18193      res.setReadCoverageElement(parseInteger(json.get("readCoverage").getAsLong()));
18194    if (json.has("_readCoverage"))
18195      parseElementProperties(json.getAsJsonObject("_readCoverage"), res.getReadCoverageElement());
18196    if (json.has("repository")) {
18197      JsonArray array = json.getAsJsonArray("repository");
18198      for (int i = 0; i < array.size(); i++) {
18199        res.getRepository().add(parseMolecularSequenceMolecularSequenceRepositoryComponent(array.get(i).getAsJsonObject(), res));
18200      }
18201    };
18202    if (json.has("pointer")) {
18203      JsonArray array = json.getAsJsonArray("pointer");
18204      for (int i = 0; i < array.size(); i++) {
18205        res.getPointer().add(parseReference(array.get(i).getAsJsonObject()));
18206      }
18207    };
18208    if (json.has("structureVariant")) {
18209      JsonArray array = json.getAsJsonArray("structureVariant");
18210      for (int i = 0; i < array.size(); i++) {
18211        res.getStructureVariant().add(parseMolecularSequenceMolecularSequenceStructureVariantComponent(array.get(i).getAsJsonObject(), res));
18212      }
18213    };
18214  }
18215
18216  protected MolecularSequence.MolecularSequenceReferenceSeqComponent parseMolecularSequenceMolecularSequenceReferenceSeqComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18217    MolecularSequence.MolecularSequenceReferenceSeqComponent res = new MolecularSequence.MolecularSequenceReferenceSeqComponent();
18218    parseMolecularSequenceMolecularSequenceReferenceSeqComponentProperties(json, owner, res);
18219    return res;
18220  }
18221
18222  protected void parseMolecularSequenceMolecularSequenceReferenceSeqComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceReferenceSeqComponent res) throws IOException, FHIRFormatError {
18223    parseBackboneElementProperties(json, res);
18224    if (json.has("chromosome"))
18225      res.setChromosome(parseCodeableConcept(json.getAsJsonObject("chromosome")));
18226    if (json.has("genomeBuild"))
18227      res.setGenomeBuildElement(parseString(json.get("genomeBuild").getAsString()));
18228    if (json.has("_genomeBuild"))
18229      parseElementProperties(json.getAsJsonObject("_genomeBuild"), res.getGenomeBuildElement());
18230    if (json.has("orientation"))
18231      res.setOrientationElement(parseEnumeration(json.get("orientation").getAsString(), MolecularSequence.OrientationType.NULL, new MolecularSequence.OrientationTypeEnumFactory()));
18232    if (json.has("_orientation"))
18233      parseElementProperties(json.getAsJsonObject("_orientation"), res.getOrientationElement());
18234    if (json.has("referenceSeqId"))
18235      res.setReferenceSeqId(parseCodeableConcept(json.getAsJsonObject("referenceSeqId")));
18236    if (json.has("referenceSeqPointer"))
18237      res.setReferenceSeqPointer(parseReference(json.getAsJsonObject("referenceSeqPointer")));
18238    if (json.has("referenceSeqString"))
18239      res.setReferenceSeqStringElement(parseString(json.get("referenceSeqString").getAsString()));
18240    if (json.has("_referenceSeqString"))
18241      parseElementProperties(json.getAsJsonObject("_referenceSeqString"), res.getReferenceSeqStringElement());
18242    if (json.has("strand"))
18243      res.setStrandElement(parseEnumeration(json.get("strand").getAsString(), MolecularSequence.StrandType.NULL, new MolecularSequence.StrandTypeEnumFactory()));
18244    if (json.has("_strand"))
18245      parseElementProperties(json.getAsJsonObject("_strand"), res.getStrandElement());
18246    if (json.has("windowStart"))
18247      res.setWindowStartElement(parseInteger(json.get("windowStart").getAsLong()));
18248    if (json.has("_windowStart"))
18249      parseElementProperties(json.getAsJsonObject("_windowStart"), res.getWindowStartElement());
18250    if (json.has("windowEnd"))
18251      res.setWindowEndElement(parseInteger(json.get("windowEnd").getAsLong()));
18252    if (json.has("_windowEnd"))
18253      parseElementProperties(json.getAsJsonObject("_windowEnd"), res.getWindowEndElement());
18254  }
18255
18256  protected MolecularSequence.MolecularSequenceVariantComponent parseMolecularSequenceMolecularSequenceVariantComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18257    MolecularSequence.MolecularSequenceVariantComponent res = new MolecularSequence.MolecularSequenceVariantComponent();
18258    parseMolecularSequenceMolecularSequenceVariantComponentProperties(json, owner, res);
18259    return res;
18260  }
18261
18262  protected void parseMolecularSequenceMolecularSequenceVariantComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceVariantComponent res) throws IOException, FHIRFormatError {
18263    parseBackboneElementProperties(json, res);
18264    if (json.has("start"))
18265      res.setStartElement(parseInteger(json.get("start").getAsLong()));
18266    if (json.has("_start"))
18267      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
18268    if (json.has("end"))
18269      res.setEndElement(parseInteger(json.get("end").getAsLong()));
18270    if (json.has("_end"))
18271      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
18272    if (json.has("observedAllele"))
18273      res.setObservedAlleleElement(parseString(json.get("observedAllele").getAsString()));
18274    if (json.has("_observedAllele"))
18275      parseElementProperties(json.getAsJsonObject("_observedAllele"), res.getObservedAlleleElement());
18276    if (json.has("referenceAllele"))
18277      res.setReferenceAlleleElement(parseString(json.get("referenceAllele").getAsString()));
18278    if (json.has("_referenceAllele"))
18279      parseElementProperties(json.getAsJsonObject("_referenceAllele"), res.getReferenceAlleleElement());
18280    if (json.has("cigar"))
18281      res.setCigarElement(parseString(json.get("cigar").getAsString()));
18282    if (json.has("_cigar"))
18283      parseElementProperties(json.getAsJsonObject("_cigar"), res.getCigarElement());
18284    if (json.has("variantPointer"))
18285      res.setVariantPointer(parseReference(json.getAsJsonObject("variantPointer")));
18286  }
18287
18288  protected MolecularSequence.MolecularSequenceQualityComponent parseMolecularSequenceMolecularSequenceQualityComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18289    MolecularSequence.MolecularSequenceQualityComponent res = new MolecularSequence.MolecularSequenceQualityComponent();
18290    parseMolecularSequenceMolecularSequenceQualityComponentProperties(json, owner, res);
18291    return res;
18292  }
18293
18294  protected void parseMolecularSequenceMolecularSequenceQualityComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceQualityComponent res) throws IOException, FHIRFormatError {
18295    parseBackboneElementProperties(json, res);
18296    if (json.has("type"))
18297      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.QualityType.NULL, new MolecularSequence.QualityTypeEnumFactory()));
18298    if (json.has("_type"))
18299      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
18300    if (json.has("standardSequence"))
18301      res.setStandardSequence(parseCodeableConcept(json.getAsJsonObject("standardSequence")));
18302    if (json.has("start"))
18303      res.setStartElement(parseInteger(json.get("start").getAsLong()));
18304    if (json.has("_start"))
18305      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
18306    if (json.has("end"))
18307      res.setEndElement(parseInteger(json.get("end").getAsLong()));
18308    if (json.has("_end"))
18309      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
18310    if (json.has("score"))
18311      res.setScore(parseQuantity(json.getAsJsonObject("score")));
18312    if (json.has("method"))
18313      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
18314    if (json.has("truthTP"))
18315      res.setTruthTPElement(parseDecimal(json.get("truthTP").getAsBigDecimal()));
18316    if (json.has("_truthTP"))
18317      parseElementProperties(json.getAsJsonObject("_truthTP"), res.getTruthTPElement());
18318    if (json.has("queryTP"))
18319      res.setQueryTPElement(parseDecimal(json.get("queryTP").getAsBigDecimal()));
18320    if (json.has("_queryTP"))
18321      parseElementProperties(json.getAsJsonObject("_queryTP"), res.getQueryTPElement());
18322    if (json.has("truthFN"))
18323      res.setTruthFNElement(parseDecimal(json.get("truthFN").getAsBigDecimal()));
18324    if (json.has("_truthFN"))
18325      parseElementProperties(json.getAsJsonObject("_truthFN"), res.getTruthFNElement());
18326    if (json.has("queryFP"))
18327      res.setQueryFPElement(parseDecimal(json.get("queryFP").getAsBigDecimal()));
18328    if (json.has("_queryFP"))
18329      parseElementProperties(json.getAsJsonObject("_queryFP"), res.getQueryFPElement());
18330    if (json.has("gtFP"))
18331      res.setGtFPElement(parseDecimal(json.get("gtFP").getAsBigDecimal()));
18332    if (json.has("_gtFP"))
18333      parseElementProperties(json.getAsJsonObject("_gtFP"), res.getGtFPElement());
18334    if (json.has("precision"))
18335      res.setPrecisionElement(parseDecimal(json.get("precision").getAsBigDecimal()));
18336    if (json.has("_precision"))
18337      parseElementProperties(json.getAsJsonObject("_precision"), res.getPrecisionElement());
18338    if (json.has("recall"))
18339      res.setRecallElement(parseDecimal(json.get("recall").getAsBigDecimal()));
18340    if (json.has("_recall"))
18341      parseElementProperties(json.getAsJsonObject("_recall"), res.getRecallElement());
18342    if (json.has("fScore"))
18343      res.setFScoreElement(parseDecimal(json.get("fScore").getAsBigDecimal()));
18344    if (json.has("_fScore"))
18345      parseElementProperties(json.getAsJsonObject("_fScore"), res.getFScoreElement());
18346    if (json.has("roc"))
18347      res.setRoc(parseMolecularSequenceMolecularSequenceQualityRocComponent(json.getAsJsonObject("roc"), owner));
18348  }
18349
18350  protected MolecularSequence.MolecularSequenceQualityRocComponent parseMolecularSequenceMolecularSequenceQualityRocComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18351    MolecularSequence.MolecularSequenceQualityRocComponent res = new MolecularSequence.MolecularSequenceQualityRocComponent();
18352    parseMolecularSequenceMolecularSequenceQualityRocComponentProperties(json, owner, res);
18353    return res;
18354  }
18355
18356  protected void parseMolecularSequenceMolecularSequenceQualityRocComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceQualityRocComponent res) throws IOException, FHIRFormatError {
18357    parseBackboneElementProperties(json, res);
18358    if (json.has("score")) {
18359      JsonArray array = json.getAsJsonArray("score");
18360      for (int i = 0; i < array.size(); i++) {
18361        res.getScore().add(parseInteger(array.get(i).getAsLong()));
18362      }
18363    };
18364    if (json.has("_score")) {
18365      JsonArray array = json.getAsJsonArray("_score");
18366      for (int i = 0; i < array.size(); i++) {
18367        if (i == res.getScore().size())
18368          res.getScore().add(parseInteger(null));
18369        if (array.get(i) instanceof JsonObject) 
18370          parseElementProperties(array.get(i).getAsJsonObject(), res.getScore().get(i));
18371      }
18372    };
18373    if (json.has("numTP")) {
18374      JsonArray array = json.getAsJsonArray("numTP");
18375      for (int i = 0; i < array.size(); i++) {
18376        res.getNumTP().add(parseInteger(array.get(i).getAsLong()));
18377      }
18378    };
18379    if (json.has("_numTP")) {
18380      JsonArray array = json.getAsJsonArray("_numTP");
18381      for (int i = 0; i < array.size(); i++) {
18382        if (i == res.getNumTP().size())
18383          res.getNumTP().add(parseInteger(null));
18384        if (array.get(i) instanceof JsonObject) 
18385          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumTP().get(i));
18386      }
18387    };
18388    if (json.has("numFP")) {
18389      JsonArray array = json.getAsJsonArray("numFP");
18390      for (int i = 0; i < array.size(); i++) {
18391        res.getNumFP().add(parseInteger(array.get(i).getAsLong()));
18392      }
18393    };
18394    if (json.has("_numFP")) {
18395      JsonArray array = json.getAsJsonArray("_numFP");
18396      for (int i = 0; i < array.size(); i++) {
18397        if (i == res.getNumFP().size())
18398          res.getNumFP().add(parseInteger(null));
18399        if (array.get(i) instanceof JsonObject) 
18400          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumFP().get(i));
18401      }
18402    };
18403    if (json.has("numFN")) {
18404      JsonArray array = json.getAsJsonArray("numFN");
18405      for (int i = 0; i < array.size(); i++) {
18406        res.getNumFN().add(parseInteger(array.get(i).getAsLong()));
18407      }
18408    };
18409    if (json.has("_numFN")) {
18410      JsonArray array = json.getAsJsonArray("_numFN");
18411      for (int i = 0; i < array.size(); i++) {
18412        if (i == res.getNumFN().size())
18413          res.getNumFN().add(parseInteger(null));
18414        if (array.get(i) instanceof JsonObject) 
18415          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumFN().get(i));
18416      }
18417    };
18418    if (json.has("precision")) {
18419      JsonArray array = json.getAsJsonArray("precision");
18420      for (int i = 0; i < array.size(); i++) {
18421        res.getPrecision().add(parseDecimal(array.get(i).getAsBigDecimal()));
18422      }
18423    };
18424    if (json.has("_precision")) {
18425      JsonArray array = json.getAsJsonArray("_precision");
18426      for (int i = 0; i < array.size(); i++) {
18427        if (i == res.getPrecision().size())
18428          res.getPrecision().add(parseDecimal(null));
18429        if (array.get(i) instanceof JsonObject) 
18430          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrecision().get(i));
18431      }
18432    };
18433    if (json.has("sensitivity")) {
18434      JsonArray array = json.getAsJsonArray("sensitivity");
18435      for (int i = 0; i < array.size(); i++) {
18436        res.getSensitivity().add(parseDecimal(array.get(i).getAsBigDecimal()));
18437      }
18438    };
18439    if (json.has("_sensitivity")) {
18440      JsonArray array = json.getAsJsonArray("_sensitivity");
18441      for (int i = 0; i < array.size(); i++) {
18442        if (i == res.getSensitivity().size())
18443          res.getSensitivity().add(parseDecimal(null));
18444        if (array.get(i) instanceof JsonObject) 
18445          parseElementProperties(array.get(i).getAsJsonObject(), res.getSensitivity().get(i));
18446      }
18447    };
18448    if (json.has("fMeasure")) {
18449      JsonArray array = json.getAsJsonArray("fMeasure");
18450      for (int i = 0; i < array.size(); i++) {
18451        res.getFMeasure().add(parseDecimal(array.get(i).getAsBigDecimal()));
18452      }
18453    };
18454    if (json.has("_fMeasure")) {
18455      JsonArray array = json.getAsJsonArray("_fMeasure");
18456      for (int i = 0; i < array.size(); i++) {
18457        if (i == res.getFMeasure().size())
18458          res.getFMeasure().add(parseDecimal(null));
18459        if (array.get(i) instanceof JsonObject) 
18460          parseElementProperties(array.get(i).getAsJsonObject(), res.getFMeasure().get(i));
18461      }
18462    };
18463  }
18464
18465  protected MolecularSequence.MolecularSequenceRepositoryComponent parseMolecularSequenceMolecularSequenceRepositoryComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18466    MolecularSequence.MolecularSequenceRepositoryComponent res = new MolecularSequence.MolecularSequenceRepositoryComponent();
18467    parseMolecularSequenceMolecularSequenceRepositoryComponentProperties(json, owner, res);
18468    return res;
18469  }
18470
18471  protected void parseMolecularSequenceMolecularSequenceRepositoryComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceRepositoryComponent res) throws IOException, FHIRFormatError {
18472    parseBackboneElementProperties(json, res);
18473    if (json.has("type"))
18474      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MolecularSequence.RepositoryType.NULL, new MolecularSequence.RepositoryTypeEnumFactory()));
18475    if (json.has("_type"))
18476      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
18477    if (json.has("url"))
18478      res.setUrlElement(parseUri(json.get("url").getAsString()));
18479    if (json.has("_url"))
18480      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
18481    if (json.has("name"))
18482      res.setNameElement(parseString(json.get("name").getAsString()));
18483    if (json.has("_name"))
18484      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18485    if (json.has("datasetId"))
18486      res.setDatasetIdElement(parseString(json.get("datasetId").getAsString()));
18487    if (json.has("_datasetId"))
18488      parseElementProperties(json.getAsJsonObject("_datasetId"), res.getDatasetIdElement());
18489    if (json.has("variantsetId"))
18490      res.setVariantsetIdElement(parseString(json.get("variantsetId").getAsString()));
18491    if (json.has("_variantsetId"))
18492      parseElementProperties(json.getAsJsonObject("_variantsetId"), res.getVariantsetIdElement());
18493    if (json.has("readsetId"))
18494      res.setReadsetIdElement(parseString(json.get("readsetId").getAsString()));
18495    if (json.has("_readsetId"))
18496      parseElementProperties(json.getAsJsonObject("_readsetId"), res.getReadsetIdElement());
18497  }
18498
18499  protected MolecularSequence.MolecularSequenceStructureVariantComponent parseMolecularSequenceMolecularSequenceStructureVariantComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18500    MolecularSequence.MolecularSequenceStructureVariantComponent res = new MolecularSequence.MolecularSequenceStructureVariantComponent();
18501    parseMolecularSequenceMolecularSequenceStructureVariantComponentProperties(json, owner, res);
18502    return res;
18503  }
18504
18505  protected void parseMolecularSequenceMolecularSequenceStructureVariantComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceStructureVariantComponent res) throws IOException, FHIRFormatError {
18506    parseBackboneElementProperties(json, res);
18507    if (json.has("variantType"))
18508      res.setVariantType(parseCodeableConcept(json.getAsJsonObject("variantType")));
18509    if (json.has("exact"))
18510      res.setExactElement(parseBoolean(json.get("exact").getAsBoolean()));
18511    if (json.has("_exact"))
18512      parseElementProperties(json.getAsJsonObject("_exact"), res.getExactElement());
18513    if (json.has("length"))
18514      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
18515    if (json.has("_length"))
18516      parseElementProperties(json.getAsJsonObject("_length"), res.getLengthElement());
18517    if (json.has("outer"))
18518      res.setOuter(parseMolecularSequenceMolecularSequenceStructureVariantOuterComponent(json.getAsJsonObject("outer"), owner));
18519    if (json.has("inner"))
18520      res.setInner(parseMolecularSequenceMolecularSequenceStructureVariantInnerComponent(json.getAsJsonObject("inner"), owner));
18521  }
18522
18523  protected MolecularSequence.MolecularSequenceStructureVariantOuterComponent parseMolecularSequenceMolecularSequenceStructureVariantOuterComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18524    MolecularSequence.MolecularSequenceStructureVariantOuterComponent res = new MolecularSequence.MolecularSequenceStructureVariantOuterComponent();
18525    parseMolecularSequenceMolecularSequenceStructureVariantOuterComponentProperties(json, owner, res);
18526    return res;
18527  }
18528
18529  protected void parseMolecularSequenceMolecularSequenceStructureVariantOuterComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceStructureVariantOuterComponent res) throws IOException, FHIRFormatError {
18530    parseBackboneElementProperties(json, res);
18531    if (json.has("start"))
18532      res.setStartElement(parseInteger(json.get("start").getAsLong()));
18533    if (json.has("_start"))
18534      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
18535    if (json.has("end"))
18536      res.setEndElement(parseInteger(json.get("end").getAsLong()));
18537    if (json.has("_end"))
18538      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
18539  }
18540
18541  protected MolecularSequence.MolecularSequenceStructureVariantInnerComponent parseMolecularSequenceMolecularSequenceStructureVariantInnerComponent(JsonObject json, MolecularSequence owner) throws IOException, FHIRFormatError {
18542    MolecularSequence.MolecularSequenceStructureVariantInnerComponent res = new MolecularSequence.MolecularSequenceStructureVariantInnerComponent();
18543    parseMolecularSequenceMolecularSequenceStructureVariantInnerComponentProperties(json, owner, res);
18544    return res;
18545  }
18546
18547  protected void parseMolecularSequenceMolecularSequenceStructureVariantInnerComponentProperties(JsonObject json, MolecularSequence owner, MolecularSequence.MolecularSequenceStructureVariantInnerComponent res) throws IOException, FHIRFormatError {
18548    parseBackboneElementProperties(json, res);
18549    if (json.has("start"))
18550      res.setStartElement(parseInteger(json.get("start").getAsLong()));
18551    if (json.has("_start"))
18552      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
18553    if (json.has("end"))
18554      res.setEndElement(parseInteger(json.get("end").getAsLong()));
18555    if (json.has("_end"))
18556      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
18557  }
18558
18559  protected NamingSystem parseNamingSystem(JsonObject json) throws IOException, FHIRFormatError {
18560    NamingSystem res = new NamingSystem();
18561    parseNamingSystemProperties(json, res);
18562    return res;
18563  }
18564
18565  protected void parseNamingSystemProperties(JsonObject json, NamingSystem res) throws IOException, FHIRFormatError {
18566    parseDomainResourceProperties(json, res);
18567    if (json.has("name"))
18568      res.setNameElement(parseString(json.get("name").getAsString()));
18569    if (json.has("_name"))
18570      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18571    if (json.has("status"))
18572      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
18573    if (json.has("_status"))
18574      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
18575    if (json.has("kind"))
18576      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), NamingSystem.NamingSystemType.NULL, new NamingSystem.NamingSystemTypeEnumFactory()));
18577    if (json.has("_kind"))
18578      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
18579    if (json.has("date"))
18580      res.setDateElement(parseDateTime(json.get("date").getAsString()));
18581    if (json.has("_date"))
18582      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
18583    if (json.has("publisher"))
18584      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
18585    if (json.has("_publisher"))
18586      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
18587    if (json.has("contact")) {
18588      JsonArray array = json.getAsJsonArray("contact");
18589      for (int i = 0; i < array.size(); i++) {
18590        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
18591      }
18592    };
18593    if (json.has("responsible"))
18594      res.setResponsibleElement(parseString(json.get("responsible").getAsString()));
18595    if (json.has("_responsible"))
18596      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
18597    if (json.has("type"))
18598      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18599    if (json.has("description"))
18600      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
18601    if (json.has("_description"))
18602      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18603    if (json.has("useContext")) {
18604      JsonArray array = json.getAsJsonArray("useContext");
18605      for (int i = 0; i < array.size(); i++) {
18606        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
18607      }
18608    };
18609    if (json.has("jurisdiction")) {
18610      JsonArray array = json.getAsJsonArray("jurisdiction");
18611      for (int i = 0; i < array.size(); i++) {
18612        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18613      }
18614    };
18615    if (json.has("usage"))
18616      res.setUsageElement(parseString(json.get("usage").getAsString()));
18617    if (json.has("_usage"))
18618      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
18619    if (json.has("uniqueId")) {
18620      JsonArray array = json.getAsJsonArray("uniqueId");
18621      for (int i = 0; i < array.size(); i++) {
18622        res.getUniqueId().add(parseNamingSystemNamingSystemUniqueIdComponent(array.get(i).getAsJsonObject(), res));
18623      }
18624    };
18625  }
18626
18627  protected NamingSystem.NamingSystemUniqueIdComponent parseNamingSystemNamingSystemUniqueIdComponent(JsonObject json, NamingSystem owner) throws IOException, FHIRFormatError {
18628    NamingSystem.NamingSystemUniqueIdComponent res = new NamingSystem.NamingSystemUniqueIdComponent();
18629    parseNamingSystemNamingSystemUniqueIdComponentProperties(json, owner, res);
18630    return res;
18631  }
18632
18633  protected void parseNamingSystemNamingSystemUniqueIdComponentProperties(JsonObject json, NamingSystem owner, NamingSystem.NamingSystemUniqueIdComponent res) throws IOException, FHIRFormatError {
18634    parseBackboneElementProperties(json, res);
18635    if (json.has("type"))
18636      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), NamingSystem.NamingSystemIdentifierType.NULL, new NamingSystem.NamingSystemIdentifierTypeEnumFactory()));
18637    if (json.has("_type"))
18638      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
18639    if (json.has("value"))
18640      res.setValueElement(parseString(json.get("value").getAsString()));
18641    if (json.has("_value"))
18642      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
18643    if (json.has("preferred"))
18644      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
18645    if (json.has("_preferred"))
18646      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
18647    if (json.has("comment"))
18648      res.setCommentElement(parseString(json.get("comment").getAsString()));
18649    if (json.has("_comment"))
18650      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
18651    if (json.has("period"))
18652      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
18653  }
18654
18655  protected NutritionOrder parseNutritionOrder(JsonObject json) throws IOException, FHIRFormatError {
18656    NutritionOrder res = new NutritionOrder();
18657    parseNutritionOrderProperties(json, res);
18658    return res;
18659  }
18660
18661  protected void parseNutritionOrderProperties(JsonObject json, NutritionOrder res) throws IOException, FHIRFormatError {
18662    parseDomainResourceProperties(json, res);
18663    if (json.has("identifier")) {
18664      JsonArray array = json.getAsJsonArray("identifier");
18665      for (int i = 0; i < array.size(); i++) {
18666        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18667      }
18668    };
18669    if (json.has("instantiatesCanonical")) {
18670      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
18671      for (int i = 0; i < array.size(); i++) {
18672        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
18673      }
18674    };
18675    if (json.has("_instantiatesCanonical")) {
18676      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
18677      for (int i = 0; i < array.size(); i++) {
18678        if (i == res.getInstantiatesCanonical().size())
18679          res.getInstantiatesCanonical().add(parseCanonical(null));
18680        if (array.get(i) instanceof JsonObject) 
18681          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
18682      }
18683    };
18684    if (json.has("instantiatesUri")) {
18685      JsonArray array = json.getAsJsonArray("instantiatesUri");
18686      for (int i = 0; i < array.size(); i++) {
18687        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
18688      }
18689    };
18690    if (json.has("_instantiatesUri")) {
18691      JsonArray array = json.getAsJsonArray("_instantiatesUri");
18692      for (int i = 0; i < array.size(); i++) {
18693        if (i == res.getInstantiatesUri().size())
18694          res.getInstantiatesUri().add(parseUri(null));
18695        if (array.get(i) instanceof JsonObject) 
18696          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
18697      }
18698    };
18699    if (json.has("instantiates")) {
18700      JsonArray array = json.getAsJsonArray("instantiates");
18701      for (int i = 0; i < array.size(); i++) {
18702        res.getInstantiates().add(parseUri(array.get(i).getAsString()));
18703      }
18704    };
18705    if (json.has("_instantiates")) {
18706      JsonArray array = json.getAsJsonArray("_instantiates");
18707      for (int i = 0; i < array.size(); i++) {
18708        if (i == res.getInstantiates().size())
18709          res.getInstantiates().add(parseUri(null));
18710        if (array.get(i) instanceof JsonObject) 
18711          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
18712      }
18713    };
18714    if (json.has("status"))
18715      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), NutritionOrder.NutritionOrderStatus.NULL, new NutritionOrder.NutritionOrderStatusEnumFactory()));
18716    if (json.has("_status"))
18717      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
18718    if (json.has("intent"))
18719      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), NutritionOrder.NutritiionOrderIntent.NULL, new NutritionOrder.NutritiionOrderIntentEnumFactory()));
18720    if (json.has("_intent"))
18721      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
18722    if (json.has("patient"))
18723      res.setPatient(parseReference(json.getAsJsonObject("patient")));
18724    if (json.has("encounter"))
18725      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
18726    if (json.has("dateTime"))
18727      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
18728    if (json.has("_dateTime"))
18729      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
18730    if (json.has("orderer"))
18731      res.setOrderer(parseReference(json.getAsJsonObject("orderer")));
18732    if (json.has("allergyIntolerance")) {
18733      JsonArray array = json.getAsJsonArray("allergyIntolerance");
18734      for (int i = 0; i < array.size(); i++) {
18735        res.getAllergyIntolerance().add(parseReference(array.get(i).getAsJsonObject()));
18736      }
18737    };
18738    if (json.has("foodPreferenceModifier")) {
18739      JsonArray array = json.getAsJsonArray("foodPreferenceModifier");
18740      for (int i = 0; i < array.size(); i++) {
18741        res.getFoodPreferenceModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18742      }
18743    };
18744    if (json.has("excludeFoodModifier")) {
18745      JsonArray array = json.getAsJsonArray("excludeFoodModifier");
18746      for (int i = 0; i < array.size(); i++) {
18747        res.getExcludeFoodModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18748      }
18749    };
18750    if (json.has("oralDiet"))
18751      res.setOralDiet(parseNutritionOrderNutritionOrderOralDietComponent(json.getAsJsonObject("oralDiet"), res));
18752    if (json.has("supplement")) {
18753      JsonArray array = json.getAsJsonArray("supplement");
18754      for (int i = 0; i < array.size(); i++) {
18755        res.getSupplement().add(parseNutritionOrderNutritionOrderSupplementComponent(array.get(i).getAsJsonObject(), res));
18756      }
18757    };
18758    if (json.has("enteralFormula"))
18759      res.setEnteralFormula(parseNutritionOrderNutritionOrderEnteralFormulaComponent(json.getAsJsonObject("enteralFormula"), res));
18760    if (json.has("note")) {
18761      JsonArray array = json.getAsJsonArray("note");
18762      for (int i = 0; i < array.size(); i++) {
18763        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
18764      }
18765    };
18766  }
18767
18768  protected NutritionOrder.NutritionOrderOralDietComponent parseNutritionOrderNutritionOrderOralDietComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
18769    NutritionOrder.NutritionOrderOralDietComponent res = new NutritionOrder.NutritionOrderOralDietComponent();
18770    parseNutritionOrderNutritionOrderOralDietComponentProperties(json, owner, res);
18771    return res;
18772  }
18773
18774  protected void parseNutritionOrderNutritionOrderOralDietComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietComponent res) throws IOException, FHIRFormatError {
18775    parseBackboneElementProperties(json, res);
18776    if (json.has("type")) {
18777      JsonArray array = json.getAsJsonArray("type");
18778      for (int i = 0; i < array.size(); i++) {
18779        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18780      }
18781    };
18782    if (json.has("schedule")) {
18783      JsonArray array = json.getAsJsonArray("schedule");
18784      for (int i = 0; i < array.size(); i++) {
18785        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
18786      }
18787    };
18788    if (json.has("nutrient")) {
18789      JsonArray array = json.getAsJsonArray("nutrient");
18790      for (int i = 0; i < array.size(); i++) {
18791        res.getNutrient().add(parseNutritionOrderNutritionOrderOralDietNutrientComponent(array.get(i).getAsJsonObject(), owner));
18792      }
18793    };
18794    if (json.has("texture")) {
18795      JsonArray array = json.getAsJsonArray("texture");
18796      for (int i = 0; i < array.size(); i++) {
18797        res.getTexture().add(parseNutritionOrderNutritionOrderOralDietTextureComponent(array.get(i).getAsJsonObject(), owner));
18798      }
18799    };
18800    if (json.has("fluidConsistencyType")) {
18801      JsonArray array = json.getAsJsonArray("fluidConsistencyType");
18802      for (int i = 0; i < array.size(); i++) {
18803        res.getFluidConsistencyType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18804      }
18805    };
18806    if (json.has("instruction"))
18807      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
18808    if (json.has("_instruction"))
18809      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
18810  }
18811
18812  protected NutritionOrder.NutritionOrderOralDietNutrientComponent parseNutritionOrderNutritionOrderOralDietNutrientComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
18813    NutritionOrder.NutritionOrderOralDietNutrientComponent res = new NutritionOrder.NutritionOrderOralDietNutrientComponent();
18814    parseNutritionOrderNutritionOrderOralDietNutrientComponentProperties(json, owner, res);
18815    return res;
18816  }
18817
18818  protected void parseNutritionOrderNutritionOrderOralDietNutrientComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietNutrientComponent res) throws IOException, FHIRFormatError {
18819    parseBackboneElementProperties(json, res);
18820    if (json.has("modifier"))
18821      res.setModifier(parseCodeableConcept(json.getAsJsonObject("modifier")));
18822    if (json.has("amount"))
18823      res.setAmount(parseQuantity(json.getAsJsonObject("amount")));
18824  }
18825
18826  protected NutritionOrder.NutritionOrderOralDietTextureComponent parseNutritionOrderNutritionOrderOralDietTextureComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
18827    NutritionOrder.NutritionOrderOralDietTextureComponent res = new NutritionOrder.NutritionOrderOralDietTextureComponent();
18828    parseNutritionOrderNutritionOrderOralDietTextureComponentProperties(json, owner, res);
18829    return res;
18830  }
18831
18832  protected void parseNutritionOrderNutritionOrderOralDietTextureComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietTextureComponent res) throws IOException, FHIRFormatError {
18833    parseBackboneElementProperties(json, res);
18834    if (json.has("modifier"))
18835      res.setModifier(parseCodeableConcept(json.getAsJsonObject("modifier")));
18836    if (json.has("foodType"))
18837      res.setFoodType(parseCodeableConcept(json.getAsJsonObject("foodType")));
18838  }
18839
18840  protected NutritionOrder.NutritionOrderSupplementComponent parseNutritionOrderNutritionOrderSupplementComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
18841    NutritionOrder.NutritionOrderSupplementComponent res = new NutritionOrder.NutritionOrderSupplementComponent();
18842    parseNutritionOrderNutritionOrderSupplementComponentProperties(json, owner, res);
18843    return res;
18844  }
18845
18846  protected void parseNutritionOrderNutritionOrderSupplementComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderSupplementComponent res) throws IOException, FHIRFormatError {
18847    parseBackboneElementProperties(json, res);
18848    if (json.has("type"))
18849      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18850    if (json.has("productName"))
18851      res.setProductNameElement(parseString(json.get("productName").getAsString()));
18852    if (json.has("_productName"))
18853      parseElementProperties(json.getAsJsonObject("_productName"), res.getProductNameElement());
18854    if (json.has("schedule")) {
18855      JsonArray array = json.getAsJsonArray("schedule");
18856      for (int i = 0; i < array.size(); i++) {
18857        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
18858      }
18859    };
18860    if (json.has("quantity"))
18861      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
18862    if (json.has("instruction"))
18863      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
18864    if (json.has("_instruction"))
18865      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
18866  }
18867
18868  protected NutritionOrder.NutritionOrderEnteralFormulaComponent parseNutritionOrderNutritionOrderEnteralFormulaComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
18869    NutritionOrder.NutritionOrderEnteralFormulaComponent res = new NutritionOrder.NutritionOrderEnteralFormulaComponent();
18870    parseNutritionOrderNutritionOrderEnteralFormulaComponentProperties(json, owner, res);
18871    return res;
18872  }
18873
18874  protected void parseNutritionOrderNutritionOrderEnteralFormulaComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaComponent res) throws IOException, FHIRFormatError {
18875    parseBackboneElementProperties(json, res);
18876    if (json.has("baseFormulaType"))
18877      res.setBaseFormulaType(parseCodeableConcept(json.getAsJsonObject("baseFormulaType")));
18878    if (json.has("baseFormulaProductName"))
18879      res.setBaseFormulaProductNameElement(parseString(json.get("baseFormulaProductName").getAsString()));
18880    if (json.has("_baseFormulaProductName"))
18881      parseElementProperties(json.getAsJsonObject("_baseFormulaProductName"), res.getBaseFormulaProductNameElement());
18882    if (json.has("additiveType"))
18883      res.setAdditiveType(parseCodeableConcept(json.getAsJsonObject("additiveType")));
18884    if (json.has("additiveProductName"))
18885      res.setAdditiveProductNameElement(parseString(json.get("additiveProductName").getAsString()));
18886    if (json.has("_additiveProductName"))
18887      parseElementProperties(json.getAsJsonObject("_additiveProductName"), res.getAdditiveProductNameElement());
18888    if (json.has("caloricDensity"))
18889      res.setCaloricDensity(parseQuantity(json.getAsJsonObject("caloricDensity")));
18890    if (json.has("routeofAdministration"))
18891      res.setRouteofAdministration(parseCodeableConcept(json.getAsJsonObject("routeofAdministration")));
18892    if (json.has("administration")) {
18893      JsonArray array = json.getAsJsonArray("administration");
18894      for (int i = 0; i < array.size(); i++) {
18895        res.getAdministration().add(parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(array.get(i).getAsJsonObject(), owner));
18896      }
18897    };
18898    if (json.has("maxVolumeToDeliver"))
18899      res.setMaxVolumeToDeliver(parseQuantity(json.getAsJsonObject("maxVolumeToDeliver")));
18900    if (json.has("administrationInstruction"))
18901      res.setAdministrationInstructionElement(parseString(json.get("administrationInstruction").getAsString()));
18902    if (json.has("_administrationInstruction"))
18903      parseElementProperties(json.getAsJsonObject("_administrationInstruction"), res.getAdministrationInstructionElement());
18904  }
18905
18906  protected NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
18907    NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res = new NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent();
18908    parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentProperties(json, owner, res);
18909    return res;
18910  }
18911
18912  protected void parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res) throws IOException, FHIRFormatError {
18913    parseBackboneElementProperties(json, res);
18914    if (json.has("schedule"))
18915      res.setSchedule(parseTiming(json.getAsJsonObject("schedule")));
18916    if (json.has("quantity"))
18917      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
18918    Type rate = parseType("rate", json);
18919    if (rate != null)
18920      res.setRate(rate);
18921  }
18922
18923  protected Observation parseObservation(JsonObject json) throws IOException, FHIRFormatError {
18924    Observation res = new Observation();
18925    parseObservationProperties(json, res);
18926    return res;
18927  }
18928
18929  protected void parseObservationProperties(JsonObject json, Observation res) throws IOException, FHIRFormatError {
18930    parseDomainResourceProperties(json, res);
18931    if (json.has("identifier")) {
18932      JsonArray array = json.getAsJsonArray("identifier");
18933      for (int i = 0; i < array.size(); i++) {
18934        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18935      }
18936    };
18937    if (json.has("basedOn")) {
18938      JsonArray array = json.getAsJsonArray("basedOn");
18939      for (int i = 0; i < array.size(); i++) {
18940        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
18941      }
18942    };
18943    if (json.has("partOf")) {
18944      JsonArray array = json.getAsJsonArray("partOf");
18945      for (int i = 0; i < array.size(); i++) {
18946        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
18947      }
18948    };
18949    if (json.has("status"))
18950      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Observation.ObservationStatus.NULL, new Observation.ObservationStatusEnumFactory()));
18951    if (json.has("_status"))
18952      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
18953    if (json.has("category")) {
18954      JsonArray array = json.getAsJsonArray("category");
18955      for (int i = 0; i < array.size(); i++) {
18956        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18957      }
18958    };
18959    if (json.has("code"))
18960      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
18961    if (json.has("subject"))
18962      res.setSubject(parseReference(json.getAsJsonObject("subject")));
18963    if (json.has("focus")) {
18964      JsonArray array = json.getAsJsonArray("focus");
18965      for (int i = 0; i < array.size(); i++) {
18966        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
18967      }
18968    };
18969    if (json.has("encounter"))
18970      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
18971    Type effective = parseType("effective", json);
18972    if (effective != null)
18973      res.setEffective(effective);
18974    if (json.has("issued"))
18975      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
18976    if (json.has("_issued"))
18977      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
18978    if (json.has("performer")) {
18979      JsonArray array = json.getAsJsonArray("performer");
18980      for (int i = 0; i < array.size(); i++) {
18981        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
18982      }
18983    };
18984    Type value = parseType("value", json);
18985    if (value != null)
18986      res.setValue(value);
18987    if (json.has("dataAbsentReason"))
18988      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
18989    if (json.has("interpretation")) {
18990      JsonArray array = json.getAsJsonArray("interpretation");
18991      for (int i = 0; i < array.size(); i++) {
18992        res.getInterpretation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18993      }
18994    };
18995    if (json.has("note")) {
18996      JsonArray array = json.getAsJsonArray("note");
18997      for (int i = 0; i < array.size(); i++) {
18998        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
18999      }
19000    };
19001    if (json.has("bodySite"))
19002      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
19003    if (json.has("method"))
19004      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
19005    if (json.has("specimen"))
19006      res.setSpecimen(parseReference(json.getAsJsonObject("specimen")));
19007    if (json.has("device"))
19008      res.setDevice(parseReference(json.getAsJsonObject("device")));
19009    if (json.has("referenceRange")) {
19010      JsonArray array = json.getAsJsonArray("referenceRange");
19011      for (int i = 0; i < array.size(); i++) {
19012        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), res));
19013      }
19014    };
19015    if (json.has("hasMember")) {
19016      JsonArray array = json.getAsJsonArray("hasMember");
19017      for (int i = 0; i < array.size(); i++) {
19018        res.getHasMember().add(parseReference(array.get(i).getAsJsonObject()));
19019      }
19020    };
19021    if (json.has("derivedFrom")) {
19022      JsonArray array = json.getAsJsonArray("derivedFrom");
19023      for (int i = 0; i < array.size(); i++) {
19024        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
19025      }
19026    };
19027    if (json.has("component")) {
19028      JsonArray array = json.getAsJsonArray("component");
19029      for (int i = 0; i < array.size(); i++) {
19030        res.getComponent().add(parseObservationObservationComponentComponent(array.get(i).getAsJsonObject(), res));
19031      }
19032    };
19033  }
19034
19035  protected Observation.ObservationReferenceRangeComponent parseObservationObservationReferenceRangeComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
19036    Observation.ObservationReferenceRangeComponent res = new Observation.ObservationReferenceRangeComponent();
19037    parseObservationObservationReferenceRangeComponentProperties(json, owner, res);
19038    return res;
19039  }
19040
19041  protected void parseObservationObservationReferenceRangeComponentProperties(JsonObject json, Observation owner, Observation.ObservationReferenceRangeComponent res) throws IOException, FHIRFormatError {
19042    parseBackboneElementProperties(json, res);
19043    if (json.has("low"))
19044      res.setLow(parseQuantity(json.getAsJsonObject("low")));
19045    if (json.has("high"))
19046      res.setHigh(parseQuantity(json.getAsJsonObject("high")));
19047    if (json.has("type"))
19048      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
19049    if (json.has("appliesTo")) {
19050      JsonArray array = json.getAsJsonArray("appliesTo");
19051      for (int i = 0; i < array.size(); i++) {
19052        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19053      }
19054    };
19055    if (json.has("age"))
19056      res.setAge(parseRange(json.getAsJsonObject("age")));
19057    if (json.has("text"))
19058      res.setTextElement(parseString(json.get("text").getAsString()));
19059    if (json.has("_text"))
19060      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
19061  }
19062
19063  protected Observation.ObservationComponentComponent parseObservationObservationComponentComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
19064    Observation.ObservationComponentComponent res = new Observation.ObservationComponentComponent();
19065    parseObservationObservationComponentComponentProperties(json, owner, res);
19066    return res;
19067  }
19068
19069  protected void parseObservationObservationComponentComponentProperties(JsonObject json, Observation owner, Observation.ObservationComponentComponent res) throws IOException, FHIRFormatError {
19070    parseBackboneElementProperties(json, res);
19071    if (json.has("code"))
19072      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
19073    Type value = parseType("value", json);
19074    if (value != null)
19075      res.setValue(value);
19076    if (json.has("dataAbsentReason"))
19077      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
19078    if (json.has("interpretation")) {
19079      JsonArray array = json.getAsJsonArray("interpretation");
19080      for (int i = 0; i < array.size(); i++) {
19081        res.getInterpretation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19082      }
19083    };
19084    if (json.has("referenceRange")) {
19085      JsonArray array = json.getAsJsonArray("referenceRange");
19086      for (int i = 0; i < array.size(); i++) {
19087        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), owner));
19088      }
19089    };
19090  }
19091
19092  protected ObservationDefinition parseObservationDefinition(JsonObject json) throws IOException, FHIRFormatError {
19093    ObservationDefinition res = new ObservationDefinition();
19094    parseObservationDefinitionProperties(json, res);
19095    return res;
19096  }
19097
19098  protected void parseObservationDefinitionProperties(JsonObject json, ObservationDefinition res) throws IOException, FHIRFormatError {
19099    parseDomainResourceProperties(json, res);
19100    if (json.has("category")) {
19101      JsonArray array = json.getAsJsonArray("category");
19102      for (int i = 0; i < array.size(); i++) {
19103        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19104      }
19105    };
19106    if (json.has("code"))
19107      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
19108    if (json.has("identifier")) {
19109      JsonArray array = json.getAsJsonArray("identifier");
19110      for (int i = 0; i < array.size(); i++) {
19111        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19112      }
19113    };
19114    if (json.has("permittedDataType")) {
19115      JsonArray array = json.getAsJsonArray("permittedDataType");
19116      for (int i = 0; i < array.size(); i++) {
19117        res.getPermittedDataType().add(parseEnumeration(array.get(i).getAsString(), ObservationDefinition.ObservationDataType.NULL, new ObservationDefinition.ObservationDataTypeEnumFactory()));
19118      }
19119    };
19120    if (json.has("_permittedDataType")) {
19121      JsonArray array = json.getAsJsonArray("_permittedDataType");
19122      for (int i = 0; i < array.size(); i++) {
19123        if (i == res.getPermittedDataType().size())
19124          res.getPermittedDataType().add(parseEnumeration(null, ObservationDefinition.ObservationDataType.NULL, new ObservationDefinition.ObservationDataTypeEnumFactory()));
19125        if (array.get(i) instanceof JsonObject) 
19126          parseElementProperties(array.get(i).getAsJsonObject(), res.getPermittedDataType().get(i));
19127      }
19128    };
19129    if (json.has("multipleResultsAllowed"))
19130      res.setMultipleResultsAllowedElement(parseBoolean(json.get("multipleResultsAllowed").getAsBoolean()));
19131    if (json.has("_multipleResultsAllowed"))
19132      parseElementProperties(json.getAsJsonObject("_multipleResultsAllowed"), res.getMultipleResultsAllowedElement());
19133    if (json.has("method"))
19134      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
19135    if (json.has("preferredReportName"))
19136      res.setPreferredReportNameElement(parseString(json.get("preferredReportName").getAsString()));
19137    if (json.has("_preferredReportName"))
19138      parseElementProperties(json.getAsJsonObject("_preferredReportName"), res.getPreferredReportNameElement());
19139    if (json.has("quantitativeDetails"))
19140      res.setQuantitativeDetails(parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(json.getAsJsonObject("quantitativeDetails"), res));
19141    if (json.has("qualifiedInterval")) {
19142      JsonArray array = json.getAsJsonArray("qualifiedInterval");
19143      for (int i = 0; i < array.size(); i++) {
19144        res.getQualifiedInterval().add(parseObservationDefinitionObservationDefinitionQualifiedIntervalComponent(array.get(i).getAsJsonObject(), res));
19145      }
19146    };
19147    if (json.has("validCodedValueSet"))
19148      res.setValidCodedValueSet(parseReference(json.getAsJsonObject("validCodedValueSet")));
19149    if (json.has("normalCodedValueSet"))
19150      res.setNormalCodedValueSet(parseReference(json.getAsJsonObject("normalCodedValueSet")));
19151    if (json.has("abnormalCodedValueSet"))
19152      res.setAbnormalCodedValueSet(parseReference(json.getAsJsonObject("abnormalCodedValueSet")));
19153    if (json.has("criticalCodedValueSet"))
19154      res.setCriticalCodedValueSet(parseReference(json.getAsJsonObject("criticalCodedValueSet")));
19155  }
19156
19157  protected ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(JsonObject json, ObservationDefinition owner) throws IOException, FHIRFormatError {
19158    ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent res = new ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent();
19159    parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponentProperties(json, owner, res);
19160    return res;
19161  }
19162
19163  protected void parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponentProperties(JsonObject json, ObservationDefinition owner, ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent res) throws IOException, FHIRFormatError {
19164    parseBackboneElementProperties(json, res);
19165    if (json.has("customaryUnit"))
19166      res.setCustomaryUnit(parseCodeableConcept(json.getAsJsonObject("customaryUnit")));
19167    if (json.has("unit"))
19168      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
19169    if (json.has("conversionFactor"))
19170      res.setConversionFactorElement(parseDecimal(json.get("conversionFactor").getAsBigDecimal()));
19171    if (json.has("_conversionFactor"))
19172      parseElementProperties(json.getAsJsonObject("_conversionFactor"), res.getConversionFactorElement());
19173    if (json.has("decimalPrecision"))
19174      res.setDecimalPrecisionElement(parseInteger(json.get("decimalPrecision").getAsLong()));
19175    if (json.has("_decimalPrecision"))
19176      parseElementProperties(json.getAsJsonObject("_decimalPrecision"), res.getDecimalPrecisionElement());
19177  }
19178
19179  protected ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent parseObservationDefinitionObservationDefinitionQualifiedIntervalComponent(JsonObject json, ObservationDefinition owner) throws IOException, FHIRFormatError {
19180    ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent res = new ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent();
19181    parseObservationDefinitionObservationDefinitionQualifiedIntervalComponentProperties(json, owner, res);
19182    return res;
19183  }
19184
19185  protected void parseObservationDefinitionObservationDefinitionQualifiedIntervalComponentProperties(JsonObject json, ObservationDefinition owner, ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent res) throws IOException, FHIRFormatError {
19186    parseBackboneElementProperties(json, res);
19187    if (json.has("category"))
19188      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), ObservationDefinition.ObservationRangeCategory.NULL, new ObservationDefinition.ObservationRangeCategoryEnumFactory()));
19189    if (json.has("_category"))
19190      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
19191    if (json.has("range"))
19192      res.setRange(parseRange(json.getAsJsonObject("range")));
19193    if (json.has("context"))
19194      res.setContext(parseCodeableConcept(json.getAsJsonObject("context")));
19195    if (json.has("appliesTo")) {
19196      JsonArray array = json.getAsJsonArray("appliesTo");
19197      for (int i = 0; i < array.size(); i++) {
19198        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19199      }
19200    };
19201    if (json.has("gender"))
19202      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
19203    if (json.has("_gender"))
19204      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
19205    if (json.has("age"))
19206      res.setAge(parseRange(json.getAsJsonObject("age")));
19207    if (json.has("gestationalAge"))
19208      res.setGestationalAge(parseRange(json.getAsJsonObject("gestationalAge")));
19209    if (json.has("condition"))
19210      res.setConditionElement(parseString(json.get("condition").getAsString()));
19211    if (json.has("_condition"))
19212      parseElementProperties(json.getAsJsonObject("_condition"), res.getConditionElement());
19213  }
19214
19215  protected OperationDefinition parseOperationDefinition(JsonObject json) throws IOException, FHIRFormatError {
19216    OperationDefinition res = new OperationDefinition();
19217    parseOperationDefinitionProperties(json, res);
19218    return res;
19219  }
19220
19221  protected void parseOperationDefinitionProperties(JsonObject json, OperationDefinition res) throws IOException, FHIRFormatError {
19222    parseDomainResourceProperties(json, res);
19223    if (json.has("url"))
19224      res.setUrlElement(parseUri(json.get("url").getAsString()));
19225    if (json.has("_url"))
19226      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
19227    if (json.has("version"))
19228      res.setVersionElement(parseString(json.get("version").getAsString()));
19229    if (json.has("_version"))
19230      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
19231    if (json.has("name"))
19232      res.setNameElement(parseString(json.get("name").getAsString()));
19233    if (json.has("_name"))
19234      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
19235    if (json.has("title"))
19236      res.setTitleElement(parseString(json.get("title").getAsString()));
19237    if (json.has("_title"))
19238      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
19239    if (json.has("status"))
19240      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
19241    if (json.has("_status"))
19242      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19243    if (json.has("kind"))
19244      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), OperationDefinition.OperationKind.NULL, new OperationDefinition.OperationKindEnumFactory()));
19245    if (json.has("_kind"))
19246      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
19247    if (json.has("experimental"))
19248      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
19249    if (json.has("_experimental"))
19250      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
19251    if (json.has("date"))
19252      res.setDateElement(parseDateTime(json.get("date").getAsString()));
19253    if (json.has("_date"))
19254      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
19255    if (json.has("publisher"))
19256      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
19257    if (json.has("_publisher"))
19258      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
19259    if (json.has("contact")) {
19260      JsonArray array = json.getAsJsonArray("contact");
19261      for (int i = 0; i < array.size(); i++) {
19262        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
19263      }
19264    };
19265    if (json.has("description"))
19266      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
19267    if (json.has("_description"))
19268      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
19269    if (json.has("useContext")) {
19270      JsonArray array = json.getAsJsonArray("useContext");
19271      for (int i = 0; i < array.size(); i++) {
19272        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
19273      }
19274    };
19275    if (json.has("jurisdiction")) {
19276      JsonArray array = json.getAsJsonArray("jurisdiction");
19277      for (int i = 0; i < array.size(); i++) {
19278        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19279      }
19280    };
19281    if (json.has("purpose"))
19282      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
19283    if (json.has("_purpose"))
19284      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
19285    if (json.has("affectsState"))
19286      res.setAffectsStateElement(parseBoolean(json.get("affectsState").getAsBoolean()));
19287    if (json.has("_affectsState"))
19288      parseElementProperties(json.getAsJsonObject("_affectsState"), res.getAffectsStateElement());
19289    if (json.has("code"))
19290      res.setCodeElement(parseCode(json.get("code").getAsString()));
19291    if (json.has("_code"))
19292      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
19293    if (json.has("comment"))
19294      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
19295    if (json.has("_comment"))
19296      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
19297    if (json.has("base"))
19298      res.setBaseElement(parseCanonical(json.get("base").getAsString()));
19299    if (json.has("_base"))
19300      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
19301    if (json.has("resource")) {
19302      JsonArray array = json.getAsJsonArray("resource");
19303      for (int i = 0; i < array.size(); i++) {
19304        res.getResource().add(parseCode(array.get(i).getAsString()));
19305      }
19306    };
19307    if (json.has("_resource")) {
19308      JsonArray array = json.getAsJsonArray("_resource");
19309      for (int i = 0; i < array.size(); i++) {
19310        if (i == res.getResource().size())
19311          res.getResource().add(parseCode(null));
19312        if (array.get(i) instanceof JsonObject) 
19313          parseElementProperties(array.get(i).getAsJsonObject(), res.getResource().get(i));
19314      }
19315    };
19316    if (json.has("system"))
19317      res.setSystemElement(parseBoolean(json.get("system").getAsBoolean()));
19318    if (json.has("_system"))
19319      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
19320    if (json.has("type"))
19321      res.setTypeElement(parseBoolean(json.get("type").getAsBoolean()));
19322    if (json.has("_type"))
19323      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
19324    if (json.has("instance"))
19325      res.setInstanceElement(parseBoolean(json.get("instance").getAsBoolean()));
19326    if (json.has("_instance"))
19327      parseElementProperties(json.getAsJsonObject("_instance"), res.getInstanceElement());
19328    if (json.has("inputProfile"))
19329      res.setInputProfileElement(parseCanonical(json.get("inputProfile").getAsString()));
19330    if (json.has("_inputProfile"))
19331      parseElementProperties(json.getAsJsonObject("_inputProfile"), res.getInputProfileElement());
19332    if (json.has("outputProfile"))
19333      res.setOutputProfileElement(parseCanonical(json.get("outputProfile").getAsString()));
19334    if (json.has("_outputProfile"))
19335      parseElementProperties(json.getAsJsonObject("_outputProfile"), res.getOutputProfileElement());
19336    if (json.has("parameter")) {
19337      JsonArray array = json.getAsJsonArray("parameter");
19338      for (int i = 0; i < array.size(); i++) {
19339        res.getParameter().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), res));
19340      }
19341    };
19342    if (json.has("overload")) {
19343      JsonArray array = json.getAsJsonArray("overload");
19344      for (int i = 0; i < array.size(); i++) {
19345        res.getOverload().add(parseOperationDefinitionOperationDefinitionOverloadComponent(array.get(i).getAsJsonObject(), res));
19346      }
19347    };
19348  }
19349
19350  protected OperationDefinition.OperationDefinitionParameterComponent parseOperationDefinitionOperationDefinitionParameterComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
19351    OperationDefinition.OperationDefinitionParameterComponent res = new OperationDefinition.OperationDefinitionParameterComponent();
19352    parseOperationDefinitionOperationDefinitionParameterComponentProperties(json, owner, res);
19353    return res;
19354  }
19355
19356  protected void parseOperationDefinitionOperationDefinitionParameterComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterComponent res) throws IOException, FHIRFormatError {
19357    parseBackboneElementProperties(json, res);
19358    if (json.has("name"))
19359      res.setNameElement(parseCode(json.get("name").getAsString()));
19360    if (json.has("_name"))
19361      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
19362    if (json.has("use"))
19363      res.setUseElement(parseEnumeration(json.get("use").getAsString(), OperationDefinition.OperationParameterUse.NULL, new OperationDefinition.OperationParameterUseEnumFactory()));
19364    if (json.has("_use"))
19365      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
19366    if (json.has("min"))
19367      res.setMinElement(parseInteger(json.get("min").getAsLong()));
19368    if (json.has("_min"))
19369      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
19370    if (json.has("max"))
19371      res.setMaxElement(parseString(json.get("max").getAsString()));
19372    if (json.has("_max"))
19373      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
19374    if (json.has("documentation"))
19375      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
19376    if (json.has("_documentation"))
19377      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
19378    if (json.has("type"))
19379      res.setTypeElement(parseCode(json.get("type").getAsString()));
19380    if (json.has("_type"))
19381      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
19382    if (json.has("targetProfile")) {
19383      JsonArray array = json.getAsJsonArray("targetProfile");
19384      for (int i = 0; i < array.size(); i++) {
19385        res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
19386      }
19387    };
19388    if (json.has("_targetProfile")) {
19389      JsonArray array = json.getAsJsonArray("_targetProfile");
19390      for (int i = 0; i < array.size(); i++) {
19391        if (i == res.getTargetProfile().size())
19392          res.getTargetProfile().add(parseCanonical(null));
19393        if (array.get(i) instanceof JsonObject) 
19394          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
19395      }
19396    };
19397    if (json.has("searchType"))
19398      res.setSearchTypeElement(parseEnumeration(json.get("searchType").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
19399    if (json.has("_searchType"))
19400      parseElementProperties(json.getAsJsonObject("_searchType"), res.getSearchTypeElement());
19401    if (json.has("binding"))
19402      res.setBinding(parseOperationDefinitionOperationDefinitionParameterBindingComponent(json.getAsJsonObject("binding"), owner));
19403    if (json.has("referencedFrom")) {
19404      JsonArray array = json.getAsJsonArray("referencedFrom");
19405      for (int i = 0; i < array.size(); i++) {
19406        res.getReferencedFrom().add(parseOperationDefinitionOperationDefinitionParameterReferencedFromComponent(array.get(i).getAsJsonObject(), owner));
19407      }
19408    };
19409    if (json.has("part")) {
19410      JsonArray array = json.getAsJsonArray("part");
19411      for (int i = 0; i < array.size(); i++) {
19412        res.getPart().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), owner));
19413      }
19414    };
19415  }
19416
19417  protected OperationDefinition.OperationDefinitionParameterBindingComponent parseOperationDefinitionOperationDefinitionParameterBindingComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
19418    OperationDefinition.OperationDefinitionParameterBindingComponent res = new OperationDefinition.OperationDefinitionParameterBindingComponent();
19419    parseOperationDefinitionOperationDefinitionParameterBindingComponentProperties(json, owner, res);
19420    return res;
19421  }
19422
19423  protected void parseOperationDefinitionOperationDefinitionParameterBindingComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterBindingComponent res) throws IOException, FHIRFormatError {
19424    parseBackboneElementProperties(json, res);
19425    if (json.has("strength"))
19426      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
19427    if (json.has("_strength"))
19428      parseElementProperties(json.getAsJsonObject("_strength"), res.getStrengthElement());
19429    if (json.has("valueSet"))
19430      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
19431    if (json.has("_valueSet"))
19432      parseElementProperties(json.getAsJsonObject("_valueSet"), res.getValueSetElement());
19433  }
19434
19435  protected OperationDefinition.OperationDefinitionParameterReferencedFromComponent parseOperationDefinitionOperationDefinitionParameterReferencedFromComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
19436    OperationDefinition.OperationDefinitionParameterReferencedFromComponent res = new OperationDefinition.OperationDefinitionParameterReferencedFromComponent();
19437    parseOperationDefinitionOperationDefinitionParameterReferencedFromComponentProperties(json, owner, res);
19438    return res;
19439  }
19440
19441  protected void parseOperationDefinitionOperationDefinitionParameterReferencedFromComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterReferencedFromComponent res) throws IOException, FHIRFormatError {
19442    parseBackboneElementProperties(json, res);
19443    if (json.has("source"))
19444      res.setSourceElement(parseString(json.get("source").getAsString()));
19445    if (json.has("_source"))
19446      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
19447    if (json.has("sourceId"))
19448      res.setSourceIdElement(parseString(json.get("sourceId").getAsString()));
19449    if (json.has("_sourceId"))
19450      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
19451  }
19452
19453  protected OperationDefinition.OperationDefinitionOverloadComponent parseOperationDefinitionOperationDefinitionOverloadComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
19454    OperationDefinition.OperationDefinitionOverloadComponent res = new OperationDefinition.OperationDefinitionOverloadComponent();
19455    parseOperationDefinitionOperationDefinitionOverloadComponentProperties(json, owner, res);
19456    return res;
19457  }
19458
19459  protected void parseOperationDefinitionOperationDefinitionOverloadComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionOverloadComponent res) throws IOException, FHIRFormatError {
19460    parseBackboneElementProperties(json, res);
19461    if (json.has("parameterName")) {
19462      JsonArray array = json.getAsJsonArray("parameterName");
19463      for (int i = 0; i < array.size(); i++) {
19464        res.getParameterName().add(parseString(array.get(i).getAsString()));
19465      }
19466    };
19467    if (json.has("_parameterName")) {
19468      JsonArray array = json.getAsJsonArray("_parameterName");
19469      for (int i = 0; i < array.size(); i++) {
19470        if (i == res.getParameterName().size())
19471          res.getParameterName().add(parseString(null));
19472        if (array.get(i) instanceof JsonObject) 
19473          parseElementProperties(array.get(i).getAsJsonObject(), res.getParameterName().get(i));
19474      }
19475    };
19476    if (json.has("comment"))
19477      res.setCommentElement(parseString(json.get("comment").getAsString()));
19478    if (json.has("_comment"))
19479      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
19480  }
19481
19482  protected OperationOutcome parseOperationOutcome(JsonObject json) throws IOException, FHIRFormatError {
19483    OperationOutcome res = new OperationOutcome();
19484    parseOperationOutcomeProperties(json, res);
19485    return res;
19486  }
19487
19488  protected void parseOperationOutcomeProperties(JsonObject json, OperationOutcome res) throws IOException, FHIRFormatError {
19489    parseDomainResourceProperties(json, res);
19490    if (json.has("issue")) {
19491      JsonArray array = json.getAsJsonArray("issue");
19492      for (int i = 0; i < array.size(); i++) {
19493        res.getIssue().add(parseOperationOutcomeOperationOutcomeIssueComponent(array.get(i).getAsJsonObject(), res));
19494      }
19495    };
19496  }
19497
19498  protected OperationOutcome.OperationOutcomeIssueComponent parseOperationOutcomeOperationOutcomeIssueComponent(JsonObject json, OperationOutcome owner) throws IOException, FHIRFormatError {
19499    OperationOutcome.OperationOutcomeIssueComponent res = new OperationOutcome.OperationOutcomeIssueComponent();
19500    parseOperationOutcomeOperationOutcomeIssueComponentProperties(json, owner, res);
19501    return res;
19502  }
19503
19504  protected void parseOperationOutcomeOperationOutcomeIssueComponentProperties(JsonObject json, OperationOutcome owner, OperationOutcome.OperationOutcomeIssueComponent res) throws IOException, FHIRFormatError {
19505    parseBackboneElementProperties(json, res);
19506    if (json.has("severity"))
19507      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), OperationOutcome.IssueSeverity.NULL, new OperationOutcome.IssueSeverityEnumFactory()));
19508    if (json.has("_severity"))
19509      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
19510    if (json.has("code"))
19511      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), OperationOutcome.IssueType.NULL, new OperationOutcome.IssueTypeEnumFactory()));
19512    if (json.has("_code"))
19513      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
19514    if (json.has("details"))
19515      res.setDetails(parseCodeableConcept(json.getAsJsonObject("details")));
19516    if (json.has("diagnostics"))
19517      res.setDiagnosticsElement(parseString(json.get("diagnostics").getAsString()));
19518    if (json.has("_diagnostics"))
19519      parseElementProperties(json.getAsJsonObject("_diagnostics"), res.getDiagnosticsElement());
19520    if (json.has("location")) {
19521      JsonArray array = json.getAsJsonArray("location");
19522      for (int i = 0; i < array.size(); i++) {
19523        res.getLocation().add(parseString(array.get(i).getAsString()));
19524      }
19525    };
19526    if (json.has("_location")) {
19527      JsonArray array = json.getAsJsonArray("_location");
19528      for (int i = 0; i < array.size(); i++) {
19529        if (i == res.getLocation().size())
19530          res.getLocation().add(parseString(null));
19531        if (array.get(i) instanceof JsonObject) 
19532          parseElementProperties(array.get(i).getAsJsonObject(), res.getLocation().get(i));
19533      }
19534    };
19535    if (json.has("expression")) {
19536      JsonArray array = json.getAsJsonArray("expression");
19537      for (int i = 0; i < array.size(); i++) {
19538        res.getExpression().add(parseString(array.get(i).getAsString()));
19539      }
19540    };
19541    if (json.has("_expression")) {
19542      JsonArray array = json.getAsJsonArray("_expression");
19543      for (int i = 0; i < array.size(); i++) {
19544        if (i == res.getExpression().size())
19545          res.getExpression().add(parseString(null));
19546        if (array.get(i) instanceof JsonObject) 
19547          parseElementProperties(array.get(i).getAsJsonObject(), res.getExpression().get(i));
19548      }
19549    };
19550  }
19551
19552  protected Organization parseOrganization(JsonObject json) throws IOException, FHIRFormatError {
19553    Organization res = new Organization();
19554    parseOrganizationProperties(json, res);
19555    return res;
19556  }
19557
19558  protected void parseOrganizationProperties(JsonObject json, Organization res) throws IOException, FHIRFormatError {
19559    parseDomainResourceProperties(json, res);
19560    if (json.has("identifier")) {
19561      JsonArray array = json.getAsJsonArray("identifier");
19562      for (int i = 0; i < array.size(); i++) {
19563        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19564      }
19565    };
19566    if (json.has("active"))
19567      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
19568    if (json.has("_active"))
19569      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
19570    if (json.has("type")) {
19571      JsonArray array = json.getAsJsonArray("type");
19572      for (int i = 0; i < array.size(); i++) {
19573        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19574      }
19575    };
19576    if (json.has("name"))
19577      res.setNameElement(parseString(json.get("name").getAsString()));
19578    if (json.has("_name"))
19579      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
19580    if (json.has("alias")) {
19581      JsonArray array = json.getAsJsonArray("alias");
19582      for (int i = 0; i < array.size(); i++) {
19583        res.getAlias().add(parseString(array.get(i).getAsString()));
19584      }
19585    };
19586    if (json.has("_alias")) {
19587      JsonArray array = json.getAsJsonArray("_alias");
19588      for (int i = 0; i < array.size(); i++) {
19589        if (i == res.getAlias().size())
19590          res.getAlias().add(parseString(null));
19591        if (array.get(i) instanceof JsonObject) 
19592          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
19593      }
19594    };
19595    if (json.has("telecom")) {
19596      JsonArray array = json.getAsJsonArray("telecom");
19597      for (int i = 0; i < array.size(); i++) {
19598        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
19599      }
19600    };
19601    if (json.has("address")) {
19602      JsonArray array = json.getAsJsonArray("address");
19603      for (int i = 0; i < array.size(); i++) {
19604        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
19605      }
19606    };
19607    if (json.has("partOf"))
19608      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
19609    if (json.has("contact")) {
19610      JsonArray array = json.getAsJsonArray("contact");
19611      for (int i = 0; i < array.size(); i++) {
19612        res.getContact().add(parseOrganizationOrganizationContactComponent(array.get(i).getAsJsonObject(), res));
19613      }
19614    };
19615    if (json.has("endpoint")) {
19616      JsonArray array = json.getAsJsonArray("endpoint");
19617      for (int i = 0; i < array.size(); i++) {
19618        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
19619      }
19620    };
19621  }
19622
19623  protected Organization.OrganizationContactComponent parseOrganizationOrganizationContactComponent(JsonObject json, Organization owner) throws IOException, FHIRFormatError {
19624    Organization.OrganizationContactComponent res = new Organization.OrganizationContactComponent();
19625    parseOrganizationOrganizationContactComponentProperties(json, owner, res);
19626    return res;
19627  }
19628
19629  protected void parseOrganizationOrganizationContactComponentProperties(JsonObject json, Organization owner, Organization.OrganizationContactComponent res) throws IOException, FHIRFormatError {
19630    parseBackboneElementProperties(json, res);
19631    if (json.has("purpose"))
19632      res.setPurpose(parseCodeableConcept(json.getAsJsonObject("purpose")));
19633    if (json.has("name"))
19634      res.setName(parseHumanName(json.getAsJsonObject("name")));
19635    if (json.has("telecom")) {
19636      JsonArray array = json.getAsJsonArray("telecom");
19637      for (int i = 0; i < array.size(); i++) {
19638        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
19639      }
19640    };
19641    if (json.has("address"))
19642      res.setAddress(parseAddress(json.getAsJsonObject("address")));
19643  }
19644
19645  protected OrganizationAffiliation parseOrganizationAffiliation(JsonObject json) throws IOException, FHIRFormatError {
19646    OrganizationAffiliation res = new OrganizationAffiliation();
19647    parseOrganizationAffiliationProperties(json, res);
19648    return res;
19649  }
19650
19651  protected void parseOrganizationAffiliationProperties(JsonObject json, OrganizationAffiliation res) throws IOException, FHIRFormatError {
19652    parseDomainResourceProperties(json, res);
19653    if (json.has("identifier")) {
19654      JsonArray array = json.getAsJsonArray("identifier");
19655      for (int i = 0; i < array.size(); i++) {
19656        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19657      }
19658    };
19659    if (json.has("active"))
19660      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
19661    if (json.has("_active"))
19662      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
19663    if (json.has("period"))
19664      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
19665    if (json.has("organization"))
19666      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
19667    if (json.has("participatingOrganization"))
19668      res.setParticipatingOrganization(parseReference(json.getAsJsonObject("participatingOrganization")));
19669    if (json.has("network")) {
19670      JsonArray array = json.getAsJsonArray("network");
19671      for (int i = 0; i < array.size(); i++) {
19672        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
19673      }
19674    };
19675    if (json.has("code")) {
19676      JsonArray array = json.getAsJsonArray("code");
19677      for (int i = 0; i < array.size(); i++) {
19678        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19679      }
19680    };
19681    if (json.has("specialty")) {
19682      JsonArray array = json.getAsJsonArray("specialty");
19683      for (int i = 0; i < array.size(); i++) {
19684        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19685      }
19686    };
19687    if (json.has("location")) {
19688      JsonArray array = json.getAsJsonArray("location");
19689      for (int i = 0; i < array.size(); i++) {
19690        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
19691      }
19692    };
19693    if (json.has("healthcareService")) {
19694      JsonArray array = json.getAsJsonArray("healthcareService");
19695      for (int i = 0; i < array.size(); i++) {
19696        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
19697      }
19698    };
19699    if (json.has("telecom")) {
19700      JsonArray array = json.getAsJsonArray("telecom");
19701      for (int i = 0; i < array.size(); i++) {
19702        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
19703      }
19704    };
19705    if (json.has("endpoint")) {
19706      JsonArray array = json.getAsJsonArray("endpoint");
19707      for (int i = 0; i < array.size(); i++) {
19708        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
19709      }
19710    };
19711  }
19712
19713  protected Patient parsePatient(JsonObject json) throws IOException, FHIRFormatError {
19714    Patient res = new Patient();
19715    parsePatientProperties(json, res);
19716    return res;
19717  }
19718
19719  protected void parsePatientProperties(JsonObject json, Patient res) throws IOException, FHIRFormatError {
19720    parseDomainResourceProperties(json, res);
19721    if (json.has("identifier")) {
19722      JsonArray array = json.getAsJsonArray("identifier");
19723      for (int i = 0; i < array.size(); i++) {
19724        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19725      }
19726    };
19727    if (json.has("active"))
19728      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
19729    if (json.has("_active"))
19730      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
19731    if (json.has("name")) {
19732      JsonArray array = json.getAsJsonArray("name");
19733      for (int i = 0; i < array.size(); i++) {
19734        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
19735      }
19736    };
19737    if (json.has("telecom")) {
19738      JsonArray array = json.getAsJsonArray("telecom");
19739      for (int i = 0; i < array.size(); i++) {
19740        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
19741      }
19742    };
19743    if (json.has("gender"))
19744      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
19745    if (json.has("_gender"))
19746      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
19747    if (json.has("birthDate"))
19748      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
19749    if (json.has("_birthDate"))
19750      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
19751    Type deceased = parseType("deceased", json);
19752    if (deceased != null)
19753      res.setDeceased(deceased);
19754    if (json.has("address")) {
19755      JsonArray array = json.getAsJsonArray("address");
19756      for (int i = 0; i < array.size(); i++) {
19757        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
19758      }
19759    };
19760    if (json.has("maritalStatus"))
19761      res.setMaritalStatus(parseCodeableConcept(json.getAsJsonObject("maritalStatus")));
19762    Type multipleBirth = parseType("multipleBirth", json);
19763    if (multipleBirth != null)
19764      res.setMultipleBirth(multipleBirth);
19765    if (json.has("photo")) {
19766      JsonArray array = json.getAsJsonArray("photo");
19767      for (int i = 0; i < array.size(); i++) {
19768        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
19769      }
19770    };
19771    if (json.has("contact")) {
19772      JsonArray array = json.getAsJsonArray("contact");
19773      for (int i = 0; i < array.size(); i++) {
19774        res.getContact().add(parsePatientContactComponent(array.get(i).getAsJsonObject(), res));
19775      }
19776    };
19777    if (json.has("communication")) {
19778      JsonArray array = json.getAsJsonArray("communication");
19779      for (int i = 0; i < array.size(); i++) {
19780        res.getCommunication().add(parsePatientPatientCommunicationComponent(array.get(i).getAsJsonObject(), res));
19781      }
19782    };
19783    if (json.has("generalPractitioner")) {
19784      JsonArray array = json.getAsJsonArray("generalPractitioner");
19785      for (int i = 0; i < array.size(); i++) {
19786        res.getGeneralPractitioner().add(parseReference(array.get(i).getAsJsonObject()));
19787      }
19788    };
19789    if (json.has("managingOrganization"))
19790      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
19791    if (json.has("link")) {
19792      JsonArray array = json.getAsJsonArray("link");
19793      for (int i = 0; i < array.size(); i++) {
19794        res.getLink().add(parsePatientPatientLinkComponent(array.get(i).getAsJsonObject(), res));
19795      }
19796    };
19797  }
19798
19799  protected Patient.ContactComponent parsePatientContactComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
19800    Patient.ContactComponent res = new Patient.ContactComponent();
19801    parsePatientContactComponentProperties(json, owner, res);
19802    return res;
19803  }
19804
19805  protected void parsePatientContactComponentProperties(JsonObject json, Patient owner, Patient.ContactComponent res) throws IOException, FHIRFormatError {
19806    parseBackboneElementProperties(json, res);
19807    if (json.has("relationship")) {
19808      JsonArray array = json.getAsJsonArray("relationship");
19809      for (int i = 0; i < array.size(); i++) {
19810        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19811      }
19812    };
19813    if (json.has("name"))
19814      res.setName(parseHumanName(json.getAsJsonObject("name")));
19815    if (json.has("telecom")) {
19816      JsonArray array = json.getAsJsonArray("telecom");
19817      for (int i = 0; i < array.size(); i++) {
19818        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
19819      }
19820    };
19821    if (json.has("address"))
19822      res.setAddress(parseAddress(json.getAsJsonObject("address")));
19823    if (json.has("gender"))
19824      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
19825    if (json.has("_gender"))
19826      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
19827    if (json.has("organization"))
19828      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
19829    if (json.has("period"))
19830      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
19831  }
19832
19833  protected Patient.PatientCommunicationComponent parsePatientPatientCommunicationComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
19834    Patient.PatientCommunicationComponent res = new Patient.PatientCommunicationComponent();
19835    parsePatientPatientCommunicationComponentProperties(json, owner, res);
19836    return res;
19837  }
19838
19839  protected void parsePatientPatientCommunicationComponentProperties(JsonObject json, Patient owner, Patient.PatientCommunicationComponent res) throws IOException, FHIRFormatError {
19840    parseBackboneElementProperties(json, res);
19841    if (json.has("language"))
19842      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
19843    if (json.has("preferred"))
19844      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
19845    if (json.has("_preferred"))
19846      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
19847  }
19848
19849  protected Patient.PatientLinkComponent parsePatientPatientLinkComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
19850    Patient.PatientLinkComponent res = new Patient.PatientLinkComponent();
19851    parsePatientPatientLinkComponentProperties(json, owner, res);
19852    return res;
19853  }
19854
19855  protected void parsePatientPatientLinkComponentProperties(JsonObject json, Patient owner, Patient.PatientLinkComponent res) throws IOException, FHIRFormatError {
19856    parseBackboneElementProperties(json, res);
19857    if (json.has("other"))
19858      res.setOther(parseReference(json.getAsJsonObject("other")));
19859    if (json.has("type"))
19860      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Patient.LinkType.NULL, new Patient.LinkTypeEnumFactory()));
19861    if (json.has("_type"))
19862      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
19863  }
19864
19865  protected PaymentNotice parsePaymentNotice(JsonObject json) throws IOException, FHIRFormatError {
19866    PaymentNotice res = new PaymentNotice();
19867    parsePaymentNoticeProperties(json, res);
19868    return res;
19869  }
19870
19871  protected void parsePaymentNoticeProperties(JsonObject json, PaymentNotice res) throws IOException, FHIRFormatError {
19872    parseDomainResourceProperties(json, res);
19873    if (json.has("identifier")) {
19874      JsonArray array = json.getAsJsonArray("identifier");
19875      for (int i = 0; i < array.size(); i++) {
19876        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19877      }
19878    };
19879    if (json.has("status"))
19880      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), PaymentNotice.PaymentNoticeStatus.NULL, new PaymentNotice.PaymentNoticeStatusEnumFactory()));
19881    if (json.has("_status"))
19882      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19883    if (json.has("request"))
19884      res.setRequest(parseReference(json.getAsJsonObject("request")));
19885    if (json.has("response"))
19886      res.setResponse(parseReference(json.getAsJsonObject("response")));
19887    if (json.has("created"))
19888      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
19889    if (json.has("_created"))
19890      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
19891    if (json.has("provider"))
19892      res.setProvider(parseReference(json.getAsJsonObject("provider")));
19893    if (json.has("payment"))
19894      res.setPayment(parseReference(json.getAsJsonObject("payment")));
19895    if (json.has("paymentDate"))
19896      res.setPaymentDateElement(parseDate(json.get("paymentDate").getAsString()));
19897    if (json.has("_paymentDate"))
19898      parseElementProperties(json.getAsJsonObject("_paymentDate"), res.getPaymentDateElement());
19899    if (json.has("payee"))
19900      res.setPayee(parseReference(json.getAsJsonObject("payee")));
19901    if (json.has("recipient"))
19902      res.setRecipient(parseReference(json.getAsJsonObject("recipient")));
19903    if (json.has("amount"))
19904      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
19905    if (json.has("paymentStatus"))
19906      res.setPaymentStatus(parseCodeableConcept(json.getAsJsonObject("paymentStatus")));
19907  }
19908
19909  protected PaymentReconciliation parsePaymentReconciliation(JsonObject json) throws IOException, FHIRFormatError {
19910    PaymentReconciliation res = new PaymentReconciliation();
19911    parsePaymentReconciliationProperties(json, res);
19912    return res;
19913  }
19914
19915  protected void parsePaymentReconciliationProperties(JsonObject json, PaymentReconciliation res) throws IOException, FHIRFormatError {
19916    parseDomainResourceProperties(json, res);
19917    if (json.has("identifier")) {
19918      JsonArray array = json.getAsJsonArray("identifier");
19919      for (int i = 0; i < array.size(); i++) {
19920        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19921      }
19922    };
19923    if (json.has("status"))
19924      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), PaymentReconciliation.PaymentReconciliationStatus.NULL, new PaymentReconciliation.PaymentReconciliationStatusEnumFactory()));
19925    if (json.has("_status"))
19926      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19927    if (json.has("period"))
19928      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
19929    if (json.has("created"))
19930      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
19931    if (json.has("_created"))
19932      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
19933    if (json.has("paymentIssuer"))
19934      res.setPaymentIssuer(parseReference(json.getAsJsonObject("paymentIssuer")));
19935    if (json.has("request"))
19936      res.setRequest(parseReference(json.getAsJsonObject("request")));
19937    if (json.has("requestor"))
19938      res.setRequestor(parseReference(json.getAsJsonObject("requestor")));
19939    if (json.has("outcome"))
19940      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
19941    if (json.has("_outcome"))
19942      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
19943    if (json.has("disposition"))
19944      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
19945    if (json.has("_disposition"))
19946      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
19947    if (json.has("paymentDate"))
19948      res.setPaymentDateElement(parseDate(json.get("paymentDate").getAsString()));
19949    if (json.has("_paymentDate"))
19950      parseElementProperties(json.getAsJsonObject("_paymentDate"), res.getPaymentDateElement());
19951    if (json.has("paymentAmount"))
19952      res.setPaymentAmount(parseMoney(json.getAsJsonObject("paymentAmount")));
19953    if (json.has("paymentIdentifier"))
19954      res.setPaymentIdentifier(parseIdentifier(json.getAsJsonObject("paymentIdentifier")));
19955    if (json.has("detail")) {
19956      JsonArray array = json.getAsJsonArray("detail");
19957      for (int i = 0; i < array.size(); i++) {
19958        res.getDetail().add(parsePaymentReconciliationDetailsComponent(array.get(i).getAsJsonObject(), res));
19959      }
19960    };
19961    if (json.has("formCode"))
19962      res.setFormCode(parseCodeableConcept(json.getAsJsonObject("formCode")));
19963    if (json.has("processNote")) {
19964      JsonArray array = json.getAsJsonArray("processNote");
19965      for (int i = 0; i < array.size(); i++) {
19966        res.getProcessNote().add(parsePaymentReconciliationNotesComponent(array.get(i).getAsJsonObject(), res));
19967      }
19968    };
19969  }
19970
19971  protected PaymentReconciliation.DetailsComponent parsePaymentReconciliationDetailsComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
19972    PaymentReconciliation.DetailsComponent res = new PaymentReconciliation.DetailsComponent();
19973    parsePaymentReconciliationDetailsComponentProperties(json, owner, res);
19974    return res;
19975  }
19976
19977  protected void parsePaymentReconciliationDetailsComponentProperties(JsonObject json, PaymentReconciliation owner, PaymentReconciliation.DetailsComponent res) throws IOException, FHIRFormatError {
19978    parseBackboneElementProperties(json, res);
19979    if (json.has("identifier"))
19980      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
19981    if (json.has("predecessor"))
19982      res.setPredecessor(parseIdentifier(json.getAsJsonObject("predecessor")));
19983    if (json.has("type"))
19984      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
19985    if (json.has("request"))
19986      res.setRequest(parseReference(json.getAsJsonObject("request")));
19987    if (json.has("submitter"))
19988      res.setSubmitter(parseReference(json.getAsJsonObject("submitter")));
19989    if (json.has("response"))
19990      res.setResponse(parseReference(json.getAsJsonObject("response")));
19991    if (json.has("date"))
19992      res.setDateElement(parseDate(json.get("date").getAsString()));
19993    if (json.has("_date"))
19994      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
19995    if (json.has("responsible"))
19996      res.setResponsible(parseReference(json.getAsJsonObject("responsible")));
19997    if (json.has("payee"))
19998      res.setPayee(parseReference(json.getAsJsonObject("payee")));
19999    if (json.has("amount"))
20000      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
20001  }
20002
20003  protected PaymentReconciliation.NotesComponent parsePaymentReconciliationNotesComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
20004    PaymentReconciliation.NotesComponent res = new PaymentReconciliation.NotesComponent();
20005    parsePaymentReconciliationNotesComponentProperties(json, owner, res);
20006    return res;
20007  }
20008
20009  protected void parsePaymentReconciliationNotesComponentProperties(JsonObject json, PaymentReconciliation owner, PaymentReconciliation.NotesComponent res) throws IOException, FHIRFormatError {
20010    parseBackboneElementProperties(json, res);
20011    if (json.has("type"))
20012      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
20013    if (json.has("_type"))
20014      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
20015    if (json.has("text"))
20016      res.setTextElement(parseString(json.get("text").getAsString()));
20017    if (json.has("_text"))
20018      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
20019  }
20020
20021  protected Person parsePerson(JsonObject json) throws IOException, FHIRFormatError {
20022    Person res = new Person();
20023    parsePersonProperties(json, res);
20024    return res;
20025  }
20026
20027  protected void parsePersonProperties(JsonObject json, Person res) throws IOException, FHIRFormatError {
20028    parseDomainResourceProperties(json, res);
20029    if (json.has("identifier")) {
20030      JsonArray array = json.getAsJsonArray("identifier");
20031      for (int i = 0; i < array.size(); i++) {
20032        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20033      }
20034    };
20035    if (json.has("name")) {
20036      JsonArray array = json.getAsJsonArray("name");
20037      for (int i = 0; i < array.size(); i++) {
20038        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
20039      }
20040    };
20041    if (json.has("telecom")) {
20042      JsonArray array = json.getAsJsonArray("telecom");
20043      for (int i = 0; i < array.size(); i++) {
20044        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20045      }
20046    };
20047    if (json.has("gender"))
20048      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
20049    if (json.has("_gender"))
20050      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
20051    if (json.has("birthDate"))
20052      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
20053    if (json.has("_birthDate"))
20054      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
20055    if (json.has("address")) {
20056      JsonArray array = json.getAsJsonArray("address");
20057      for (int i = 0; i < array.size(); i++) {
20058        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
20059      }
20060    };
20061    if (json.has("photo"))
20062      res.setPhoto(parseAttachment(json.getAsJsonObject("photo")));
20063    if (json.has("managingOrganization"))
20064      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
20065    if (json.has("active"))
20066      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
20067    if (json.has("_active"))
20068      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
20069    if (json.has("link")) {
20070      JsonArray array = json.getAsJsonArray("link");
20071      for (int i = 0; i < array.size(); i++) {
20072        res.getLink().add(parsePersonPersonLinkComponent(array.get(i).getAsJsonObject(), res));
20073      }
20074    };
20075  }
20076
20077  protected Person.PersonLinkComponent parsePersonPersonLinkComponent(JsonObject json, Person owner) throws IOException, FHIRFormatError {
20078    Person.PersonLinkComponent res = new Person.PersonLinkComponent();
20079    parsePersonPersonLinkComponentProperties(json, owner, res);
20080    return res;
20081  }
20082
20083  protected void parsePersonPersonLinkComponentProperties(JsonObject json, Person owner, Person.PersonLinkComponent res) throws IOException, FHIRFormatError {
20084    parseBackboneElementProperties(json, res);
20085    if (json.has("target"))
20086      res.setTarget(parseReference(json.getAsJsonObject("target")));
20087    if (json.has("assurance"))
20088      res.setAssuranceElement(parseEnumeration(json.get("assurance").getAsString(), Person.IdentityAssuranceLevel.NULL, new Person.IdentityAssuranceLevelEnumFactory()));
20089    if (json.has("_assurance"))
20090      parseElementProperties(json.getAsJsonObject("_assurance"), res.getAssuranceElement());
20091  }
20092
20093  protected PlanDefinition parsePlanDefinition(JsonObject json) throws IOException, FHIRFormatError {
20094    PlanDefinition res = new PlanDefinition();
20095    parsePlanDefinitionProperties(json, res);
20096    return res;
20097  }
20098
20099  protected void parsePlanDefinitionProperties(JsonObject json, PlanDefinition res) throws IOException, FHIRFormatError {
20100    parseDomainResourceProperties(json, res);
20101    if (json.has("url"))
20102      res.setUrlElement(parseUri(json.get("url").getAsString()));
20103    if (json.has("_url"))
20104      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
20105    if (json.has("identifier")) {
20106      JsonArray array = json.getAsJsonArray("identifier");
20107      for (int i = 0; i < array.size(); i++) {
20108        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20109      }
20110    };
20111    if (json.has("version"))
20112      res.setVersionElement(parseString(json.get("version").getAsString()));
20113    if (json.has("_version"))
20114      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
20115    if (json.has("name"))
20116      res.setNameElement(parseString(json.get("name").getAsString()));
20117    if (json.has("_name"))
20118      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
20119    if (json.has("title"))
20120      res.setTitleElement(parseString(json.get("title").getAsString()));
20121    if (json.has("_title"))
20122      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
20123    if (json.has("subtitle"))
20124      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
20125    if (json.has("_subtitle"))
20126      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
20127    if (json.has("type"))
20128      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
20129    if (json.has("status"))
20130      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
20131    if (json.has("_status"))
20132      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
20133    if (json.has("experimental"))
20134      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
20135    if (json.has("_experimental"))
20136      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
20137    Type subject = parseType("subject", json);
20138    if (subject != null)
20139      res.setSubject(subject);
20140    if (json.has("date"))
20141      res.setDateElement(parseDateTime(json.get("date").getAsString()));
20142    if (json.has("_date"))
20143      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
20144    if (json.has("publisher"))
20145      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
20146    if (json.has("_publisher"))
20147      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
20148    if (json.has("contact")) {
20149      JsonArray array = json.getAsJsonArray("contact");
20150      for (int i = 0; i < array.size(); i++) {
20151        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
20152      }
20153    };
20154    if (json.has("description"))
20155      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
20156    if (json.has("_description"))
20157      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
20158    if (json.has("useContext")) {
20159      JsonArray array = json.getAsJsonArray("useContext");
20160      for (int i = 0; i < array.size(); i++) {
20161        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
20162      }
20163    };
20164    if (json.has("jurisdiction")) {
20165      JsonArray array = json.getAsJsonArray("jurisdiction");
20166      for (int i = 0; i < array.size(); i++) {
20167        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20168      }
20169    };
20170    if (json.has("purpose"))
20171      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
20172    if (json.has("_purpose"))
20173      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
20174    if (json.has("usage"))
20175      res.setUsageElement(parseString(json.get("usage").getAsString()));
20176    if (json.has("_usage"))
20177      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
20178    if (json.has("copyright"))
20179      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
20180    if (json.has("_copyright"))
20181      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
20182    if (json.has("approvalDate"))
20183      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
20184    if (json.has("_approvalDate"))
20185      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
20186    if (json.has("lastReviewDate"))
20187      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
20188    if (json.has("_lastReviewDate"))
20189      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
20190    if (json.has("effectivePeriod"))
20191      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
20192    if (json.has("topic")) {
20193      JsonArray array = json.getAsJsonArray("topic");
20194      for (int i = 0; i < array.size(); i++) {
20195        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20196      }
20197    };
20198    if (json.has("author")) {
20199      JsonArray array = json.getAsJsonArray("author");
20200      for (int i = 0; i < array.size(); i++) {
20201        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
20202      }
20203    };
20204    if (json.has("editor")) {
20205      JsonArray array = json.getAsJsonArray("editor");
20206      for (int i = 0; i < array.size(); i++) {
20207        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
20208      }
20209    };
20210    if (json.has("reviewer")) {
20211      JsonArray array = json.getAsJsonArray("reviewer");
20212      for (int i = 0; i < array.size(); i++) {
20213        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
20214      }
20215    };
20216    if (json.has("endorser")) {
20217      JsonArray array = json.getAsJsonArray("endorser");
20218      for (int i = 0; i < array.size(); i++) {
20219        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
20220      }
20221    };
20222    if (json.has("relatedArtifact")) {
20223      JsonArray array = json.getAsJsonArray("relatedArtifact");
20224      for (int i = 0; i < array.size(); i++) {
20225        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
20226      }
20227    };
20228    if (json.has("library")) {
20229      JsonArray array = json.getAsJsonArray("library");
20230      for (int i = 0; i < array.size(); i++) {
20231        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
20232      }
20233    };
20234    if (json.has("_library")) {
20235      JsonArray array = json.getAsJsonArray("_library");
20236      for (int i = 0; i < array.size(); i++) {
20237        if (i == res.getLibrary().size())
20238          res.getLibrary().add(parseCanonical(null));
20239        if (array.get(i) instanceof JsonObject) 
20240          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
20241      }
20242    };
20243    if (json.has("goal")) {
20244      JsonArray array = json.getAsJsonArray("goal");
20245      for (int i = 0; i < array.size(); i++) {
20246        res.getGoal().add(parsePlanDefinitionPlanDefinitionGoalComponent(array.get(i).getAsJsonObject(), res));
20247      }
20248    };
20249    if (json.has("action")) {
20250      JsonArray array = json.getAsJsonArray("action");
20251      for (int i = 0; i < array.size(); i++) {
20252        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(array.get(i).getAsJsonObject(), res));
20253      }
20254    };
20255  }
20256
20257  protected PlanDefinition.PlanDefinitionGoalComponent parsePlanDefinitionPlanDefinitionGoalComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20258    PlanDefinition.PlanDefinitionGoalComponent res = new PlanDefinition.PlanDefinitionGoalComponent();
20259    parsePlanDefinitionPlanDefinitionGoalComponentProperties(json, owner, res);
20260    return res;
20261  }
20262
20263  protected void parsePlanDefinitionPlanDefinitionGoalComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionGoalComponent res) throws IOException, FHIRFormatError {
20264    parseBackboneElementProperties(json, res);
20265    if (json.has("category"))
20266      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
20267    if (json.has("description"))
20268      res.setDescription(parseCodeableConcept(json.getAsJsonObject("description")));
20269    if (json.has("priority"))
20270      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
20271    if (json.has("start"))
20272      res.setStart(parseCodeableConcept(json.getAsJsonObject("start")));
20273    if (json.has("addresses")) {
20274      JsonArray array = json.getAsJsonArray("addresses");
20275      for (int i = 0; i < array.size(); i++) {
20276        res.getAddresses().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20277      }
20278    };
20279    if (json.has("documentation")) {
20280      JsonArray array = json.getAsJsonArray("documentation");
20281      for (int i = 0; i < array.size(); i++) {
20282        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
20283      }
20284    };
20285    if (json.has("target")) {
20286      JsonArray array = json.getAsJsonArray("target");
20287      for (int i = 0; i < array.size(); i++) {
20288        res.getTarget().add(parsePlanDefinitionPlanDefinitionGoalTargetComponent(array.get(i).getAsJsonObject(), owner));
20289      }
20290    };
20291  }
20292
20293  protected PlanDefinition.PlanDefinitionGoalTargetComponent parsePlanDefinitionPlanDefinitionGoalTargetComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20294    PlanDefinition.PlanDefinitionGoalTargetComponent res = new PlanDefinition.PlanDefinitionGoalTargetComponent();
20295    parsePlanDefinitionPlanDefinitionGoalTargetComponentProperties(json, owner, res);
20296    return res;
20297  }
20298
20299  protected void parsePlanDefinitionPlanDefinitionGoalTargetComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionGoalTargetComponent res) throws IOException, FHIRFormatError {
20300    parseBackboneElementProperties(json, res);
20301    if (json.has("measure"))
20302      res.setMeasure(parseCodeableConcept(json.getAsJsonObject("measure")));
20303    Type detail = parseType("detail", json);
20304    if (detail != null)
20305      res.setDetail(detail);
20306    if (json.has("due"))
20307      res.setDue(parseDuration(json.getAsJsonObject("due")));
20308  }
20309
20310  protected PlanDefinition.PlanDefinitionActionComponent parsePlanDefinitionPlanDefinitionActionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20311    PlanDefinition.PlanDefinitionActionComponent res = new PlanDefinition.PlanDefinitionActionComponent();
20312    parsePlanDefinitionPlanDefinitionActionComponentProperties(json, owner, res);
20313    return res;
20314  }
20315
20316  protected void parsePlanDefinitionPlanDefinitionActionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionComponent res) throws IOException, FHIRFormatError {
20317    parseBackboneElementProperties(json, res);
20318    if (json.has("prefix"))
20319      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
20320    if (json.has("_prefix"))
20321      parseElementProperties(json.getAsJsonObject("_prefix"), res.getPrefixElement());
20322    if (json.has("title"))
20323      res.setTitleElement(parseString(json.get("title").getAsString()));
20324    if (json.has("_title"))
20325      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
20326    if (json.has("description"))
20327      res.setDescriptionElement(parseString(json.get("description").getAsString()));
20328    if (json.has("_description"))
20329      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
20330    if (json.has("textEquivalent"))
20331      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
20332    if (json.has("_textEquivalent"))
20333      parseElementProperties(json.getAsJsonObject("_textEquivalent"), res.getTextEquivalentElement());
20334    if (json.has("priority"))
20335      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), PlanDefinition.RequestPriority.NULL, new PlanDefinition.RequestPriorityEnumFactory()));
20336    if (json.has("_priority"))
20337      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
20338    if (json.has("code")) {
20339      JsonArray array = json.getAsJsonArray("code");
20340      for (int i = 0; i < array.size(); i++) {
20341        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20342      }
20343    };
20344    if (json.has("reason")) {
20345      JsonArray array = json.getAsJsonArray("reason");
20346      for (int i = 0; i < array.size(); i++) {
20347        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20348      }
20349    };
20350    if (json.has("documentation")) {
20351      JsonArray array = json.getAsJsonArray("documentation");
20352      for (int i = 0; i < array.size(); i++) {
20353        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
20354      }
20355    };
20356    if (json.has("goalId")) {
20357      JsonArray array = json.getAsJsonArray("goalId");
20358      for (int i = 0; i < array.size(); i++) {
20359        res.getGoalId().add(parseId(array.get(i).getAsString()));
20360      }
20361    };
20362    if (json.has("_goalId")) {
20363      JsonArray array = json.getAsJsonArray("_goalId");
20364      for (int i = 0; i < array.size(); i++) {
20365        if (i == res.getGoalId().size())
20366          res.getGoalId().add(parseId(null));
20367        if (array.get(i) instanceof JsonObject) 
20368          parseElementProperties(array.get(i).getAsJsonObject(), res.getGoalId().get(i));
20369      }
20370    };
20371    Type subject = parseType("subject", json);
20372    if (subject != null)
20373      res.setSubject(subject);
20374    if (json.has("trigger")) {
20375      JsonArray array = json.getAsJsonArray("trigger");
20376      for (int i = 0; i < array.size(); i++) {
20377        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
20378      }
20379    };
20380    if (json.has("condition")) {
20381      JsonArray array = json.getAsJsonArray("condition");
20382      for (int i = 0; i < array.size(); i++) {
20383        res.getCondition().add(parsePlanDefinitionPlanDefinitionActionConditionComponent(array.get(i).getAsJsonObject(), owner));
20384      }
20385    };
20386    if (json.has("input")) {
20387      JsonArray array = json.getAsJsonArray("input");
20388      for (int i = 0; i < array.size(); i++) {
20389        res.getInput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
20390      }
20391    };
20392    if (json.has("output")) {
20393      JsonArray array = json.getAsJsonArray("output");
20394      for (int i = 0; i < array.size(); i++) {
20395        res.getOutput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
20396      }
20397    };
20398    if (json.has("relatedAction")) {
20399      JsonArray array = json.getAsJsonArray("relatedAction");
20400      for (int i = 0; i < array.size(); i++) {
20401        res.getRelatedAction().add(parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(array.get(i).getAsJsonObject(), owner));
20402      }
20403    };
20404    Type timing = parseType("timing", json);
20405    if (timing != null)
20406      res.setTiming(timing);
20407    if (json.has("participant")) {
20408      JsonArray array = json.getAsJsonArray("participant");
20409      for (int i = 0; i < array.size(); i++) {
20410        res.getParticipant().add(parsePlanDefinitionPlanDefinitionActionParticipantComponent(array.get(i).getAsJsonObject(), owner));
20411      }
20412    };
20413    if (json.has("type"))
20414      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
20415    if (json.has("groupingBehavior"))
20416      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), PlanDefinition.ActionGroupingBehavior.NULL, new PlanDefinition.ActionGroupingBehaviorEnumFactory()));
20417    if (json.has("_groupingBehavior"))
20418      parseElementProperties(json.getAsJsonObject("_groupingBehavior"), res.getGroupingBehaviorElement());
20419    if (json.has("selectionBehavior"))
20420      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), PlanDefinition.ActionSelectionBehavior.NULL, new PlanDefinition.ActionSelectionBehaviorEnumFactory()));
20421    if (json.has("_selectionBehavior"))
20422      parseElementProperties(json.getAsJsonObject("_selectionBehavior"), res.getSelectionBehaviorElement());
20423    if (json.has("requiredBehavior"))
20424      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), PlanDefinition.ActionRequiredBehavior.NULL, new PlanDefinition.ActionRequiredBehaviorEnumFactory()));
20425    if (json.has("_requiredBehavior"))
20426      parseElementProperties(json.getAsJsonObject("_requiredBehavior"), res.getRequiredBehaviorElement());
20427    if (json.has("precheckBehavior"))
20428      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), PlanDefinition.ActionPrecheckBehavior.NULL, new PlanDefinition.ActionPrecheckBehaviorEnumFactory()));
20429    if (json.has("_precheckBehavior"))
20430      parseElementProperties(json.getAsJsonObject("_precheckBehavior"), res.getPrecheckBehaviorElement());
20431    if (json.has("cardinalityBehavior"))
20432      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), PlanDefinition.ActionCardinalityBehavior.NULL, new PlanDefinition.ActionCardinalityBehaviorEnumFactory()));
20433    if (json.has("_cardinalityBehavior"))
20434      parseElementProperties(json.getAsJsonObject("_cardinalityBehavior"), res.getCardinalityBehaviorElement());
20435    Type definition = parseType("definition", json);
20436    if (definition != null)
20437      res.setDefinition(definition);
20438    if (json.has("transform"))
20439      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
20440    if (json.has("_transform"))
20441      parseElementProperties(json.getAsJsonObject("_transform"), res.getTransformElement());
20442    if (json.has("dynamicValue")) {
20443      JsonArray array = json.getAsJsonArray("dynamicValue");
20444      for (int i = 0; i < array.size(); i++) {
20445        res.getDynamicValue().add(parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(array.get(i).getAsJsonObject(), owner));
20446      }
20447    };
20448    if (json.has("action")) {
20449      JsonArray array = json.getAsJsonArray("action");
20450      for (int i = 0; i < array.size(); i++) {
20451        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(array.get(i).getAsJsonObject(), owner));
20452      }
20453    };
20454  }
20455
20456  protected PlanDefinition.PlanDefinitionActionConditionComponent parsePlanDefinitionPlanDefinitionActionConditionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20457    PlanDefinition.PlanDefinitionActionConditionComponent res = new PlanDefinition.PlanDefinitionActionConditionComponent();
20458    parsePlanDefinitionPlanDefinitionActionConditionComponentProperties(json, owner, res);
20459    return res;
20460  }
20461
20462  protected void parsePlanDefinitionPlanDefinitionActionConditionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionConditionComponent res) throws IOException, FHIRFormatError {
20463    parseBackboneElementProperties(json, res);
20464    if (json.has("kind"))
20465      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), PlanDefinition.ActionConditionKind.NULL, new PlanDefinition.ActionConditionKindEnumFactory()));
20466    if (json.has("_kind"))
20467      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
20468    if (json.has("expression"))
20469      res.setExpression(parseExpression(json.getAsJsonObject("expression")));
20470  }
20471
20472  protected PlanDefinition.PlanDefinitionActionRelatedActionComponent parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20473    PlanDefinition.PlanDefinitionActionRelatedActionComponent res = new PlanDefinition.PlanDefinitionActionRelatedActionComponent();
20474    parsePlanDefinitionPlanDefinitionActionRelatedActionComponentProperties(json, owner, res);
20475    return res;
20476  }
20477
20478  protected void parsePlanDefinitionPlanDefinitionActionRelatedActionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionRelatedActionComponent res) throws IOException, FHIRFormatError {
20479    parseBackboneElementProperties(json, res);
20480    if (json.has("actionId"))
20481      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
20482    if (json.has("_actionId"))
20483      parseElementProperties(json.getAsJsonObject("_actionId"), res.getActionIdElement());
20484    if (json.has("relationship"))
20485      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), PlanDefinition.ActionRelationshipType.NULL, new PlanDefinition.ActionRelationshipTypeEnumFactory()));
20486    if (json.has("_relationship"))
20487      parseElementProperties(json.getAsJsonObject("_relationship"), res.getRelationshipElement());
20488    Type offset = parseType("offset", json);
20489    if (offset != null)
20490      res.setOffset(offset);
20491  }
20492
20493  protected PlanDefinition.PlanDefinitionActionParticipantComponent parsePlanDefinitionPlanDefinitionActionParticipantComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20494    PlanDefinition.PlanDefinitionActionParticipantComponent res = new PlanDefinition.PlanDefinitionActionParticipantComponent();
20495    parsePlanDefinitionPlanDefinitionActionParticipantComponentProperties(json, owner, res);
20496    return res;
20497  }
20498
20499  protected void parsePlanDefinitionPlanDefinitionActionParticipantComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionParticipantComponent res) throws IOException, FHIRFormatError {
20500    parseBackboneElementProperties(json, res);
20501    if (json.has("type"))
20502      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), PlanDefinition.ActionParticipantType.NULL, new PlanDefinition.ActionParticipantTypeEnumFactory()));
20503    if (json.has("_type"))
20504      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
20505    if (json.has("role"))
20506      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
20507  }
20508
20509  protected PlanDefinition.PlanDefinitionActionDynamicValueComponent parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
20510    PlanDefinition.PlanDefinitionActionDynamicValueComponent res = new PlanDefinition.PlanDefinitionActionDynamicValueComponent();
20511    parsePlanDefinitionPlanDefinitionActionDynamicValueComponentProperties(json, owner, res);
20512    return res;
20513  }
20514
20515  protected void parsePlanDefinitionPlanDefinitionActionDynamicValueComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionDynamicValueComponent res) throws IOException, FHIRFormatError {
20516    parseBackboneElementProperties(json, res);
20517    if (json.has("path"))
20518      res.setPathElement(parseString(json.get("path").getAsString()));
20519    if (json.has("_path"))
20520      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
20521    if (json.has("expression"))
20522      res.setExpression(parseExpression(json.getAsJsonObject("expression")));
20523  }
20524
20525  protected Practitioner parsePractitioner(JsonObject json) throws IOException, FHIRFormatError {
20526    Practitioner res = new Practitioner();
20527    parsePractitionerProperties(json, res);
20528    return res;
20529  }
20530
20531  protected void parsePractitionerProperties(JsonObject json, Practitioner res) throws IOException, FHIRFormatError {
20532    parseDomainResourceProperties(json, res);
20533    if (json.has("identifier")) {
20534      JsonArray array = json.getAsJsonArray("identifier");
20535      for (int i = 0; i < array.size(); i++) {
20536        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20537      }
20538    };
20539    if (json.has("active"))
20540      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
20541    if (json.has("_active"))
20542      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
20543    if (json.has("name")) {
20544      JsonArray array = json.getAsJsonArray("name");
20545      for (int i = 0; i < array.size(); i++) {
20546        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
20547      }
20548    };
20549    if (json.has("telecom")) {
20550      JsonArray array = json.getAsJsonArray("telecom");
20551      for (int i = 0; i < array.size(); i++) {
20552        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20553      }
20554    };
20555    if (json.has("address")) {
20556      JsonArray array = json.getAsJsonArray("address");
20557      for (int i = 0; i < array.size(); i++) {
20558        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
20559      }
20560    };
20561    if (json.has("gender"))
20562      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
20563    if (json.has("_gender"))
20564      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
20565    if (json.has("birthDate"))
20566      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
20567    if (json.has("_birthDate"))
20568      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
20569    if (json.has("photo")) {
20570      JsonArray array = json.getAsJsonArray("photo");
20571      for (int i = 0; i < array.size(); i++) {
20572        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
20573      }
20574    };
20575    if (json.has("qualification")) {
20576      JsonArray array = json.getAsJsonArray("qualification");
20577      for (int i = 0; i < array.size(); i++) {
20578        res.getQualification().add(parsePractitionerPractitionerQualificationComponent(array.get(i).getAsJsonObject(), res));
20579      }
20580    };
20581    if (json.has("communication")) {
20582      JsonArray array = json.getAsJsonArray("communication");
20583      for (int i = 0; i < array.size(); i++) {
20584        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20585      }
20586    };
20587  }
20588
20589  protected Practitioner.PractitionerQualificationComponent parsePractitionerPractitionerQualificationComponent(JsonObject json, Practitioner owner) throws IOException, FHIRFormatError {
20590    Practitioner.PractitionerQualificationComponent res = new Practitioner.PractitionerQualificationComponent();
20591    parsePractitionerPractitionerQualificationComponentProperties(json, owner, res);
20592    return res;
20593  }
20594
20595  protected void parsePractitionerPractitionerQualificationComponentProperties(JsonObject json, Practitioner owner, Practitioner.PractitionerQualificationComponent res) throws IOException, FHIRFormatError {
20596    parseBackboneElementProperties(json, res);
20597    if (json.has("identifier")) {
20598      JsonArray array = json.getAsJsonArray("identifier");
20599      for (int i = 0; i < array.size(); i++) {
20600        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20601      }
20602    };
20603    if (json.has("code"))
20604      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
20605    if (json.has("period"))
20606      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
20607    if (json.has("issuer"))
20608      res.setIssuer(parseReference(json.getAsJsonObject("issuer")));
20609  }
20610
20611  protected PractitionerRole parsePractitionerRole(JsonObject json) throws IOException, FHIRFormatError {
20612    PractitionerRole res = new PractitionerRole();
20613    parsePractitionerRoleProperties(json, res);
20614    return res;
20615  }
20616
20617  protected void parsePractitionerRoleProperties(JsonObject json, PractitionerRole res) throws IOException, FHIRFormatError {
20618    parseDomainResourceProperties(json, res);
20619    if (json.has("identifier")) {
20620      JsonArray array = json.getAsJsonArray("identifier");
20621      for (int i = 0; i < array.size(); i++) {
20622        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20623      }
20624    };
20625    if (json.has("active"))
20626      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
20627    if (json.has("_active"))
20628      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
20629    if (json.has("period"))
20630      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
20631    if (json.has("practitioner"))
20632      res.setPractitioner(parseReference(json.getAsJsonObject("practitioner")));
20633    if (json.has("organization"))
20634      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
20635    if (json.has("code")) {
20636      JsonArray array = json.getAsJsonArray("code");
20637      for (int i = 0; i < array.size(); i++) {
20638        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20639      }
20640    };
20641    if (json.has("specialty")) {
20642      JsonArray array = json.getAsJsonArray("specialty");
20643      for (int i = 0; i < array.size(); i++) {
20644        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20645      }
20646    };
20647    if (json.has("location")) {
20648      JsonArray array = json.getAsJsonArray("location");
20649      for (int i = 0; i < array.size(); i++) {
20650        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
20651      }
20652    };
20653    if (json.has("healthcareService")) {
20654      JsonArray array = json.getAsJsonArray("healthcareService");
20655      for (int i = 0; i < array.size(); i++) {
20656        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
20657      }
20658    };
20659    if (json.has("telecom")) {
20660      JsonArray array = json.getAsJsonArray("telecom");
20661      for (int i = 0; i < array.size(); i++) {
20662        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20663      }
20664    };
20665    if (json.has("availableTime")) {
20666      JsonArray array = json.getAsJsonArray("availableTime");
20667      for (int i = 0; i < array.size(); i++) {
20668        res.getAvailableTime().add(parsePractitionerRolePractitionerRoleAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
20669      }
20670    };
20671    if (json.has("notAvailable")) {
20672      JsonArray array = json.getAsJsonArray("notAvailable");
20673      for (int i = 0; i < array.size(); i++) {
20674        res.getNotAvailable().add(parsePractitionerRolePractitionerRoleNotAvailableComponent(array.get(i).getAsJsonObject(), res));
20675      }
20676    };
20677    if (json.has("availabilityExceptions"))
20678      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
20679    if (json.has("_availabilityExceptions"))
20680      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
20681    if (json.has("endpoint")) {
20682      JsonArray array = json.getAsJsonArray("endpoint");
20683      for (int i = 0; i < array.size(); i++) {
20684        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
20685      }
20686    };
20687  }
20688
20689  protected PractitionerRole.PractitionerRoleAvailableTimeComponent parsePractitionerRolePractitionerRoleAvailableTimeComponent(JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
20690    PractitionerRole.PractitionerRoleAvailableTimeComponent res = new PractitionerRole.PractitionerRoleAvailableTimeComponent();
20691    parsePractitionerRolePractitionerRoleAvailableTimeComponentProperties(json, owner, res);
20692    return res;
20693  }
20694
20695  protected void parsePractitionerRolePractitionerRoleAvailableTimeComponentProperties(JsonObject json, PractitionerRole owner, PractitionerRole.PractitionerRoleAvailableTimeComponent res) throws IOException, FHIRFormatError {
20696    parseBackboneElementProperties(json, res);
20697    if (json.has("daysOfWeek")) {
20698      JsonArray array = json.getAsJsonArray("daysOfWeek");
20699      for (int i = 0; i < array.size(); i++) {
20700        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), PractitionerRole.DaysOfWeek.NULL, new PractitionerRole.DaysOfWeekEnumFactory()));
20701      }
20702    };
20703    if (json.has("_daysOfWeek")) {
20704      JsonArray array = json.getAsJsonArray("_daysOfWeek");
20705      for (int i = 0; i < array.size(); i++) {
20706        if (i == res.getDaysOfWeek().size())
20707          res.getDaysOfWeek().add(parseEnumeration(null, PractitionerRole.DaysOfWeek.NULL, new PractitionerRole.DaysOfWeekEnumFactory()));
20708        if (array.get(i) instanceof JsonObject) 
20709          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
20710      }
20711    };
20712    if (json.has("allDay"))
20713      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
20714    if (json.has("_allDay"))
20715      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
20716    if (json.has("availableStartTime"))
20717      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
20718    if (json.has("_availableStartTime"))
20719      parseElementProperties(json.getAsJsonObject("_availableStartTime"), res.getAvailableStartTimeElement());
20720    if (json.has("availableEndTime"))
20721      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
20722    if (json.has("_availableEndTime"))
20723      parseElementProperties(json.getAsJsonObject("_availableEndTime"), res.getAvailableEndTimeElement());
20724  }
20725
20726  protected PractitionerRole.PractitionerRoleNotAvailableComponent parsePractitionerRolePractitionerRoleNotAvailableComponent(JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
20727    PractitionerRole.PractitionerRoleNotAvailableComponent res = new PractitionerRole.PractitionerRoleNotAvailableComponent();
20728    parsePractitionerRolePractitionerRoleNotAvailableComponentProperties(json, owner, res);
20729    return res;
20730  }
20731
20732  protected void parsePractitionerRolePractitionerRoleNotAvailableComponentProperties(JsonObject json, PractitionerRole owner, PractitionerRole.PractitionerRoleNotAvailableComponent res) throws IOException, FHIRFormatError {
20733    parseBackboneElementProperties(json, res);
20734    if (json.has("description"))
20735      res.setDescriptionElement(parseString(json.get("description").getAsString()));
20736    if (json.has("_description"))
20737      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
20738    if (json.has("during"))
20739      res.setDuring(parsePeriod(json.getAsJsonObject("during")));
20740  }
20741
20742  protected Procedure parseProcedure(JsonObject json) throws IOException, FHIRFormatError {
20743    Procedure res = new Procedure();
20744    parseProcedureProperties(json, res);
20745    return res;
20746  }
20747
20748  protected void parseProcedureProperties(JsonObject json, Procedure res) throws IOException, FHIRFormatError {
20749    parseDomainResourceProperties(json, res);
20750    if (json.has("identifier")) {
20751      JsonArray array = json.getAsJsonArray("identifier");
20752      for (int i = 0; i < array.size(); i++) {
20753        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20754      }
20755    };
20756    if (json.has("instantiatesCanonical")) {
20757      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
20758      for (int i = 0; i < array.size(); i++) {
20759        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
20760      }
20761    };
20762    if (json.has("_instantiatesCanonical")) {
20763      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
20764      for (int i = 0; i < array.size(); i++) {
20765        if (i == res.getInstantiatesCanonical().size())
20766          res.getInstantiatesCanonical().add(parseCanonical(null));
20767        if (array.get(i) instanceof JsonObject) 
20768          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
20769      }
20770    };
20771    if (json.has("instantiatesUri")) {
20772      JsonArray array = json.getAsJsonArray("instantiatesUri");
20773      for (int i = 0; i < array.size(); i++) {
20774        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
20775      }
20776    };
20777    if (json.has("_instantiatesUri")) {
20778      JsonArray array = json.getAsJsonArray("_instantiatesUri");
20779      for (int i = 0; i < array.size(); i++) {
20780        if (i == res.getInstantiatesUri().size())
20781          res.getInstantiatesUri().add(parseUri(null));
20782        if (array.get(i) instanceof JsonObject) 
20783          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
20784      }
20785    };
20786    if (json.has("basedOn")) {
20787      JsonArray array = json.getAsJsonArray("basedOn");
20788      for (int i = 0; i < array.size(); i++) {
20789        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
20790      }
20791    };
20792    if (json.has("partOf")) {
20793      JsonArray array = json.getAsJsonArray("partOf");
20794      for (int i = 0; i < array.size(); i++) {
20795        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
20796      }
20797    };
20798    if (json.has("status"))
20799      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Procedure.ProcedureStatus.NULL, new Procedure.ProcedureStatusEnumFactory()));
20800    if (json.has("_status"))
20801      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
20802    if (json.has("statusReason"))
20803      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
20804    if (json.has("category"))
20805      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
20806    if (json.has("code"))
20807      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
20808    if (json.has("subject"))
20809      res.setSubject(parseReference(json.getAsJsonObject("subject")));
20810    if (json.has("encounter"))
20811      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
20812    Type performed = parseType("performed", json);
20813    if (performed != null)
20814      res.setPerformed(performed);
20815    if (json.has("recorder"))
20816      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
20817    if (json.has("asserter"))
20818      res.setAsserter(parseReference(json.getAsJsonObject("asserter")));
20819    if (json.has("performer")) {
20820      JsonArray array = json.getAsJsonArray("performer");
20821      for (int i = 0; i < array.size(); i++) {
20822        res.getPerformer().add(parseProcedureProcedurePerformerComponent(array.get(i).getAsJsonObject(), res));
20823      }
20824    };
20825    if (json.has("location"))
20826      res.setLocation(parseReference(json.getAsJsonObject("location")));
20827    if (json.has("reasonCode")) {
20828      JsonArray array = json.getAsJsonArray("reasonCode");
20829      for (int i = 0; i < array.size(); i++) {
20830        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20831      }
20832    };
20833    if (json.has("reasonReference")) {
20834      JsonArray array = json.getAsJsonArray("reasonReference");
20835      for (int i = 0; i < array.size(); i++) {
20836        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
20837      }
20838    };
20839    if (json.has("bodySite")) {
20840      JsonArray array = json.getAsJsonArray("bodySite");
20841      for (int i = 0; i < array.size(); i++) {
20842        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20843      }
20844    };
20845    if (json.has("outcome"))
20846      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
20847    if (json.has("report")) {
20848      JsonArray array = json.getAsJsonArray("report");
20849      for (int i = 0; i < array.size(); i++) {
20850        res.getReport().add(parseReference(array.get(i).getAsJsonObject()));
20851      }
20852    };
20853    if (json.has("complication")) {
20854      JsonArray array = json.getAsJsonArray("complication");
20855      for (int i = 0; i < array.size(); i++) {
20856        res.getComplication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20857      }
20858    };
20859    if (json.has("complicationDetail")) {
20860      JsonArray array = json.getAsJsonArray("complicationDetail");
20861      for (int i = 0; i < array.size(); i++) {
20862        res.getComplicationDetail().add(parseReference(array.get(i).getAsJsonObject()));
20863      }
20864    };
20865    if (json.has("followUp")) {
20866      JsonArray array = json.getAsJsonArray("followUp");
20867      for (int i = 0; i < array.size(); i++) {
20868        res.getFollowUp().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20869      }
20870    };
20871    if (json.has("note")) {
20872      JsonArray array = json.getAsJsonArray("note");
20873      for (int i = 0; i < array.size(); i++) {
20874        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
20875      }
20876    };
20877    if (json.has("focalDevice")) {
20878      JsonArray array = json.getAsJsonArray("focalDevice");
20879      for (int i = 0; i < array.size(); i++) {
20880        res.getFocalDevice().add(parseProcedureProcedureFocalDeviceComponent(array.get(i).getAsJsonObject(), res));
20881      }
20882    };
20883    if (json.has("usedReference")) {
20884      JsonArray array = json.getAsJsonArray("usedReference");
20885      for (int i = 0; i < array.size(); i++) {
20886        res.getUsedReference().add(parseReference(array.get(i).getAsJsonObject()));
20887      }
20888    };
20889    if (json.has("usedCode")) {
20890      JsonArray array = json.getAsJsonArray("usedCode");
20891      for (int i = 0; i < array.size(); i++) {
20892        res.getUsedCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20893      }
20894    };
20895  }
20896
20897  protected Procedure.ProcedurePerformerComponent parseProcedureProcedurePerformerComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
20898    Procedure.ProcedurePerformerComponent res = new Procedure.ProcedurePerformerComponent();
20899    parseProcedureProcedurePerformerComponentProperties(json, owner, res);
20900    return res;
20901  }
20902
20903  protected void parseProcedureProcedurePerformerComponentProperties(JsonObject json, Procedure owner, Procedure.ProcedurePerformerComponent res) throws IOException, FHIRFormatError {
20904    parseBackboneElementProperties(json, res);
20905    if (json.has("function"))
20906      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
20907    if (json.has("actor"))
20908      res.setActor(parseReference(json.getAsJsonObject("actor")));
20909    if (json.has("onBehalfOf"))
20910      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
20911  }
20912
20913  protected Procedure.ProcedureFocalDeviceComponent parseProcedureProcedureFocalDeviceComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
20914    Procedure.ProcedureFocalDeviceComponent res = new Procedure.ProcedureFocalDeviceComponent();
20915    parseProcedureProcedureFocalDeviceComponentProperties(json, owner, res);
20916    return res;
20917  }
20918
20919  protected void parseProcedureProcedureFocalDeviceComponentProperties(JsonObject json, Procedure owner, Procedure.ProcedureFocalDeviceComponent res) throws IOException, FHIRFormatError {
20920    parseBackboneElementProperties(json, res);
20921    if (json.has("action"))
20922      res.setAction(parseCodeableConcept(json.getAsJsonObject("action")));
20923    if (json.has("manipulated"))
20924      res.setManipulated(parseReference(json.getAsJsonObject("manipulated")));
20925  }
20926
20927  protected Provenance parseProvenance(JsonObject json) throws IOException, FHIRFormatError {
20928    Provenance res = new Provenance();
20929    parseProvenanceProperties(json, res);
20930    return res;
20931  }
20932
20933  protected void parseProvenanceProperties(JsonObject json, Provenance res) throws IOException, FHIRFormatError {
20934    parseDomainResourceProperties(json, res);
20935    if (json.has("target")) {
20936      JsonArray array = json.getAsJsonArray("target");
20937      for (int i = 0; i < array.size(); i++) {
20938        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
20939      }
20940    };
20941    Type occurred = parseType("occurred", json);
20942    if (occurred != null)
20943      res.setOccurred(occurred);
20944    if (json.has("recorded"))
20945      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
20946    if (json.has("_recorded"))
20947      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
20948    if (json.has("policy")) {
20949      JsonArray array = json.getAsJsonArray("policy");
20950      for (int i = 0; i < array.size(); i++) {
20951        res.getPolicy().add(parseUri(array.get(i).getAsString()));
20952      }
20953    };
20954    if (json.has("_policy")) {
20955      JsonArray array = json.getAsJsonArray("_policy");
20956      for (int i = 0; i < array.size(); i++) {
20957        if (i == res.getPolicy().size())
20958          res.getPolicy().add(parseUri(null));
20959        if (array.get(i) instanceof JsonObject) 
20960          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
20961      }
20962    };
20963    if (json.has("location"))
20964      res.setLocation(parseReference(json.getAsJsonObject("location")));
20965    if (json.has("reason")) {
20966      JsonArray array = json.getAsJsonArray("reason");
20967      for (int i = 0; i < array.size(); i++) {
20968        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20969      }
20970    };
20971    if (json.has("activity"))
20972      res.setActivity(parseCodeableConcept(json.getAsJsonObject("activity")));
20973    if (json.has("agent")) {
20974      JsonArray array = json.getAsJsonArray("agent");
20975      for (int i = 0; i < array.size(); i++) {
20976        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), res));
20977      }
20978    };
20979    if (json.has("entity")) {
20980      JsonArray array = json.getAsJsonArray("entity");
20981      for (int i = 0; i < array.size(); i++) {
20982        res.getEntity().add(parseProvenanceProvenanceEntityComponent(array.get(i).getAsJsonObject(), res));
20983      }
20984    };
20985    if (json.has("signature")) {
20986      JsonArray array = json.getAsJsonArray("signature");
20987      for (int i = 0; i < array.size(); i++) {
20988        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
20989      }
20990    };
20991  }
20992
20993  protected Provenance.ProvenanceAgentComponent parseProvenanceProvenanceAgentComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
20994    Provenance.ProvenanceAgentComponent res = new Provenance.ProvenanceAgentComponent();
20995    parseProvenanceProvenanceAgentComponentProperties(json, owner, res);
20996    return res;
20997  }
20998
20999  protected void parseProvenanceProvenanceAgentComponentProperties(JsonObject json, Provenance owner, Provenance.ProvenanceAgentComponent res) throws IOException, FHIRFormatError {
21000    parseBackboneElementProperties(json, res);
21001    if (json.has("type"))
21002      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
21003    if (json.has("role")) {
21004      JsonArray array = json.getAsJsonArray("role");
21005      for (int i = 0; i < array.size(); i++) {
21006        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21007      }
21008    };
21009    if (json.has("who"))
21010      res.setWho(parseReference(json.getAsJsonObject("who")));
21011    if (json.has("onBehalfOf"))
21012      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
21013  }
21014
21015  protected Provenance.ProvenanceEntityComponent parseProvenanceProvenanceEntityComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
21016    Provenance.ProvenanceEntityComponent res = new Provenance.ProvenanceEntityComponent();
21017    parseProvenanceProvenanceEntityComponentProperties(json, owner, res);
21018    return res;
21019  }
21020
21021  protected void parseProvenanceProvenanceEntityComponentProperties(JsonObject json, Provenance owner, Provenance.ProvenanceEntityComponent res) throws IOException, FHIRFormatError {
21022    parseBackboneElementProperties(json, res);
21023    if (json.has("role"))
21024      res.setRoleElement(parseEnumeration(json.get("role").getAsString(), Provenance.ProvenanceEntityRole.NULL, new Provenance.ProvenanceEntityRoleEnumFactory()));
21025    if (json.has("_role"))
21026      parseElementProperties(json.getAsJsonObject("_role"), res.getRoleElement());
21027    if (json.has("what"))
21028      res.setWhat(parseReference(json.getAsJsonObject("what")));
21029    if (json.has("agent")) {
21030      JsonArray array = json.getAsJsonArray("agent");
21031      for (int i = 0; i < array.size(); i++) {
21032        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), owner));
21033      }
21034    };
21035  }
21036
21037  protected Questionnaire parseQuestionnaire(JsonObject json) throws IOException, FHIRFormatError {
21038    Questionnaire res = new Questionnaire();
21039    parseQuestionnaireProperties(json, res);
21040    return res;
21041  }
21042
21043  protected void parseQuestionnaireProperties(JsonObject json, Questionnaire res) throws IOException, FHIRFormatError {
21044    parseDomainResourceProperties(json, res);
21045    if (json.has("url"))
21046      res.setUrlElement(parseUri(json.get("url").getAsString()));
21047    if (json.has("_url"))
21048      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
21049    if (json.has("identifier")) {
21050      JsonArray array = json.getAsJsonArray("identifier");
21051      for (int i = 0; i < array.size(); i++) {
21052        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21053      }
21054    };
21055    if (json.has("version"))
21056      res.setVersionElement(parseString(json.get("version").getAsString()));
21057    if (json.has("_version"))
21058      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
21059    if (json.has("name"))
21060      res.setNameElement(parseString(json.get("name").getAsString()));
21061    if (json.has("_name"))
21062      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
21063    if (json.has("title"))
21064      res.setTitleElement(parseString(json.get("title").getAsString()));
21065    if (json.has("_title"))
21066      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
21067    if (json.has("derivedFrom")) {
21068      JsonArray array = json.getAsJsonArray("derivedFrom");
21069      for (int i = 0; i < array.size(); i++) {
21070        res.getDerivedFrom().add(parseCanonical(array.get(i).getAsString()));
21071      }
21072    };
21073    if (json.has("_derivedFrom")) {
21074      JsonArray array = json.getAsJsonArray("_derivedFrom");
21075      for (int i = 0; i < array.size(); i++) {
21076        if (i == res.getDerivedFrom().size())
21077          res.getDerivedFrom().add(parseCanonical(null));
21078        if (array.get(i) instanceof JsonObject) 
21079          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFrom().get(i));
21080      }
21081    };
21082    if (json.has("status"))
21083      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
21084    if (json.has("_status"))
21085      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
21086    if (json.has("experimental"))
21087      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
21088    if (json.has("_experimental"))
21089      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
21090    if (json.has("subjectType")) {
21091      JsonArray array = json.getAsJsonArray("subjectType");
21092      for (int i = 0; i < array.size(); i++) {
21093        res.getSubjectType().add(parseCode(array.get(i).getAsString()));
21094      }
21095    };
21096    if (json.has("_subjectType")) {
21097      JsonArray array = json.getAsJsonArray("_subjectType");
21098      for (int i = 0; i < array.size(); i++) {
21099        if (i == res.getSubjectType().size())
21100          res.getSubjectType().add(parseCode(null));
21101        if (array.get(i) instanceof JsonObject) 
21102          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubjectType().get(i));
21103      }
21104    };
21105    if (json.has("date"))
21106      res.setDateElement(parseDateTime(json.get("date").getAsString()));
21107    if (json.has("_date"))
21108      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
21109    if (json.has("publisher"))
21110      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
21111    if (json.has("_publisher"))
21112      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
21113    if (json.has("contact")) {
21114      JsonArray array = json.getAsJsonArray("contact");
21115      for (int i = 0; i < array.size(); i++) {
21116        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
21117      }
21118    };
21119    if (json.has("description"))
21120      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
21121    if (json.has("_description"))
21122      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
21123    if (json.has("useContext")) {
21124      JsonArray array = json.getAsJsonArray("useContext");
21125      for (int i = 0; i < array.size(); i++) {
21126        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
21127      }
21128    };
21129    if (json.has("jurisdiction")) {
21130      JsonArray array = json.getAsJsonArray("jurisdiction");
21131      for (int i = 0; i < array.size(); i++) {
21132        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21133      }
21134    };
21135    if (json.has("purpose"))
21136      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
21137    if (json.has("_purpose"))
21138      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
21139    if (json.has("copyright"))
21140      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
21141    if (json.has("_copyright"))
21142      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
21143    if (json.has("approvalDate"))
21144      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
21145    if (json.has("_approvalDate"))
21146      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
21147    if (json.has("lastReviewDate"))
21148      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
21149    if (json.has("_lastReviewDate"))
21150      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
21151    if (json.has("effectivePeriod"))
21152      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
21153    if (json.has("code")) {
21154      JsonArray array = json.getAsJsonArray("code");
21155      for (int i = 0; i < array.size(); i++) {
21156        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
21157      }
21158    };
21159    if (json.has("item")) {
21160      JsonArray array = json.getAsJsonArray("item");
21161      for (int i = 0; i < array.size(); i++) {
21162        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), res));
21163      }
21164    };
21165  }
21166
21167  protected Questionnaire.QuestionnaireItemComponent parseQuestionnaireQuestionnaireItemComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
21168    Questionnaire.QuestionnaireItemComponent res = new Questionnaire.QuestionnaireItemComponent();
21169    parseQuestionnaireQuestionnaireItemComponentProperties(json, owner, res);
21170    return res;
21171  }
21172
21173  protected void parseQuestionnaireQuestionnaireItemComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemComponent res) throws IOException, FHIRFormatError {
21174    parseBackboneElementProperties(json, res);
21175    if (json.has("linkId"))
21176      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
21177    if (json.has("_linkId"))
21178      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
21179    if (json.has("definition"))
21180      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
21181    if (json.has("_definition"))
21182      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
21183    if (json.has("code")) {
21184      JsonArray array = json.getAsJsonArray("code");
21185      for (int i = 0; i < array.size(); i++) {
21186        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
21187      }
21188    };
21189    if (json.has("prefix"))
21190      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
21191    if (json.has("_prefix"))
21192      parseElementProperties(json.getAsJsonObject("_prefix"), res.getPrefixElement());
21193    if (json.has("text"))
21194      res.setTextElement(parseString(json.get("text").getAsString()));
21195    if (json.has("_text"))
21196      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
21197    if (json.has("type"))
21198      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Questionnaire.QuestionnaireItemType.NULL, new Questionnaire.QuestionnaireItemTypeEnumFactory()));
21199    if (json.has("_type"))
21200      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
21201    if (json.has("enableWhen")) {
21202      JsonArray array = json.getAsJsonArray("enableWhen");
21203      for (int i = 0; i < array.size(); i++) {
21204        res.getEnableWhen().add(parseQuestionnaireQuestionnaireItemEnableWhenComponent(array.get(i).getAsJsonObject(), owner));
21205      }
21206    };
21207    if (json.has("enableBehavior"))
21208      res.setEnableBehaviorElement(parseEnumeration(json.get("enableBehavior").getAsString(), Questionnaire.EnableWhenBehavior.NULL, new Questionnaire.EnableWhenBehaviorEnumFactory()));
21209    if (json.has("_enableBehavior"))
21210      parseElementProperties(json.getAsJsonObject("_enableBehavior"), res.getEnableBehaviorElement());
21211    if (json.has("required"))
21212      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
21213    if (json.has("_required"))
21214      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
21215    if (json.has("repeats"))
21216      res.setRepeatsElement(parseBoolean(json.get("repeats").getAsBoolean()));
21217    if (json.has("_repeats"))
21218      parseElementProperties(json.getAsJsonObject("_repeats"), res.getRepeatsElement());
21219    if (json.has("readOnly"))
21220      res.setReadOnlyElement(parseBoolean(json.get("readOnly").getAsBoolean()));
21221    if (json.has("_readOnly"))
21222      parseElementProperties(json.getAsJsonObject("_readOnly"), res.getReadOnlyElement());
21223    if (json.has("maxLength"))
21224      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
21225    if (json.has("_maxLength"))
21226      parseElementProperties(json.getAsJsonObject("_maxLength"), res.getMaxLengthElement());
21227    if (json.has("answerValueSet"))
21228      res.setAnswerValueSetElement(parseCanonical(json.get("answerValueSet").getAsString()));
21229    if (json.has("_answerValueSet"))
21230      parseElementProperties(json.getAsJsonObject("_answerValueSet"), res.getAnswerValueSetElement());
21231    if (json.has("answerOption")) {
21232      JsonArray array = json.getAsJsonArray("answerOption");
21233      for (int i = 0; i < array.size(); i++) {
21234        res.getAnswerOption().add(parseQuestionnaireQuestionnaireItemAnswerOptionComponent(array.get(i).getAsJsonObject(), owner));
21235      }
21236    };
21237    if (json.has("initial")) {
21238      JsonArray array = json.getAsJsonArray("initial");
21239      for (int i = 0; i < array.size(); i++) {
21240        res.getInitial().add(parseQuestionnaireQuestionnaireItemInitialComponent(array.get(i).getAsJsonObject(), owner));
21241      }
21242    };
21243    if (json.has("item")) {
21244      JsonArray array = json.getAsJsonArray("item");
21245      for (int i = 0; i < array.size(); i++) {
21246        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), owner));
21247      }
21248    };
21249  }
21250
21251  protected Questionnaire.QuestionnaireItemEnableWhenComponent parseQuestionnaireQuestionnaireItemEnableWhenComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
21252    Questionnaire.QuestionnaireItemEnableWhenComponent res = new Questionnaire.QuestionnaireItemEnableWhenComponent();
21253    parseQuestionnaireQuestionnaireItemEnableWhenComponentProperties(json, owner, res);
21254    return res;
21255  }
21256
21257  protected void parseQuestionnaireQuestionnaireItemEnableWhenComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemEnableWhenComponent res) throws IOException, FHIRFormatError {
21258    parseBackboneElementProperties(json, res);
21259    if (json.has("question"))
21260      res.setQuestionElement(parseString(json.get("question").getAsString()));
21261    if (json.has("_question"))
21262      parseElementProperties(json.getAsJsonObject("_question"), res.getQuestionElement());
21263    if (json.has("operator"))
21264      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), Questionnaire.QuestionnaireItemOperator.NULL, new Questionnaire.QuestionnaireItemOperatorEnumFactory()));
21265    if (json.has("_operator"))
21266      parseElementProperties(json.getAsJsonObject("_operator"), res.getOperatorElement());
21267    Type answer = parseType("answer", json);
21268    if (answer != null)
21269      res.setAnswer(answer);
21270  }
21271
21272  protected Questionnaire.QuestionnaireItemAnswerOptionComponent parseQuestionnaireQuestionnaireItemAnswerOptionComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
21273    Questionnaire.QuestionnaireItemAnswerOptionComponent res = new Questionnaire.QuestionnaireItemAnswerOptionComponent();
21274    parseQuestionnaireQuestionnaireItemAnswerOptionComponentProperties(json, owner, res);
21275    return res;
21276  }
21277
21278  protected void parseQuestionnaireQuestionnaireItemAnswerOptionComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemAnswerOptionComponent res) throws IOException, FHIRFormatError {
21279    parseBackboneElementProperties(json, res);
21280    Type value = parseType("value", json);
21281    if (value != null)
21282      res.setValue(value);
21283    if (json.has("initialSelected"))
21284      res.setInitialSelectedElement(parseBoolean(json.get("initialSelected").getAsBoolean()));
21285    if (json.has("_initialSelected"))
21286      parseElementProperties(json.getAsJsonObject("_initialSelected"), res.getInitialSelectedElement());
21287  }
21288
21289  protected Questionnaire.QuestionnaireItemInitialComponent parseQuestionnaireQuestionnaireItemInitialComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
21290    Questionnaire.QuestionnaireItemInitialComponent res = new Questionnaire.QuestionnaireItemInitialComponent();
21291    parseQuestionnaireQuestionnaireItemInitialComponentProperties(json, owner, res);
21292    return res;
21293  }
21294
21295  protected void parseQuestionnaireQuestionnaireItemInitialComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemInitialComponent res) throws IOException, FHIRFormatError {
21296    parseBackboneElementProperties(json, res);
21297    Type value = parseType("value", json);
21298    if (value != null)
21299      res.setValue(value);
21300  }
21301
21302  protected QuestionnaireResponse parseQuestionnaireResponse(JsonObject json) throws IOException, FHIRFormatError {
21303    QuestionnaireResponse res = new QuestionnaireResponse();
21304    parseQuestionnaireResponseProperties(json, res);
21305    return res;
21306  }
21307
21308  protected void parseQuestionnaireResponseProperties(JsonObject json, QuestionnaireResponse res) throws IOException, FHIRFormatError {
21309    parseDomainResourceProperties(json, res);
21310    if (json.has("identifier"))
21311      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
21312    if (json.has("basedOn")) {
21313      JsonArray array = json.getAsJsonArray("basedOn");
21314      for (int i = 0; i < array.size(); i++) {
21315        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
21316      }
21317    };
21318    if (json.has("partOf")) {
21319      JsonArray array = json.getAsJsonArray("partOf");
21320      for (int i = 0; i < array.size(); i++) {
21321        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
21322      }
21323    };
21324    if (json.has("questionnaire"))
21325      res.setQuestionnaireElement(parseCanonical(json.get("questionnaire").getAsString()));
21326    if (json.has("_questionnaire"))
21327      parseElementProperties(json.getAsJsonObject("_questionnaire"), res.getQuestionnaireElement());
21328    if (json.has("status"))
21329      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), QuestionnaireResponse.QuestionnaireResponseStatus.NULL, new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory()));
21330    if (json.has("_status"))
21331      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
21332    if (json.has("subject"))
21333      res.setSubject(parseReference(json.getAsJsonObject("subject")));
21334    if (json.has("encounter"))
21335      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
21336    if (json.has("authored"))
21337      res.setAuthoredElement(parseDateTime(json.get("authored").getAsString()));
21338    if (json.has("_authored"))
21339      parseElementProperties(json.getAsJsonObject("_authored"), res.getAuthoredElement());
21340    if (json.has("author"))
21341      res.setAuthor(parseReference(json.getAsJsonObject("author")));
21342    if (json.has("source"))
21343      res.setSource(parseReference(json.getAsJsonObject("source")));
21344    if (json.has("item")) {
21345      JsonArray array = json.getAsJsonArray("item");
21346      for (int i = 0; i < array.size(); i++) {
21347        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), res));
21348      }
21349    };
21350  }
21351
21352  protected QuestionnaireResponse.QuestionnaireResponseItemComponent parseQuestionnaireResponseQuestionnaireResponseItemComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
21353    QuestionnaireResponse.QuestionnaireResponseItemComponent res = new QuestionnaireResponse.QuestionnaireResponseItemComponent();
21354    parseQuestionnaireResponseQuestionnaireResponseItemComponentProperties(json, owner, res);
21355    return res;
21356  }
21357
21358  protected void parseQuestionnaireResponseQuestionnaireResponseItemComponentProperties(JsonObject json, QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemComponent res) throws IOException, FHIRFormatError {
21359    parseBackboneElementProperties(json, res);
21360    if (json.has("linkId"))
21361      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
21362    if (json.has("_linkId"))
21363      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
21364    if (json.has("definition"))
21365      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
21366    if (json.has("_definition"))
21367      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
21368    if (json.has("text"))
21369      res.setTextElement(parseString(json.get("text").getAsString()));
21370    if (json.has("_text"))
21371      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
21372    if (json.has("answer")) {
21373      JsonArray array = json.getAsJsonArray("answer");
21374      for (int i = 0; i < array.size(); i++) {
21375        res.getAnswer().add(parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(array.get(i).getAsJsonObject(), owner));
21376      }
21377    };
21378    if (json.has("item")) {
21379      JsonArray array = json.getAsJsonArray("item");
21380      for (int i = 0; i < array.size(); i++) {
21381        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
21382      }
21383    };
21384  }
21385
21386  protected QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
21387    QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res = new QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent();
21388    parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentProperties(json, owner, res);
21389    return res;
21390  }
21391
21392  protected void parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentProperties(JsonObject json, QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res) throws IOException, FHIRFormatError {
21393    parseBackboneElementProperties(json, res);
21394    Type value = parseType("value", json);
21395    if (value != null)
21396      res.setValue(value);
21397    if (json.has("item")) {
21398      JsonArray array = json.getAsJsonArray("item");
21399      for (int i = 0; i < array.size(); i++) {
21400        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
21401      }
21402    };
21403  }
21404
21405  protected RelatedPerson parseRelatedPerson(JsonObject json) throws IOException, FHIRFormatError {
21406    RelatedPerson res = new RelatedPerson();
21407    parseRelatedPersonProperties(json, res);
21408    return res;
21409  }
21410
21411  protected void parseRelatedPersonProperties(JsonObject json, RelatedPerson res) throws IOException, FHIRFormatError {
21412    parseDomainResourceProperties(json, res);
21413    if (json.has("identifier")) {
21414      JsonArray array = json.getAsJsonArray("identifier");
21415      for (int i = 0; i < array.size(); i++) {
21416        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21417      }
21418    };
21419    if (json.has("active"))
21420      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
21421    if (json.has("_active"))
21422      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
21423    if (json.has("patient"))
21424      res.setPatient(parseReference(json.getAsJsonObject("patient")));
21425    if (json.has("relationship")) {
21426      JsonArray array = json.getAsJsonArray("relationship");
21427      for (int i = 0; i < array.size(); i++) {
21428        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21429      }
21430    };
21431    if (json.has("name")) {
21432      JsonArray array = json.getAsJsonArray("name");
21433      for (int i = 0; i < array.size(); i++) {
21434        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
21435      }
21436    };
21437    if (json.has("telecom")) {
21438      JsonArray array = json.getAsJsonArray("telecom");
21439      for (int i = 0; i < array.size(); i++) {
21440        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
21441      }
21442    };
21443    if (json.has("gender"))
21444      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
21445    if (json.has("_gender"))
21446      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
21447    if (json.has("birthDate"))
21448      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
21449    if (json.has("_birthDate"))
21450      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
21451    if (json.has("address")) {
21452      JsonArray array = json.getAsJsonArray("address");
21453      for (int i = 0; i < array.size(); i++) {
21454        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
21455      }
21456    };
21457    if (json.has("photo")) {
21458      JsonArray array = json.getAsJsonArray("photo");
21459      for (int i = 0; i < array.size(); i++) {
21460        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
21461      }
21462    };
21463    if (json.has("period"))
21464      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
21465    if (json.has("communication")) {
21466      JsonArray array = json.getAsJsonArray("communication");
21467      for (int i = 0; i < array.size(); i++) {
21468        res.getCommunication().add(parseRelatedPersonRelatedPersonCommunicationComponent(array.get(i).getAsJsonObject(), res));
21469      }
21470    };
21471  }
21472
21473  protected RelatedPerson.RelatedPersonCommunicationComponent parseRelatedPersonRelatedPersonCommunicationComponent(JsonObject json, RelatedPerson owner) throws IOException, FHIRFormatError {
21474    RelatedPerson.RelatedPersonCommunicationComponent res = new RelatedPerson.RelatedPersonCommunicationComponent();
21475    parseRelatedPersonRelatedPersonCommunicationComponentProperties(json, owner, res);
21476    return res;
21477  }
21478
21479  protected void parseRelatedPersonRelatedPersonCommunicationComponentProperties(JsonObject json, RelatedPerson owner, RelatedPerson.RelatedPersonCommunicationComponent res) throws IOException, FHIRFormatError {
21480    parseBackboneElementProperties(json, res);
21481    if (json.has("language"))
21482      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
21483    if (json.has("preferred"))
21484      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
21485    if (json.has("_preferred"))
21486      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
21487  }
21488
21489  protected RequestGroup parseRequestGroup(JsonObject json) throws IOException, FHIRFormatError {
21490    RequestGroup res = new RequestGroup();
21491    parseRequestGroupProperties(json, res);
21492    return res;
21493  }
21494
21495  protected void parseRequestGroupProperties(JsonObject json, RequestGroup res) throws IOException, FHIRFormatError {
21496    parseDomainResourceProperties(json, res);
21497    if (json.has("identifier")) {
21498      JsonArray array = json.getAsJsonArray("identifier");
21499      for (int i = 0; i < array.size(); i++) {
21500        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21501      }
21502    };
21503    if (json.has("instantiatesCanonical")) {
21504      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
21505      for (int i = 0; i < array.size(); i++) {
21506        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
21507      }
21508    };
21509    if (json.has("_instantiatesCanonical")) {
21510      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
21511      for (int i = 0; i < array.size(); i++) {
21512        if (i == res.getInstantiatesCanonical().size())
21513          res.getInstantiatesCanonical().add(parseCanonical(null));
21514        if (array.get(i) instanceof JsonObject) 
21515          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
21516      }
21517    };
21518    if (json.has("instantiatesUri")) {
21519      JsonArray array = json.getAsJsonArray("instantiatesUri");
21520      for (int i = 0; i < array.size(); i++) {
21521        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
21522      }
21523    };
21524    if (json.has("_instantiatesUri")) {
21525      JsonArray array = json.getAsJsonArray("_instantiatesUri");
21526      for (int i = 0; i < array.size(); i++) {
21527        if (i == res.getInstantiatesUri().size())
21528          res.getInstantiatesUri().add(parseUri(null));
21529        if (array.get(i) instanceof JsonObject) 
21530          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
21531      }
21532    };
21533    if (json.has("basedOn")) {
21534      JsonArray array = json.getAsJsonArray("basedOn");
21535      for (int i = 0; i < array.size(); i++) {
21536        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
21537      }
21538    };
21539    if (json.has("replaces")) {
21540      JsonArray array = json.getAsJsonArray("replaces");
21541      for (int i = 0; i < array.size(); i++) {
21542        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
21543      }
21544    };
21545    if (json.has("groupIdentifier"))
21546      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
21547    if (json.has("status"))
21548      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), RequestGroup.RequestStatus.NULL, new RequestGroup.RequestStatusEnumFactory()));
21549    if (json.has("_status"))
21550      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
21551    if (json.has("intent"))
21552      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), RequestGroup.RequestIntent.NULL, new RequestGroup.RequestIntentEnumFactory()));
21553    if (json.has("_intent"))
21554      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
21555    if (json.has("priority"))
21556      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), RequestGroup.RequestPriority.NULL, new RequestGroup.RequestPriorityEnumFactory()));
21557    if (json.has("_priority"))
21558      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
21559    if (json.has("code"))
21560      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
21561    if (json.has("subject"))
21562      res.setSubject(parseReference(json.getAsJsonObject("subject")));
21563    if (json.has("encounter"))
21564      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
21565    if (json.has("authoredOn"))
21566      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
21567    if (json.has("_authoredOn"))
21568      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
21569    if (json.has("author"))
21570      res.setAuthor(parseReference(json.getAsJsonObject("author")));
21571    if (json.has("reasonCode")) {
21572      JsonArray array = json.getAsJsonArray("reasonCode");
21573      for (int i = 0; i < array.size(); i++) {
21574        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21575      }
21576    };
21577    if (json.has("reasonReference")) {
21578      JsonArray array = json.getAsJsonArray("reasonReference");
21579      for (int i = 0; i < array.size(); i++) {
21580        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
21581      }
21582    };
21583    if (json.has("note")) {
21584      JsonArray array = json.getAsJsonArray("note");
21585      for (int i = 0; i < array.size(); i++) {
21586        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
21587      }
21588    };
21589    if (json.has("action")) {
21590      JsonArray array = json.getAsJsonArray("action");
21591      for (int i = 0; i < array.size(); i++) {
21592        res.getAction().add(parseRequestGroupRequestGroupActionComponent(array.get(i).getAsJsonObject(), res));
21593      }
21594    };
21595  }
21596
21597  protected RequestGroup.RequestGroupActionComponent parseRequestGroupRequestGroupActionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
21598    RequestGroup.RequestGroupActionComponent res = new RequestGroup.RequestGroupActionComponent();
21599    parseRequestGroupRequestGroupActionComponentProperties(json, owner, res);
21600    return res;
21601  }
21602
21603  protected void parseRequestGroupRequestGroupActionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionComponent res) throws IOException, FHIRFormatError {
21604    parseBackboneElementProperties(json, res);
21605    if (json.has("prefix"))
21606      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
21607    if (json.has("_prefix"))
21608      parseElementProperties(json.getAsJsonObject("_prefix"), res.getPrefixElement());
21609    if (json.has("title"))
21610      res.setTitleElement(parseString(json.get("title").getAsString()));
21611    if (json.has("_title"))
21612      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
21613    if (json.has("description"))
21614      res.setDescriptionElement(parseString(json.get("description").getAsString()));
21615    if (json.has("_description"))
21616      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
21617    if (json.has("textEquivalent"))
21618      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
21619    if (json.has("_textEquivalent"))
21620      parseElementProperties(json.getAsJsonObject("_textEquivalent"), res.getTextEquivalentElement());
21621    if (json.has("priority"))
21622      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), RequestGroup.RequestPriority.NULL, new RequestGroup.RequestPriorityEnumFactory()));
21623    if (json.has("_priority"))
21624      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
21625    if (json.has("code")) {
21626      JsonArray array = json.getAsJsonArray("code");
21627      for (int i = 0; i < array.size(); i++) {
21628        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21629      }
21630    };
21631    if (json.has("documentation")) {
21632      JsonArray array = json.getAsJsonArray("documentation");
21633      for (int i = 0; i < array.size(); i++) {
21634        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
21635      }
21636    };
21637    if (json.has("condition")) {
21638      JsonArray array = json.getAsJsonArray("condition");
21639      for (int i = 0; i < array.size(); i++) {
21640        res.getCondition().add(parseRequestGroupRequestGroupActionConditionComponent(array.get(i).getAsJsonObject(), owner));
21641      }
21642    };
21643    if (json.has("relatedAction")) {
21644      JsonArray array = json.getAsJsonArray("relatedAction");
21645      for (int i = 0; i < array.size(); i++) {
21646        res.getRelatedAction().add(parseRequestGroupRequestGroupActionRelatedActionComponent(array.get(i).getAsJsonObject(), owner));
21647      }
21648    };
21649    Type timing = parseType("timing", json);
21650    if (timing != null)
21651      res.setTiming(timing);
21652    if (json.has("participant")) {
21653      JsonArray array = json.getAsJsonArray("participant");
21654      for (int i = 0; i < array.size(); i++) {
21655        res.getParticipant().add(parseReference(array.get(i).getAsJsonObject()));
21656      }
21657    };
21658    if (json.has("type"))
21659      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
21660    if (json.has("groupingBehavior"))
21661      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), RequestGroup.ActionGroupingBehavior.NULL, new RequestGroup.ActionGroupingBehaviorEnumFactory()));
21662    if (json.has("_groupingBehavior"))
21663      parseElementProperties(json.getAsJsonObject("_groupingBehavior"), res.getGroupingBehaviorElement());
21664    if (json.has("selectionBehavior"))
21665      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), RequestGroup.ActionSelectionBehavior.NULL, new RequestGroup.ActionSelectionBehaviorEnumFactory()));
21666    if (json.has("_selectionBehavior"))
21667      parseElementProperties(json.getAsJsonObject("_selectionBehavior"), res.getSelectionBehaviorElement());
21668    if (json.has("requiredBehavior"))
21669      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), RequestGroup.ActionRequiredBehavior.NULL, new RequestGroup.ActionRequiredBehaviorEnumFactory()));
21670    if (json.has("_requiredBehavior"))
21671      parseElementProperties(json.getAsJsonObject("_requiredBehavior"), res.getRequiredBehaviorElement());
21672    if (json.has("precheckBehavior"))
21673      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), RequestGroup.ActionPrecheckBehavior.NULL, new RequestGroup.ActionPrecheckBehaviorEnumFactory()));
21674    if (json.has("_precheckBehavior"))
21675      parseElementProperties(json.getAsJsonObject("_precheckBehavior"), res.getPrecheckBehaviorElement());
21676    if (json.has("cardinalityBehavior"))
21677      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), RequestGroup.ActionCardinalityBehavior.NULL, new RequestGroup.ActionCardinalityBehaviorEnumFactory()));
21678    if (json.has("_cardinalityBehavior"))
21679      parseElementProperties(json.getAsJsonObject("_cardinalityBehavior"), res.getCardinalityBehaviorElement());
21680    if (json.has("resource"))
21681      res.setResource(parseReference(json.getAsJsonObject("resource")));
21682    if (json.has("action")) {
21683      JsonArray array = json.getAsJsonArray("action");
21684      for (int i = 0; i < array.size(); i++) {
21685        res.getAction().add(parseRequestGroupRequestGroupActionComponent(array.get(i).getAsJsonObject(), owner));
21686      }
21687    };
21688  }
21689
21690  protected RequestGroup.RequestGroupActionConditionComponent parseRequestGroupRequestGroupActionConditionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
21691    RequestGroup.RequestGroupActionConditionComponent res = new RequestGroup.RequestGroupActionConditionComponent();
21692    parseRequestGroupRequestGroupActionConditionComponentProperties(json, owner, res);
21693    return res;
21694  }
21695
21696  protected void parseRequestGroupRequestGroupActionConditionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionConditionComponent res) throws IOException, FHIRFormatError {
21697    parseBackboneElementProperties(json, res);
21698    if (json.has("kind"))
21699      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), RequestGroup.ActionConditionKind.NULL, new RequestGroup.ActionConditionKindEnumFactory()));
21700    if (json.has("_kind"))
21701      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
21702    if (json.has("expression"))
21703      res.setExpression(parseExpression(json.getAsJsonObject("expression")));
21704  }
21705
21706  protected RequestGroup.RequestGroupActionRelatedActionComponent parseRequestGroupRequestGroupActionRelatedActionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
21707    RequestGroup.RequestGroupActionRelatedActionComponent res = new RequestGroup.RequestGroupActionRelatedActionComponent();
21708    parseRequestGroupRequestGroupActionRelatedActionComponentProperties(json, owner, res);
21709    return res;
21710  }
21711
21712  protected void parseRequestGroupRequestGroupActionRelatedActionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionRelatedActionComponent res) throws IOException, FHIRFormatError {
21713    parseBackboneElementProperties(json, res);
21714    if (json.has("actionId"))
21715      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
21716    if (json.has("_actionId"))
21717      parseElementProperties(json.getAsJsonObject("_actionId"), res.getActionIdElement());
21718    if (json.has("relationship"))
21719      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), RequestGroup.ActionRelationshipType.NULL, new RequestGroup.ActionRelationshipTypeEnumFactory()));
21720    if (json.has("_relationship"))
21721      parseElementProperties(json.getAsJsonObject("_relationship"), res.getRelationshipElement());
21722    Type offset = parseType("offset", json);
21723    if (offset != null)
21724      res.setOffset(offset);
21725  }
21726
21727  protected ResearchDefinition parseResearchDefinition(JsonObject json) throws IOException, FHIRFormatError {
21728    ResearchDefinition res = new ResearchDefinition();
21729    parseResearchDefinitionProperties(json, res);
21730    return res;
21731  }
21732
21733  protected void parseResearchDefinitionProperties(JsonObject json, ResearchDefinition res) throws IOException, FHIRFormatError {
21734    parseDomainResourceProperties(json, res);
21735    if (json.has("url"))
21736      res.setUrlElement(parseUri(json.get("url").getAsString()));
21737    if (json.has("_url"))
21738      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
21739    if (json.has("identifier")) {
21740      JsonArray array = json.getAsJsonArray("identifier");
21741      for (int i = 0; i < array.size(); i++) {
21742        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21743      }
21744    };
21745    if (json.has("version"))
21746      res.setVersionElement(parseString(json.get("version").getAsString()));
21747    if (json.has("_version"))
21748      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
21749    if (json.has("name"))
21750      res.setNameElement(parseString(json.get("name").getAsString()));
21751    if (json.has("_name"))
21752      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
21753    if (json.has("title"))
21754      res.setTitleElement(parseString(json.get("title").getAsString()));
21755    if (json.has("_title"))
21756      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
21757    if (json.has("shortTitle"))
21758      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
21759    if (json.has("_shortTitle"))
21760      parseElementProperties(json.getAsJsonObject("_shortTitle"), res.getShortTitleElement());
21761    if (json.has("subtitle"))
21762      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
21763    if (json.has("_subtitle"))
21764      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
21765    if (json.has("status"))
21766      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
21767    if (json.has("_status"))
21768      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
21769    if (json.has("experimental"))
21770      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
21771    if (json.has("_experimental"))
21772      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
21773    Type subject = parseType("subject", json);
21774    if (subject != null)
21775      res.setSubject(subject);
21776    if (json.has("date"))
21777      res.setDateElement(parseDateTime(json.get("date").getAsString()));
21778    if (json.has("_date"))
21779      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
21780    if (json.has("publisher"))
21781      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
21782    if (json.has("_publisher"))
21783      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
21784    if (json.has("contact")) {
21785      JsonArray array = json.getAsJsonArray("contact");
21786      for (int i = 0; i < array.size(); i++) {
21787        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
21788      }
21789    };
21790    if (json.has("description"))
21791      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
21792    if (json.has("_description"))
21793      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
21794    if (json.has("comment")) {
21795      JsonArray array = json.getAsJsonArray("comment");
21796      for (int i = 0; i < array.size(); i++) {
21797        res.getComment().add(parseString(array.get(i).getAsString()));
21798      }
21799    };
21800    if (json.has("_comment")) {
21801      JsonArray array = json.getAsJsonArray("_comment");
21802      for (int i = 0; i < array.size(); i++) {
21803        if (i == res.getComment().size())
21804          res.getComment().add(parseString(null));
21805        if (array.get(i) instanceof JsonObject) 
21806          parseElementProperties(array.get(i).getAsJsonObject(), res.getComment().get(i));
21807      }
21808    };
21809    if (json.has("useContext")) {
21810      JsonArray array = json.getAsJsonArray("useContext");
21811      for (int i = 0; i < array.size(); i++) {
21812        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
21813      }
21814    };
21815    if (json.has("jurisdiction")) {
21816      JsonArray array = json.getAsJsonArray("jurisdiction");
21817      for (int i = 0; i < array.size(); i++) {
21818        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21819      }
21820    };
21821    if (json.has("purpose"))
21822      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
21823    if (json.has("_purpose"))
21824      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
21825    if (json.has("usage"))
21826      res.setUsageElement(parseString(json.get("usage").getAsString()));
21827    if (json.has("_usage"))
21828      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
21829    if (json.has("copyright"))
21830      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
21831    if (json.has("_copyright"))
21832      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
21833    if (json.has("approvalDate"))
21834      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
21835    if (json.has("_approvalDate"))
21836      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
21837    if (json.has("lastReviewDate"))
21838      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
21839    if (json.has("_lastReviewDate"))
21840      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
21841    if (json.has("effectivePeriod"))
21842      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
21843    if (json.has("topic")) {
21844      JsonArray array = json.getAsJsonArray("topic");
21845      for (int i = 0; i < array.size(); i++) {
21846        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21847      }
21848    };
21849    if (json.has("author")) {
21850      JsonArray array = json.getAsJsonArray("author");
21851      for (int i = 0; i < array.size(); i++) {
21852        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
21853      }
21854    };
21855    if (json.has("editor")) {
21856      JsonArray array = json.getAsJsonArray("editor");
21857      for (int i = 0; i < array.size(); i++) {
21858        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
21859      }
21860    };
21861    if (json.has("reviewer")) {
21862      JsonArray array = json.getAsJsonArray("reviewer");
21863      for (int i = 0; i < array.size(); i++) {
21864        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
21865      }
21866    };
21867    if (json.has("endorser")) {
21868      JsonArray array = json.getAsJsonArray("endorser");
21869      for (int i = 0; i < array.size(); i++) {
21870        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
21871      }
21872    };
21873    if (json.has("relatedArtifact")) {
21874      JsonArray array = json.getAsJsonArray("relatedArtifact");
21875      for (int i = 0; i < array.size(); i++) {
21876        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
21877      }
21878    };
21879    if (json.has("library")) {
21880      JsonArray array = json.getAsJsonArray("library");
21881      for (int i = 0; i < array.size(); i++) {
21882        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
21883      }
21884    };
21885    if (json.has("_library")) {
21886      JsonArray array = json.getAsJsonArray("_library");
21887      for (int i = 0; i < array.size(); i++) {
21888        if (i == res.getLibrary().size())
21889          res.getLibrary().add(parseCanonical(null));
21890        if (array.get(i) instanceof JsonObject) 
21891          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
21892      }
21893    };
21894    if (json.has("population"))
21895      res.setPopulation(parseReference(json.getAsJsonObject("population")));
21896    if (json.has("exposure"))
21897      res.setExposure(parseReference(json.getAsJsonObject("exposure")));
21898    if (json.has("exposureAlternative"))
21899      res.setExposureAlternative(parseReference(json.getAsJsonObject("exposureAlternative")));
21900    if (json.has("outcome"))
21901      res.setOutcome(parseReference(json.getAsJsonObject("outcome")));
21902  }
21903
21904  protected ResearchElementDefinition parseResearchElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
21905    ResearchElementDefinition res = new ResearchElementDefinition();
21906    parseResearchElementDefinitionProperties(json, res);
21907    return res;
21908  }
21909
21910  protected void parseResearchElementDefinitionProperties(JsonObject json, ResearchElementDefinition res) throws IOException, FHIRFormatError {
21911    parseDomainResourceProperties(json, res);
21912    if (json.has("url"))
21913      res.setUrlElement(parseUri(json.get("url").getAsString()));
21914    if (json.has("_url"))
21915      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
21916    if (json.has("identifier")) {
21917      JsonArray array = json.getAsJsonArray("identifier");
21918      for (int i = 0; i < array.size(); i++) {
21919        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21920      }
21921    };
21922    if (json.has("version"))
21923      res.setVersionElement(parseString(json.get("version").getAsString()));
21924    if (json.has("_version"))
21925      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
21926    if (json.has("name"))
21927      res.setNameElement(parseString(json.get("name").getAsString()));
21928    if (json.has("_name"))
21929      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
21930    if (json.has("title"))
21931      res.setTitleElement(parseString(json.get("title").getAsString()));
21932    if (json.has("_title"))
21933      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
21934    if (json.has("shortTitle"))
21935      res.setShortTitleElement(parseString(json.get("shortTitle").getAsString()));
21936    if (json.has("_shortTitle"))
21937      parseElementProperties(json.getAsJsonObject("_shortTitle"), res.getShortTitleElement());
21938    if (json.has("subtitle"))
21939      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
21940    if (json.has("_subtitle"))
21941      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
21942    if (json.has("status"))
21943      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
21944    if (json.has("_status"))
21945      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
21946    if (json.has("experimental"))
21947      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
21948    if (json.has("_experimental"))
21949      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
21950    Type subject = parseType("subject", json);
21951    if (subject != null)
21952      res.setSubject(subject);
21953    if (json.has("date"))
21954      res.setDateElement(parseDateTime(json.get("date").getAsString()));
21955    if (json.has("_date"))
21956      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
21957    if (json.has("publisher"))
21958      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
21959    if (json.has("_publisher"))
21960      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
21961    if (json.has("contact")) {
21962      JsonArray array = json.getAsJsonArray("contact");
21963      for (int i = 0; i < array.size(); i++) {
21964        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
21965      }
21966    };
21967    if (json.has("description"))
21968      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
21969    if (json.has("_description"))
21970      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
21971    if (json.has("comment")) {
21972      JsonArray array = json.getAsJsonArray("comment");
21973      for (int i = 0; i < array.size(); i++) {
21974        res.getComment().add(parseString(array.get(i).getAsString()));
21975      }
21976    };
21977    if (json.has("_comment")) {
21978      JsonArray array = json.getAsJsonArray("_comment");
21979      for (int i = 0; i < array.size(); i++) {
21980        if (i == res.getComment().size())
21981          res.getComment().add(parseString(null));
21982        if (array.get(i) instanceof JsonObject) 
21983          parseElementProperties(array.get(i).getAsJsonObject(), res.getComment().get(i));
21984      }
21985    };
21986    if (json.has("useContext")) {
21987      JsonArray array = json.getAsJsonArray("useContext");
21988      for (int i = 0; i < array.size(); i++) {
21989        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
21990      }
21991    };
21992    if (json.has("jurisdiction")) {
21993      JsonArray array = json.getAsJsonArray("jurisdiction");
21994      for (int i = 0; i < array.size(); i++) {
21995        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21996      }
21997    };
21998    if (json.has("purpose"))
21999      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
22000    if (json.has("_purpose"))
22001      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
22002    if (json.has("usage"))
22003      res.setUsageElement(parseString(json.get("usage").getAsString()));
22004    if (json.has("_usage"))
22005      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
22006    if (json.has("copyright"))
22007      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
22008    if (json.has("_copyright"))
22009      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
22010    if (json.has("approvalDate"))
22011      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
22012    if (json.has("_approvalDate"))
22013      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
22014    if (json.has("lastReviewDate"))
22015      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
22016    if (json.has("_lastReviewDate"))
22017      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
22018    if (json.has("effectivePeriod"))
22019      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
22020    if (json.has("topic")) {
22021      JsonArray array = json.getAsJsonArray("topic");
22022      for (int i = 0; i < array.size(); i++) {
22023        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22024      }
22025    };
22026    if (json.has("author")) {
22027      JsonArray array = json.getAsJsonArray("author");
22028      for (int i = 0; i < array.size(); i++) {
22029        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
22030      }
22031    };
22032    if (json.has("editor")) {
22033      JsonArray array = json.getAsJsonArray("editor");
22034      for (int i = 0; i < array.size(); i++) {
22035        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
22036      }
22037    };
22038    if (json.has("reviewer")) {
22039      JsonArray array = json.getAsJsonArray("reviewer");
22040      for (int i = 0; i < array.size(); i++) {
22041        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
22042      }
22043    };
22044    if (json.has("endorser")) {
22045      JsonArray array = json.getAsJsonArray("endorser");
22046      for (int i = 0; i < array.size(); i++) {
22047        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
22048      }
22049    };
22050    if (json.has("relatedArtifact")) {
22051      JsonArray array = json.getAsJsonArray("relatedArtifact");
22052      for (int i = 0; i < array.size(); i++) {
22053        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
22054      }
22055    };
22056    if (json.has("library")) {
22057      JsonArray array = json.getAsJsonArray("library");
22058      for (int i = 0; i < array.size(); i++) {
22059        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
22060      }
22061    };
22062    if (json.has("_library")) {
22063      JsonArray array = json.getAsJsonArray("_library");
22064      for (int i = 0; i < array.size(); i++) {
22065        if (i == res.getLibrary().size())
22066          res.getLibrary().add(parseCanonical(null));
22067        if (array.get(i) instanceof JsonObject) 
22068          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
22069      }
22070    };
22071    if (json.has("type"))
22072      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ResearchElementDefinition.ResearchElementType.NULL, new ResearchElementDefinition.ResearchElementTypeEnumFactory()));
22073    if (json.has("_type"))
22074      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
22075    if (json.has("variableType"))
22076      res.setVariableTypeElement(parseEnumeration(json.get("variableType").getAsString(), ResearchElementDefinition.VariableType.NULL, new ResearchElementDefinition.VariableTypeEnumFactory()));
22077    if (json.has("_variableType"))
22078      parseElementProperties(json.getAsJsonObject("_variableType"), res.getVariableTypeElement());
22079    if (json.has("characteristic")) {
22080      JsonArray array = json.getAsJsonArray("characteristic");
22081      for (int i = 0; i < array.size(); i++) {
22082        res.getCharacteristic().add(parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponent(array.get(i).getAsJsonObject(), res));
22083      }
22084    };
22085  }
22086
22087  protected ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponent(JsonObject json, ResearchElementDefinition owner) throws IOException, FHIRFormatError {
22088    ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent res = new ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent();
22089    parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponentProperties(json, owner, res);
22090    return res;
22091  }
22092
22093  protected void parseResearchElementDefinitionResearchElementDefinitionCharacteristicComponentProperties(JsonObject json, ResearchElementDefinition owner, ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent res) throws IOException, FHIRFormatError {
22094    parseBackboneElementProperties(json, res);
22095    Type definition = parseType("definition", json);
22096    if (definition != null)
22097      res.setDefinition(definition);
22098    if (json.has("usageContext")) {
22099      JsonArray array = json.getAsJsonArray("usageContext");
22100      for (int i = 0; i < array.size(); i++) {
22101        res.getUsageContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
22102      }
22103    };
22104    if (json.has("exclude"))
22105      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
22106    if (json.has("_exclude"))
22107      parseElementProperties(json.getAsJsonObject("_exclude"), res.getExcludeElement());
22108    if (json.has("unitOfMeasure"))
22109      res.setUnitOfMeasure(parseCodeableConcept(json.getAsJsonObject("unitOfMeasure")));
22110    if (json.has("studyEffectiveDescription"))
22111      res.setStudyEffectiveDescriptionElement(parseString(json.get("studyEffectiveDescription").getAsString()));
22112    if (json.has("_studyEffectiveDescription"))
22113      parseElementProperties(json.getAsJsonObject("_studyEffectiveDescription"), res.getStudyEffectiveDescriptionElement());
22114    Type studyEffective = parseType("studyEffective", json);
22115    if (studyEffective != null)
22116      res.setStudyEffective(studyEffective);
22117    if (json.has("studyEffectiveTimeFromStart"))
22118      res.setStudyEffectiveTimeFromStart(parseDuration(json.getAsJsonObject("studyEffectiveTimeFromStart")));
22119    if (json.has("studyEffectiveGroupMeasure"))
22120      res.setStudyEffectiveGroupMeasureElement(parseEnumeration(json.get("studyEffectiveGroupMeasure").getAsString(), ResearchElementDefinition.GroupMeasure.NULL, new ResearchElementDefinition.GroupMeasureEnumFactory()));
22121    if (json.has("_studyEffectiveGroupMeasure"))
22122      parseElementProperties(json.getAsJsonObject("_studyEffectiveGroupMeasure"), res.getStudyEffectiveGroupMeasureElement());
22123    if (json.has("participantEffectiveDescription"))
22124      res.setParticipantEffectiveDescriptionElement(parseString(json.get("participantEffectiveDescription").getAsString()));
22125    if (json.has("_participantEffectiveDescription"))
22126      parseElementProperties(json.getAsJsonObject("_participantEffectiveDescription"), res.getParticipantEffectiveDescriptionElement());
22127    Type participantEffective = parseType("participantEffective", json);
22128    if (participantEffective != null)
22129      res.setParticipantEffective(participantEffective);
22130    if (json.has("participantEffectiveTimeFromStart"))
22131      res.setParticipantEffectiveTimeFromStart(parseDuration(json.getAsJsonObject("participantEffectiveTimeFromStart")));
22132    if (json.has("participantEffectiveGroupMeasure"))
22133      res.setParticipantEffectiveGroupMeasureElement(parseEnumeration(json.get("participantEffectiveGroupMeasure").getAsString(), ResearchElementDefinition.GroupMeasure.NULL, new ResearchElementDefinition.GroupMeasureEnumFactory()));
22134    if (json.has("_participantEffectiveGroupMeasure"))
22135      parseElementProperties(json.getAsJsonObject("_participantEffectiveGroupMeasure"), res.getParticipantEffectiveGroupMeasureElement());
22136  }
22137
22138  protected ResearchStudy parseResearchStudy(JsonObject json) throws IOException, FHIRFormatError {
22139    ResearchStudy res = new ResearchStudy();
22140    parseResearchStudyProperties(json, res);
22141    return res;
22142  }
22143
22144  protected void parseResearchStudyProperties(JsonObject json, ResearchStudy res) throws IOException, FHIRFormatError {
22145    parseDomainResourceProperties(json, res);
22146    if (json.has("identifier")) {
22147      JsonArray array = json.getAsJsonArray("identifier");
22148      for (int i = 0; i < array.size(); i++) {
22149        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22150      }
22151    };
22152    if (json.has("title"))
22153      res.setTitleElement(parseString(json.get("title").getAsString()));
22154    if (json.has("_title"))
22155      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
22156    if (json.has("protocol")) {
22157      JsonArray array = json.getAsJsonArray("protocol");
22158      for (int i = 0; i < array.size(); i++) {
22159        res.getProtocol().add(parseReference(array.get(i).getAsJsonObject()));
22160      }
22161    };
22162    if (json.has("partOf")) {
22163      JsonArray array = json.getAsJsonArray("partOf");
22164      for (int i = 0; i < array.size(); i++) {
22165        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
22166      }
22167    };
22168    if (json.has("status"))
22169      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchStudy.ResearchStudyStatus.NULL, new ResearchStudy.ResearchStudyStatusEnumFactory()));
22170    if (json.has("_status"))
22171      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22172    if (json.has("primaryPurposeType"))
22173      res.setPrimaryPurposeType(parseCodeableConcept(json.getAsJsonObject("primaryPurposeType")));
22174    if (json.has("phase"))
22175      res.setPhase(parseCodeableConcept(json.getAsJsonObject("phase")));
22176    if (json.has("category")) {
22177      JsonArray array = json.getAsJsonArray("category");
22178      for (int i = 0; i < array.size(); i++) {
22179        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22180      }
22181    };
22182    if (json.has("focus")) {
22183      JsonArray array = json.getAsJsonArray("focus");
22184      for (int i = 0; i < array.size(); i++) {
22185        res.getFocus().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22186      }
22187    };
22188    if (json.has("condition")) {
22189      JsonArray array = json.getAsJsonArray("condition");
22190      for (int i = 0; i < array.size(); i++) {
22191        res.getCondition().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22192      }
22193    };
22194    if (json.has("contact")) {
22195      JsonArray array = json.getAsJsonArray("contact");
22196      for (int i = 0; i < array.size(); i++) {
22197        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
22198      }
22199    };
22200    if (json.has("relatedArtifact")) {
22201      JsonArray array = json.getAsJsonArray("relatedArtifact");
22202      for (int i = 0; i < array.size(); i++) {
22203        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
22204      }
22205    };
22206    if (json.has("keyword")) {
22207      JsonArray array = json.getAsJsonArray("keyword");
22208      for (int i = 0; i < array.size(); i++) {
22209        res.getKeyword().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22210      }
22211    };
22212    if (json.has("location")) {
22213      JsonArray array = json.getAsJsonArray("location");
22214      for (int i = 0; i < array.size(); i++) {
22215        res.getLocation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22216      }
22217    };
22218    if (json.has("description"))
22219      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
22220    if (json.has("_description"))
22221      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22222    if (json.has("enrollment")) {
22223      JsonArray array = json.getAsJsonArray("enrollment");
22224      for (int i = 0; i < array.size(); i++) {
22225        res.getEnrollment().add(parseReference(array.get(i).getAsJsonObject()));
22226      }
22227    };
22228    if (json.has("period"))
22229      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
22230    if (json.has("sponsor"))
22231      res.setSponsor(parseReference(json.getAsJsonObject("sponsor")));
22232    if (json.has("principalInvestigator"))
22233      res.setPrincipalInvestigator(parseReference(json.getAsJsonObject("principalInvestigator")));
22234    if (json.has("site")) {
22235      JsonArray array = json.getAsJsonArray("site");
22236      for (int i = 0; i < array.size(); i++) {
22237        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
22238      }
22239    };
22240    if (json.has("reasonStopped"))
22241      res.setReasonStopped(parseCodeableConcept(json.getAsJsonObject("reasonStopped")));
22242    if (json.has("note")) {
22243      JsonArray array = json.getAsJsonArray("note");
22244      for (int i = 0; i < array.size(); i++) {
22245        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22246      }
22247    };
22248    if (json.has("arm")) {
22249      JsonArray array = json.getAsJsonArray("arm");
22250      for (int i = 0; i < array.size(); i++) {
22251        res.getArm().add(parseResearchStudyResearchStudyArmComponent(array.get(i).getAsJsonObject(), res));
22252      }
22253    };
22254    if (json.has("objective")) {
22255      JsonArray array = json.getAsJsonArray("objective");
22256      for (int i = 0; i < array.size(); i++) {
22257        res.getObjective().add(parseResearchStudyResearchStudyObjectiveComponent(array.get(i).getAsJsonObject(), res));
22258      }
22259    };
22260  }
22261
22262  protected ResearchStudy.ResearchStudyArmComponent parseResearchStudyResearchStudyArmComponent(JsonObject json, ResearchStudy owner) throws IOException, FHIRFormatError {
22263    ResearchStudy.ResearchStudyArmComponent res = new ResearchStudy.ResearchStudyArmComponent();
22264    parseResearchStudyResearchStudyArmComponentProperties(json, owner, res);
22265    return res;
22266  }
22267
22268  protected void parseResearchStudyResearchStudyArmComponentProperties(JsonObject json, ResearchStudy owner, ResearchStudy.ResearchStudyArmComponent res) throws IOException, FHIRFormatError {
22269    parseBackboneElementProperties(json, res);
22270    if (json.has("name"))
22271      res.setNameElement(parseString(json.get("name").getAsString()));
22272    if (json.has("_name"))
22273      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
22274    if (json.has("type"))
22275      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22276    if (json.has("description"))
22277      res.setDescriptionElement(parseString(json.get("description").getAsString()));
22278    if (json.has("_description"))
22279      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22280  }
22281
22282  protected ResearchStudy.ResearchStudyObjectiveComponent parseResearchStudyResearchStudyObjectiveComponent(JsonObject json, ResearchStudy owner) throws IOException, FHIRFormatError {
22283    ResearchStudy.ResearchStudyObjectiveComponent res = new ResearchStudy.ResearchStudyObjectiveComponent();
22284    parseResearchStudyResearchStudyObjectiveComponentProperties(json, owner, res);
22285    return res;
22286  }
22287
22288  protected void parseResearchStudyResearchStudyObjectiveComponentProperties(JsonObject json, ResearchStudy owner, ResearchStudy.ResearchStudyObjectiveComponent res) throws IOException, FHIRFormatError {
22289    parseBackboneElementProperties(json, res);
22290    if (json.has("name"))
22291      res.setNameElement(parseString(json.get("name").getAsString()));
22292    if (json.has("_name"))
22293      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
22294    if (json.has("type"))
22295      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22296  }
22297
22298  protected ResearchSubject parseResearchSubject(JsonObject json) throws IOException, FHIRFormatError {
22299    ResearchSubject res = new ResearchSubject();
22300    parseResearchSubjectProperties(json, res);
22301    return res;
22302  }
22303
22304  protected void parseResearchSubjectProperties(JsonObject json, ResearchSubject res) throws IOException, FHIRFormatError {
22305    parseDomainResourceProperties(json, res);
22306    if (json.has("identifier")) {
22307      JsonArray array = json.getAsJsonArray("identifier");
22308      for (int i = 0; i < array.size(); i++) {
22309        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22310      }
22311    };
22312    if (json.has("status"))
22313      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchSubject.ResearchSubjectStatus.NULL, new ResearchSubject.ResearchSubjectStatusEnumFactory()));
22314    if (json.has("_status"))
22315      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22316    if (json.has("period"))
22317      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
22318    if (json.has("study"))
22319      res.setStudy(parseReference(json.getAsJsonObject("study")));
22320    if (json.has("individual"))
22321      res.setIndividual(parseReference(json.getAsJsonObject("individual")));
22322    if (json.has("assignedArm"))
22323      res.setAssignedArmElement(parseString(json.get("assignedArm").getAsString()));
22324    if (json.has("_assignedArm"))
22325      parseElementProperties(json.getAsJsonObject("_assignedArm"), res.getAssignedArmElement());
22326    if (json.has("actualArm"))
22327      res.setActualArmElement(parseString(json.get("actualArm").getAsString()));
22328    if (json.has("_actualArm"))
22329      parseElementProperties(json.getAsJsonObject("_actualArm"), res.getActualArmElement());
22330    if (json.has("consent"))
22331      res.setConsent(parseReference(json.getAsJsonObject("consent")));
22332  }
22333
22334  protected RiskAssessment parseRiskAssessment(JsonObject json) throws IOException, FHIRFormatError {
22335    RiskAssessment res = new RiskAssessment();
22336    parseRiskAssessmentProperties(json, res);
22337    return res;
22338  }
22339
22340  protected void parseRiskAssessmentProperties(JsonObject json, RiskAssessment res) throws IOException, FHIRFormatError {
22341    parseDomainResourceProperties(json, res);
22342    if (json.has("identifier")) {
22343      JsonArray array = json.getAsJsonArray("identifier");
22344      for (int i = 0; i < array.size(); i++) {
22345        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22346      }
22347    };
22348    if (json.has("basedOn"))
22349      res.setBasedOn(parseReference(json.getAsJsonObject("basedOn")));
22350    if (json.has("parent"))
22351      res.setParent(parseReference(json.getAsJsonObject("parent")));
22352    if (json.has("status"))
22353      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), RiskAssessment.RiskAssessmentStatus.NULL, new RiskAssessment.RiskAssessmentStatusEnumFactory()));
22354    if (json.has("_status"))
22355      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22356    if (json.has("method"))
22357      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
22358    if (json.has("code"))
22359      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
22360    if (json.has("subject"))
22361      res.setSubject(parseReference(json.getAsJsonObject("subject")));
22362    if (json.has("encounter"))
22363      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
22364    Type occurrence = parseType("occurrence", json);
22365    if (occurrence != null)
22366      res.setOccurrence(occurrence);
22367    if (json.has("condition"))
22368      res.setCondition(parseReference(json.getAsJsonObject("condition")));
22369    if (json.has("performer"))
22370      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
22371    if (json.has("reasonCode")) {
22372      JsonArray array = json.getAsJsonArray("reasonCode");
22373      for (int i = 0; i < array.size(); i++) {
22374        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22375      }
22376    };
22377    if (json.has("reasonReference")) {
22378      JsonArray array = json.getAsJsonArray("reasonReference");
22379      for (int i = 0; i < array.size(); i++) {
22380        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
22381      }
22382    };
22383    if (json.has("basis")) {
22384      JsonArray array = json.getAsJsonArray("basis");
22385      for (int i = 0; i < array.size(); i++) {
22386        res.getBasis().add(parseReference(array.get(i).getAsJsonObject()));
22387      }
22388    };
22389    if (json.has("prediction")) {
22390      JsonArray array = json.getAsJsonArray("prediction");
22391      for (int i = 0; i < array.size(); i++) {
22392        res.getPrediction().add(parseRiskAssessmentRiskAssessmentPredictionComponent(array.get(i).getAsJsonObject(), res));
22393      }
22394    };
22395    if (json.has("mitigation"))
22396      res.setMitigationElement(parseString(json.get("mitigation").getAsString()));
22397    if (json.has("_mitigation"))
22398      parseElementProperties(json.getAsJsonObject("_mitigation"), res.getMitigationElement());
22399    if (json.has("note")) {
22400      JsonArray array = json.getAsJsonArray("note");
22401      for (int i = 0; i < array.size(); i++) {
22402        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22403      }
22404    };
22405  }
22406
22407  protected RiskAssessment.RiskAssessmentPredictionComponent parseRiskAssessmentRiskAssessmentPredictionComponent(JsonObject json, RiskAssessment owner) throws IOException, FHIRFormatError {
22408    RiskAssessment.RiskAssessmentPredictionComponent res = new RiskAssessment.RiskAssessmentPredictionComponent();
22409    parseRiskAssessmentRiskAssessmentPredictionComponentProperties(json, owner, res);
22410    return res;
22411  }
22412
22413  protected void parseRiskAssessmentRiskAssessmentPredictionComponentProperties(JsonObject json, RiskAssessment owner, RiskAssessment.RiskAssessmentPredictionComponent res) throws IOException, FHIRFormatError {
22414    parseBackboneElementProperties(json, res);
22415    if (json.has("outcome"))
22416      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
22417    Type probability = parseType("probability", json);
22418    if (probability != null)
22419      res.setProbability(probability);
22420    if (json.has("qualitativeRisk"))
22421      res.setQualitativeRisk(parseCodeableConcept(json.getAsJsonObject("qualitativeRisk")));
22422    if (json.has("relativeRisk"))
22423      res.setRelativeRiskElement(parseDecimal(json.get("relativeRisk").getAsBigDecimal()));
22424    if (json.has("_relativeRisk"))
22425      parseElementProperties(json.getAsJsonObject("_relativeRisk"), res.getRelativeRiskElement());
22426    Type when = parseType("when", json);
22427    if (when != null)
22428      res.setWhen(when);
22429    if (json.has("rationale"))
22430      res.setRationaleElement(parseString(json.get("rationale").getAsString()));
22431    if (json.has("_rationale"))
22432      parseElementProperties(json.getAsJsonObject("_rationale"), res.getRationaleElement());
22433  }
22434
22435  protected RiskEvidenceSynthesis parseRiskEvidenceSynthesis(JsonObject json) throws IOException, FHIRFormatError {
22436    RiskEvidenceSynthesis res = new RiskEvidenceSynthesis();
22437    parseRiskEvidenceSynthesisProperties(json, res);
22438    return res;
22439  }
22440
22441  protected void parseRiskEvidenceSynthesisProperties(JsonObject json, RiskEvidenceSynthesis res) throws IOException, FHIRFormatError {
22442    parseDomainResourceProperties(json, res);
22443    if (json.has("url"))
22444      res.setUrlElement(parseUri(json.get("url").getAsString()));
22445    if (json.has("_url"))
22446      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
22447    if (json.has("identifier")) {
22448      JsonArray array = json.getAsJsonArray("identifier");
22449      for (int i = 0; i < array.size(); i++) {
22450        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22451      }
22452    };
22453    if (json.has("version"))
22454      res.setVersionElement(parseString(json.get("version").getAsString()));
22455    if (json.has("_version"))
22456      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
22457    if (json.has("name"))
22458      res.setNameElement(parseString(json.get("name").getAsString()));
22459    if (json.has("_name"))
22460      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
22461    if (json.has("title"))
22462      res.setTitleElement(parseString(json.get("title").getAsString()));
22463    if (json.has("_title"))
22464      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
22465    if (json.has("status"))
22466      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
22467    if (json.has("_status"))
22468      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22469    if (json.has("date"))
22470      res.setDateElement(parseDateTime(json.get("date").getAsString()));
22471    if (json.has("_date"))
22472      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
22473    if (json.has("publisher"))
22474      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
22475    if (json.has("_publisher"))
22476      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
22477    if (json.has("contact")) {
22478      JsonArray array = json.getAsJsonArray("contact");
22479      for (int i = 0; i < array.size(); i++) {
22480        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
22481      }
22482    };
22483    if (json.has("description"))
22484      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
22485    if (json.has("_description"))
22486      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22487    if (json.has("note")) {
22488      JsonArray array = json.getAsJsonArray("note");
22489      for (int i = 0; i < array.size(); i++) {
22490        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22491      }
22492    };
22493    if (json.has("useContext")) {
22494      JsonArray array = json.getAsJsonArray("useContext");
22495      for (int i = 0; i < array.size(); i++) {
22496        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
22497      }
22498    };
22499    if (json.has("jurisdiction")) {
22500      JsonArray array = json.getAsJsonArray("jurisdiction");
22501      for (int i = 0; i < array.size(); i++) {
22502        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22503      }
22504    };
22505    if (json.has("copyright"))
22506      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
22507    if (json.has("_copyright"))
22508      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
22509    if (json.has("approvalDate"))
22510      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
22511    if (json.has("_approvalDate"))
22512      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
22513    if (json.has("lastReviewDate"))
22514      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
22515    if (json.has("_lastReviewDate"))
22516      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
22517    if (json.has("effectivePeriod"))
22518      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
22519    if (json.has("topic")) {
22520      JsonArray array = json.getAsJsonArray("topic");
22521      for (int i = 0; i < array.size(); i++) {
22522        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22523      }
22524    };
22525    if (json.has("author")) {
22526      JsonArray array = json.getAsJsonArray("author");
22527      for (int i = 0; i < array.size(); i++) {
22528        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
22529      }
22530    };
22531    if (json.has("editor")) {
22532      JsonArray array = json.getAsJsonArray("editor");
22533      for (int i = 0; i < array.size(); i++) {
22534        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
22535      }
22536    };
22537    if (json.has("reviewer")) {
22538      JsonArray array = json.getAsJsonArray("reviewer");
22539      for (int i = 0; i < array.size(); i++) {
22540        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
22541      }
22542    };
22543    if (json.has("endorser")) {
22544      JsonArray array = json.getAsJsonArray("endorser");
22545      for (int i = 0; i < array.size(); i++) {
22546        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
22547      }
22548    };
22549    if (json.has("relatedArtifact")) {
22550      JsonArray array = json.getAsJsonArray("relatedArtifact");
22551      for (int i = 0; i < array.size(); i++) {
22552        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
22553      }
22554    };
22555    if (json.has("synthesisType"))
22556      res.setSynthesisType(parseCodeableConcept(json.getAsJsonObject("synthesisType")));
22557    if (json.has("studyType"))
22558      res.setStudyType(parseCodeableConcept(json.getAsJsonObject("studyType")));
22559    if (json.has("population"))
22560      res.setPopulation(parseReference(json.getAsJsonObject("population")));
22561    if (json.has("exposure"))
22562      res.setExposure(parseReference(json.getAsJsonObject("exposure")));
22563    if (json.has("outcome"))
22564      res.setOutcome(parseReference(json.getAsJsonObject("outcome")));
22565    if (json.has("sampleSize"))
22566      res.setSampleSize(parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent(json.getAsJsonObject("sampleSize"), res));
22567    if (json.has("riskEstimate"))
22568      res.setRiskEstimate(parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent(json.getAsJsonObject("riskEstimate"), res));
22569    if (json.has("certainty")) {
22570      JsonArray array = json.getAsJsonArray("certainty");
22571      for (int i = 0; i < array.size(); i++) {
22572        res.getCertainty().add(parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent(array.get(i).getAsJsonObject(), res));
22573      }
22574    };
22575  }
22576
22577  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent(JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
22578    RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent();
22579    parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentProperties(json, owner, res);
22580    return res;
22581  }
22582
22583  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentProperties(JsonObject json, RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent res) throws IOException, FHIRFormatError {
22584    parseBackboneElementProperties(json, res);
22585    if (json.has("description"))
22586      res.setDescriptionElement(parseString(json.get("description").getAsString()));
22587    if (json.has("_description"))
22588      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22589    if (json.has("numberOfStudies"))
22590      res.setNumberOfStudiesElement(parseInteger(json.get("numberOfStudies").getAsLong()));
22591    if (json.has("_numberOfStudies"))
22592      parseElementProperties(json.getAsJsonObject("_numberOfStudies"), res.getNumberOfStudiesElement());
22593    if (json.has("numberOfParticipants"))
22594      res.setNumberOfParticipantsElement(parseInteger(json.get("numberOfParticipants").getAsLong()));
22595    if (json.has("_numberOfParticipants"))
22596      parseElementProperties(json.getAsJsonObject("_numberOfParticipants"), res.getNumberOfParticipantsElement());
22597  }
22598
22599  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent(JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
22600    RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent();
22601    parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentProperties(json, owner, res);
22602    return res;
22603  }
22604
22605  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentProperties(JsonObject json, RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent res) throws IOException, FHIRFormatError {
22606    parseBackboneElementProperties(json, res);
22607    if (json.has("description"))
22608      res.setDescriptionElement(parseString(json.get("description").getAsString()));
22609    if (json.has("_description"))
22610      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22611    if (json.has("type"))
22612      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22613    if (json.has("value"))
22614      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
22615    if (json.has("_value"))
22616      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
22617    if (json.has("unitOfMeasure"))
22618      res.setUnitOfMeasure(parseCodeableConcept(json.getAsJsonObject("unitOfMeasure")));
22619    if (json.has("denominatorCount"))
22620      res.setDenominatorCountElement(parseInteger(json.get("denominatorCount").getAsLong()));
22621    if (json.has("_denominatorCount"))
22622      parseElementProperties(json.getAsJsonObject("_denominatorCount"), res.getDenominatorCountElement());
22623    if (json.has("numeratorCount"))
22624      res.setNumeratorCountElement(parseInteger(json.get("numeratorCount").getAsLong()));
22625    if (json.has("_numeratorCount"))
22626      parseElementProperties(json.getAsJsonObject("_numeratorCount"), res.getNumeratorCountElement());
22627    if (json.has("precisionEstimate")) {
22628      JsonArray array = json.getAsJsonArray("precisionEstimate");
22629      for (int i = 0; i < array.size(); i++) {
22630        res.getPrecisionEstimate().add(parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(array.get(i).getAsJsonObject(), owner));
22631      }
22632    };
22633  }
22634
22635  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
22636    RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent();
22637    parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentProperties(json, owner, res);
22638    return res;
22639  }
22640
22641  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentProperties(JsonObject json, RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent res) throws IOException, FHIRFormatError {
22642    parseBackboneElementProperties(json, res);
22643    if (json.has("type"))
22644      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22645    if (json.has("level"))
22646      res.setLevelElement(parseDecimal(json.get("level").getAsBigDecimal()));
22647    if (json.has("_level"))
22648      parseElementProperties(json.getAsJsonObject("_level"), res.getLevelElement());
22649    if (json.has("from"))
22650      res.setFromElement(parseDecimal(json.get("from").getAsBigDecimal()));
22651    if (json.has("_from"))
22652      parseElementProperties(json.getAsJsonObject("_from"), res.getFromElement());
22653    if (json.has("to"))
22654      res.setToElement(parseDecimal(json.get("to").getAsBigDecimal()));
22655    if (json.has("_to"))
22656      parseElementProperties(json.getAsJsonObject("_to"), res.getToElement());
22657  }
22658
22659  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent(JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
22660    RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent();
22661    parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentProperties(json, owner, res);
22662    return res;
22663  }
22664
22665  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentProperties(JsonObject json, RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent res) throws IOException, FHIRFormatError {
22666    parseBackboneElementProperties(json, res);
22667    if (json.has("rating")) {
22668      JsonArray array = json.getAsJsonArray("rating");
22669      for (int i = 0; i < array.size(); i++) {
22670        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22671      }
22672    };
22673    if (json.has("note")) {
22674      JsonArray array = json.getAsJsonArray("note");
22675      for (int i = 0; i < array.size(); i++) {
22676        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22677      }
22678    };
22679    if (json.has("certaintySubcomponent")) {
22680      JsonArray array = json.getAsJsonArray("certaintySubcomponent");
22681      for (int i = 0; i < array.size(); i++) {
22682        res.getCertaintySubcomponent().add(parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(array.get(i).getAsJsonObject(), owner));
22683      }
22684    };
22685  }
22686
22687  protected RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(JsonObject json, RiskEvidenceSynthesis owner) throws IOException, FHIRFormatError {
22688    RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent res = new RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent();
22689    parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentProperties(json, owner, res);
22690    return res;
22691  }
22692
22693  protected void parseRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentProperties(JsonObject json, RiskEvidenceSynthesis owner, RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent res) throws IOException, FHIRFormatError {
22694    parseBackboneElementProperties(json, res);
22695    if (json.has("type"))
22696      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22697    if (json.has("rating")) {
22698      JsonArray array = json.getAsJsonArray("rating");
22699      for (int i = 0; i < array.size(); i++) {
22700        res.getRating().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22701      }
22702    };
22703    if (json.has("note")) {
22704      JsonArray array = json.getAsJsonArray("note");
22705      for (int i = 0; i < array.size(); i++) {
22706        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22707      }
22708    };
22709  }
22710
22711  protected Schedule parseSchedule(JsonObject json) throws IOException, FHIRFormatError {
22712    Schedule res = new Schedule();
22713    parseScheduleProperties(json, res);
22714    return res;
22715  }
22716
22717  protected void parseScheduleProperties(JsonObject json, Schedule res) throws IOException, FHIRFormatError {
22718    parseDomainResourceProperties(json, res);
22719    if (json.has("identifier")) {
22720      JsonArray array = json.getAsJsonArray("identifier");
22721      for (int i = 0; i < array.size(); i++) {
22722        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22723      }
22724    };
22725    if (json.has("active"))
22726      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
22727    if (json.has("_active"))
22728      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
22729    if (json.has("serviceCategory")) {
22730      JsonArray array = json.getAsJsonArray("serviceCategory");
22731      for (int i = 0; i < array.size(); i++) {
22732        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22733      }
22734    };
22735    if (json.has("serviceType")) {
22736      JsonArray array = json.getAsJsonArray("serviceType");
22737      for (int i = 0; i < array.size(); i++) {
22738        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22739      }
22740    };
22741    if (json.has("specialty")) {
22742      JsonArray array = json.getAsJsonArray("specialty");
22743      for (int i = 0; i < array.size(); i++) {
22744        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22745      }
22746    };
22747    if (json.has("actor")) {
22748      JsonArray array = json.getAsJsonArray("actor");
22749      for (int i = 0; i < array.size(); i++) {
22750        res.getActor().add(parseReference(array.get(i).getAsJsonObject()));
22751      }
22752    };
22753    if (json.has("planningHorizon"))
22754      res.setPlanningHorizon(parsePeriod(json.getAsJsonObject("planningHorizon")));
22755    if (json.has("comment"))
22756      res.setCommentElement(parseString(json.get("comment").getAsString()));
22757    if (json.has("_comment"))
22758      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
22759  }
22760
22761  protected SearchParameter parseSearchParameter(JsonObject json) throws IOException, FHIRFormatError {
22762    SearchParameter res = new SearchParameter();
22763    parseSearchParameterProperties(json, res);
22764    return res;
22765  }
22766
22767  protected void parseSearchParameterProperties(JsonObject json, SearchParameter res) throws IOException, FHIRFormatError {
22768    parseDomainResourceProperties(json, res);
22769    if (json.has("url"))
22770      res.setUrlElement(parseUri(json.get("url").getAsString()));
22771    if (json.has("_url"))
22772      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
22773    if (json.has("version"))
22774      res.setVersionElement(parseString(json.get("version").getAsString()));
22775    if (json.has("_version"))
22776      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
22777    if (json.has("name"))
22778      res.setNameElement(parseString(json.get("name").getAsString()));
22779    if (json.has("_name"))
22780      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
22781    if (json.has("derivedFrom"))
22782      res.setDerivedFromElement(parseCanonical(json.get("derivedFrom").getAsString()));
22783    if (json.has("_derivedFrom"))
22784      parseElementProperties(json.getAsJsonObject("_derivedFrom"), res.getDerivedFromElement());
22785    if (json.has("status"))
22786      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
22787    if (json.has("_status"))
22788      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22789    if (json.has("experimental"))
22790      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
22791    if (json.has("_experimental"))
22792      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
22793    if (json.has("date"))
22794      res.setDateElement(parseDateTime(json.get("date").getAsString()));
22795    if (json.has("_date"))
22796      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
22797    if (json.has("publisher"))
22798      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
22799    if (json.has("_publisher"))
22800      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
22801    if (json.has("contact")) {
22802      JsonArray array = json.getAsJsonArray("contact");
22803      for (int i = 0; i < array.size(); i++) {
22804        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
22805      }
22806    };
22807    if (json.has("description"))
22808      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
22809    if (json.has("_description"))
22810      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22811    if (json.has("useContext")) {
22812      JsonArray array = json.getAsJsonArray("useContext");
22813      for (int i = 0; i < array.size(); i++) {
22814        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
22815      }
22816    };
22817    if (json.has("jurisdiction")) {
22818      JsonArray array = json.getAsJsonArray("jurisdiction");
22819      for (int i = 0; i < array.size(); i++) {
22820        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22821      }
22822    };
22823    if (json.has("purpose"))
22824      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
22825    if (json.has("_purpose"))
22826      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
22827    if (json.has("code"))
22828      res.setCodeElement(parseCode(json.get("code").getAsString()));
22829    if (json.has("_code"))
22830      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
22831    if (json.has("base")) {
22832      JsonArray array = json.getAsJsonArray("base");
22833      for (int i = 0; i < array.size(); i++) {
22834        res.getBase().add(parseCode(array.get(i).getAsString()));
22835      }
22836    };
22837    if (json.has("_base")) {
22838      JsonArray array = json.getAsJsonArray("_base");
22839      for (int i = 0; i < array.size(); i++) {
22840        if (i == res.getBase().size())
22841          res.getBase().add(parseCode(null));
22842        if (array.get(i) instanceof JsonObject) 
22843          parseElementProperties(array.get(i).getAsJsonObject(), res.getBase().get(i));
22844      }
22845    };
22846    if (json.has("type"))
22847      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
22848    if (json.has("_type"))
22849      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
22850    if (json.has("expression"))
22851      res.setExpressionElement(parseString(json.get("expression").getAsString()));
22852    if (json.has("_expression"))
22853      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
22854    if (json.has("xpath"))
22855      res.setXpathElement(parseString(json.get("xpath").getAsString()));
22856    if (json.has("_xpath"))
22857      parseElementProperties(json.getAsJsonObject("_xpath"), res.getXpathElement());
22858    if (json.has("xpathUsage"))
22859      res.setXpathUsageElement(parseEnumeration(json.get("xpathUsage").getAsString(), SearchParameter.XPathUsageType.NULL, new SearchParameter.XPathUsageTypeEnumFactory()));
22860    if (json.has("_xpathUsage"))
22861      parseElementProperties(json.getAsJsonObject("_xpathUsage"), res.getXpathUsageElement());
22862    if (json.has("target")) {
22863      JsonArray array = json.getAsJsonArray("target");
22864      for (int i = 0; i < array.size(); i++) {
22865        res.getTarget().add(parseCode(array.get(i).getAsString()));
22866      }
22867    };
22868    if (json.has("_target")) {
22869      JsonArray array = json.getAsJsonArray("_target");
22870      for (int i = 0; i < array.size(); i++) {
22871        if (i == res.getTarget().size())
22872          res.getTarget().add(parseCode(null));
22873        if (array.get(i) instanceof JsonObject) 
22874          parseElementProperties(array.get(i).getAsJsonObject(), res.getTarget().get(i));
22875      }
22876    };
22877    if (json.has("multipleOr"))
22878      res.setMultipleOrElement(parseBoolean(json.get("multipleOr").getAsBoolean()));
22879    if (json.has("_multipleOr"))
22880      parseElementProperties(json.getAsJsonObject("_multipleOr"), res.getMultipleOrElement());
22881    if (json.has("multipleAnd"))
22882      res.setMultipleAndElement(parseBoolean(json.get("multipleAnd").getAsBoolean()));
22883    if (json.has("_multipleAnd"))
22884      parseElementProperties(json.getAsJsonObject("_multipleAnd"), res.getMultipleAndElement());
22885    if (json.has("comparator")) {
22886      JsonArray array = json.getAsJsonArray("comparator");
22887      for (int i = 0; i < array.size(); i++) {
22888        res.getComparator().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
22889      }
22890    };
22891    if (json.has("_comparator")) {
22892      JsonArray array = json.getAsJsonArray("_comparator");
22893      for (int i = 0; i < array.size(); i++) {
22894        if (i == res.getComparator().size())
22895          res.getComparator().add(parseEnumeration(null, SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
22896        if (array.get(i) instanceof JsonObject) 
22897          parseElementProperties(array.get(i).getAsJsonObject(), res.getComparator().get(i));
22898      }
22899    };
22900    if (json.has("modifier")) {
22901      JsonArray array = json.getAsJsonArray("modifier");
22902      for (int i = 0; i < array.size(); i++) {
22903        res.getModifier().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
22904      }
22905    };
22906    if (json.has("_modifier")) {
22907      JsonArray array = json.getAsJsonArray("_modifier");
22908      for (int i = 0; i < array.size(); i++) {
22909        if (i == res.getModifier().size())
22910          res.getModifier().add(parseEnumeration(null, SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
22911        if (array.get(i) instanceof JsonObject) 
22912          parseElementProperties(array.get(i).getAsJsonObject(), res.getModifier().get(i));
22913      }
22914    };
22915    if (json.has("chain")) {
22916      JsonArray array = json.getAsJsonArray("chain");
22917      for (int i = 0; i < array.size(); i++) {
22918        res.getChain().add(parseString(array.get(i).getAsString()));
22919      }
22920    };
22921    if (json.has("_chain")) {
22922      JsonArray array = json.getAsJsonArray("_chain");
22923      for (int i = 0; i < array.size(); i++) {
22924        if (i == res.getChain().size())
22925          res.getChain().add(parseString(null));
22926        if (array.get(i) instanceof JsonObject) 
22927          parseElementProperties(array.get(i).getAsJsonObject(), res.getChain().get(i));
22928      }
22929    };
22930    if (json.has("component")) {
22931      JsonArray array = json.getAsJsonArray("component");
22932      for (int i = 0; i < array.size(); i++) {
22933        res.getComponent().add(parseSearchParameterSearchParameterComponentComponent(array.get(i).getAsJsonObject(), res));
22934      }
22935    };
22936  }
22937
22938  protected SearchParameter.SearchParameterComponentComponent parseSearchParameterSearchParameterComponentComponent(JsonObject json, SearchParameter owner) throws IOException, FHIRFormatError {
22939    SearchParameter.SearchParameterComponentComponent res = new SearchParameter.SearchParameterComponentComponent();
22940    parseSearchParameterSearchParameterComponentComponentProperties(json, owner, res);
22941    return res;
22942  }
22943
22944  protected void parseSearchParameterSearchParameterComponentComponentProperties(JsonObject json, SearchParameter owner, SearchParameter.SearchParameterComponentComponent res) throws IOException, FHIRFormatError {
22945    parseBackboneElementProperties(json, res);
22946    if (json.has("definition"))
22947      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
22948    if (json.has("_definition"))
22949      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
22950    if (json.has("expression"))
22951      res.setExpressionElement(parseString(json.get("expression").getAsString()));
22952    if (json.has("_expression"))
22953      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
22954  }
22955
22956  protected ServiceRequest parseServiceRequest(JsonObject json) throws IOException, FHIRFormatError {
22957    ServiceRequest res = new ServiceRequest();
22958    parseServiceRequestProperties(json, res);
22959    return res;
22960  }
22961
22962  protected void parseServiceRequestProperties(JsonObject json, ServiceRequest res) throws IOException, FHIRFormatError {
22963    parseDomainResourceProperties(json, res);
22964    if (json.has("identifier")) {
22965      JsonArray array = json.getAsJsonArray("identifier");
22966      for (int i = 0; i < array.size(); i++) {
22967        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22968      }
22969    };
22970    if (json.has("instantiatesCanonical")) {
22971      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
22972      for (int i = 0; i < array.size(); i++) {
22973        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
22974      }
22975    };
22976    if (json.has("_instantiatesCanonical")) {
22977      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
22978      for (int i = 0; i < array.size(); i++) {
22979        if (i == res.getInstantiatesCanonical().size())
22980          res.getInstantiatesCanonical().add(parseCanonical(null));
22981        if (array.get(i) instanceof JsonObject) 
22982          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
22983      }
22984    };
22985    if (json.has("instantiatesUri")) {
22986      JsonArray array = json.getAsJsonArray("instantiatesUri");
22987      for (int i = 0; i < array.size(); i++) {
22988        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
22989      }
22990    };
22991    if (json.has("_instantiatesUri")) {
22992      JsonArray array = json.getAsJsonArray("_instantiatesUri");
22993      for (int i = 0; i < array.size(); i++) {
22994        if (i == res.getInstantiatesUri().size())
22995          res.getInstantiatesUri().add(parseUri(null));
22996        if (array.get(i) instanceof JsonObject) 
22997          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
22998      }
22999    };
23000    if (json.has("basedOn")) {
23001      JsonArray array = json.getAsJsonArray("basedOn");
23002      for (int i = 0; i < array.size(); i++) {
23003        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
23004      }
23005    };
23006    if (json.has("replaces")) {
23007      JsonArray array = json.getAsJsonArray("replaces");
23008      for (int i = 0; i < array.size(); i++) {
23009        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
23010      }
23011    };
23012    if (json.has("requisition"))
23013      res.setRequisition(parseIdentifier(json.getAsJsonObject("requisition")));
23014    if (json.has("status"))
23015      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ServiceRequest.ServiceRequestStatus.NULL, new ServiceRequest.ServiceRequestStatusEnumFactory()));
23016    if (json.has("_status"))
23017      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23018    if (json.has("intent"))
23019      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), ServiceRequest.ServiceRequestIntent.NULL, new ServiceRequest.ServiceRequestIntentEnumFactory()));
23020    if (json.has("_intent"))
23021      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
23022    if (json.has("category")) {
23023      JsonArray array = json.getAsJsonArray("category");
23024      for (int i = 0; i < array.size(); i++) {
23025        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23026      }
23027    };
23028    if (json.has("priority"))
23029      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), ServiceRequest.ServiceRequestPriority.NULL, new ServiceRequest.ServiceRequestPriorityEnumFactory()));
23030    if (json.has("_priority"))
23031      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
23032    if (json.has("doNotPerform"))
23033      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
23034    if (json.has("_doNotPerform"))
23035      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
23036    if (json.has("code"))
23037      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
23038    if (json.has("orderDetail")) {
23039      JsonArray array = json.getAsJsonArray("orderDetail");
23040      for (int i = 0; i < array.size(); i++) {
23041        res.getOrderDetail().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23042      }
23043    };
23044    Type quantity = parseType("quantity", json);
23045    if (quantity != null)
23046      res.setQuantity(quantity);
23047    if (json.has("subject"))
23048      res.setSubject(parseReference(json.getAsJsonObject("subject")));
23049    if (json.has("encounter"))
23050      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
23051    Type occurrence = parseType("occurrence", json);
23052    if (occurrence != null)
23053      res.setOccurrence(occurrence);
23054    Type asNeeded = parseType("asNeeded", json);
23055    if (asNeeded != null)
23056      res.setAsNeeded(asNeeded);
23057    if (json.has("authoredOn"))
23058      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
23059    if (json.has("_authoredOn"))
23060      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
23061    if (json.has("requester"))
23062      res.setRequester(parseReference(json.getAsJsonObject("requester")));
23063    if (json.has("performerType"))
23064      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
23065    if (json.has("performer")) {
23066      JsonArray array = json.getAsJsonArray("performer");
23067      for (int i = 0; i < array.size(); i++) {
23068        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
23069      }
23070    };
23071    if (json.has("locationCode")) {
23072      JsonArray array = json.getAsJsonArray("locationCode");
23073      for (int i = 0; i < array.size(); i++) {
23074        res.getLocationCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23075      }
23076    };
23077    if (json.has("locationReference")) {
23078      JsonArray array = json.getAsJsonArray("locationReference");
23079      for (int i = 0; i < array.size(); i++) {
23080        res.getLocationReference().add(parseReference(array.get(i).getAsJsonObject()));
23081      }
23082    };
23083    if (json.has("reasonCode")) {
23084      JsonArray array = json.getAsJsonArray("reasonCode");
23085      for (int i = 0; i < array.size(); i++) {
23086        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23087      }
23088    };
23089    if (json.has("reasonReference")) {
23090      JsonArray array = json.getAsJsonArray("reasonReference");
23091      for (int i = 0; i < array.size(); i++) {
23092        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
23093      }
23094    };
23095    if (json.has("insurance")) {
23096      JsonArray array = json.getAsJsonArray("insurance");
23097      for (int i = 0; i < array.size(); i++) {
23098        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
23099      }
23100    };
23101    if (json.has("supportingInfo")) {
23102      JsonArray array = json.getAsJsonArray("supportingInfo");
23103      for (int i = 0; i < array.size(); i++) {
23104        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
23105      }
23106    };
23107    if (json.has("specimen")) {
23108      JsonArray array = json.getAsJsonArray("specimen");
23109      for (int i = 0; i < array.size(); i++) {
23110        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
23111      }
23112    };
23113    if (json.has("bodySite")) {
23114      JsonArray array = json.getAsJsonArray("bodySite");
23115      for (int i = 0; i < array.size(); i++) {
23116        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23117      }
23118    };
23119    if (json.has("note")) {
23120      JsonArray array = json.getAsJsonArray("note");
23121      for (int i = 0; i < array.size(); i++) {
23122        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
23123      }
23124    };
23125    if (json.has("patientInstruction"))
23126      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
23127    if (json.has("_patientInstruction"))
23128      parseElementProperties(json.getAsJsonObject("_patientInstruction"), res.getPatientInstructionElement());
23129    if (json.has("relevantHistory")) {
23130      JsonArray array = json.getAsJsonArray("relevantHistory");
23131      for (int i = 0; i < array.size(); i++) {
23132        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
23133      }
23134    };
23135  }
23136
23137  protected Slot parseSlot(JsonObject json) throws IOException, FHIRFormatError {
23138    Slot res = new Slot();
23139    parseSlotProperties(json, res);
23140    return res;
23141  }
23142
23143  protected void parseSlotProperties(JsonObject json, Slot res) throws IOException, FHIRFormatError {
23144    parseDomainResourceProperties(json, res);
23145    if (json.has("identifier")) {
23146      JsonArray array = json.getAsJsonArray("identifier");
23147      for (int i = 0; i < array.size(); i++) {
23148        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23149      }
23150    };
23151    if (json.has("serviceCategory")) {
23152      JsonArray array = json.getAsJsonArray("serviceCategory");
23153      for (int i = 0; i < array.size(); i++) {
23154        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23155      }
23156    };
23157    if (json.has("serviceType")) {
23158      JsonArray array = json.getAsJsonArray("serviceType");
23159      for (int i = 0; i < array.size(); i++) {
23160        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23161      }
23162    };
23163    if (json.has("specialty")) {
23164      JsonArray array = json.getAsJsonArray("specialty");
23165      for (int i = 0; i < array.size(); i++) {
23166        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23167      }
23168    };
23169    if (json.has("appointmentType"))
23170      res.setAppointmentType(parseCodeableConcept(json.getAsJsonObject("appointmentType")));
23171    if (json.has("schedule"))
23172      res.setSchedule(parseReference(json.getAsJsonObject("schedule")));
23173    if (json.has("status"))
23174      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Slot.SlotStatus.NULL, new Slot.SlotStatusEnumFactory()));
23175    if (json.has("_status"))
23176      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23177    if (json.has("start"))
23178      res.setStartElement(parseInstant(json.get("start").getAsString()));
23179    if (json.has("_start"))
23180      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
23181    if (json.has("end"))
23182      res.setEndElement(parseInstant(json.get("end").getAsString()));
23183    if (json.has("_end"))
23184      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
23185    if (json.has("overbooked"))
23186      res.setOverbookedElement(parseBoolean(json.get("overbooked").getAsBoolean()));
23187    if (json.has("_overbooked"))
23188      parseElementProperties(json.getAsJsonObject("_overbooked"), res.getOverbookedElement());
23189    if (json.has("comment"))
23190      res.setCommentElement(parseString(json.get("comment").getAsString()));
23191    if (json.has("_comment"))
23192      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
23193  }
23194
23195  protected Specimen parseSpecimen(JsonObject json) throws IOException, FHIRFormatError {
23196    Specimen res = new Specimen();
23197    parseSpecimenProperties(json, res);
23198    return res;
23199  }
23200
23201  protected void parseSpecimenProperties(JsonObject json, Specimen res) throws IOException, FHIRFormatError {
23202    parseDomainResourceProperties(json, res);
23203    if (json.has("identifier")) {
23204      JsonArray array = json.getAsJsonArray("identifier");
23205      for (int i = 0; i < array.size(); i++) {
23206        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23207      }
23208    };
23209    if (json.has("accessionIdentifier"))
23210      res.setAccessionIdentifier(parseIdentifier(json.getAsJsonObject("accessionIdentifier")));
23211    if (json.has("status"))
23212      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Specimen.SpecimenStatus.NULL, new Specimen.SpecimenStatusEnumFactory()));
23213    if (json.has("_status"))
23214      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23215    if (json.has("type"))
23216      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23217    if (json.has("subject"))
23218      res.setSubject(parseReference(json.getAsJsonObject("subject")));
23219    if (json.has("receivedTime"))
23220      res.setReceivedTimeElement(parseDateTime(json.get("receivedTime").getAsString()));
23221    if (json.has("_receivedTime"))
23222      parseElementProperties(json.getAsJsonObject("_receivedTime"), res.getReceivedTimeElement());
23223    if (json.has("parent")) {
23224      JsonArray array = json.getAsJsonArray("parent");
23225      for (int i = 0; i < array.size(); i++) {
23226        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
23227      }
23228    };
23229    if (json.has("request")) {
23230      JsonArray array = json.getAsJsonArray("request");
23231      for (int i = 0; i < array.size(); i++) {
23232        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
23233      }
23234    };
23235    if (json.has("collection"))
23236      res.setCollection(parseSpecimenSpecimenCollectionComponent(json.getAsJsonObject("collection"), res));
23237    if (json.has("processing")) {
23238      JsonArray array = json.getAsJsonArray("processing");
23239      for (int i = 0; i < array.size(); i++) {
23240        res.getProcessing().add(parseSpecimenSpecimenProcessingComponent(array.get(i).getAsJsonObject(), res));
23241      }
23242    };
23243    if (json.has("container")) {
23244      JsonArray array = json.getAsJsonArray("container");
23245      for (int i = 0; i < array.size(); i++) {
23246        res.getContainer().add(parseSpecimenSpecimenContainerComponent(array.get(i).getAsJsonObject(), res));
23247      }
23248    };
23249    if (json.has("condition")) {
23250      JsonArray array = json.getAsJsonArray("condition");
23251      for (int i = 0; i < array.size(); i++) {
23252        res.getCondition().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23253      }
23254    };
23255    if (json.has("note")) {
23256      JsonArray array = json.getAsJsonArray("note");
23257      for (int i = 0; i < array.size(); i++) {
23258        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
23259      }
23260    };
23261  }
23262
23263  protected Specimen.SpecimenCollectionComponent parseSpecimenSpecimenCollectionComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
23264    Specimen.SpecimenCollectionComponent res = new Specimen.SpecimenCollectionComponent();
23265    parseSpecimenSpecimenCollectionComponentProperties(json, owner, res);
23266    return res;
23267  }
23268
23269  protected void parseSpecimenSpecimenCollectionComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenCollectionComponent res) throws IOException, FHIRFormatError {
23270    parseBackboneElementProperties(json, res);
23271    if (json.has("collector"))
23272      res.setCollector(parseReference(json.getAsJsonObject("collector")));
23273    Type collected = parseType("collected", json);
23274    if (collected != null)
23275      res.setCollected(collected);
23276    if (json.has("duration"))
23277      res.setDuration(parseDuration(json.getAsJsonObject("duration")));
23278    if (json.has("quantity"))
23279      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
23280    if (json.has("method"))
23281      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
23282    if (json.has("bodySite"))
23283      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
23284    Type fastingStatus = parseType("fastingStatus", json);
23285    if (fastingStatus != null)
23286      res.setFastingStatus(fastingStatus);
23287  }
23288
23289  protected Specimen.SpecimenProcessingComponent parseSpecimenSpecimenProcessingComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
23290    Specimen.SpecimenProcessingComponent res = new Specimen.SpecimenProcessingComponent();
23291    parseSpecimenSpecimenProcessingComponentProperties(json, owner, res);
23292    return res;
23293  }
23294
23295  protected void parseSpecimenSpecimenProcessingComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenProcessingComponent res) throws IOException, FHIRFormatError {
23296    parseBackboneElementProperties(json, res);
23297    if (json.has("description"))
23298      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23299    if (json.has("_description"))
23300      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23301    if (json.has("procedure"))
23302      res.setProcedure(parseCodeableConcept(json.getAsJsonObject("procedure")));
23303    if (json.has("additive")) {
23304      JsonArray array = json.getAsJsonArray("additive");
23305      for (int i = 0; i < array.size(); i++) {
23306        res.getAdditive().add(parseReference(array.get(i).getAsJsonObject()));
23307      }
23308    };
23309    Type time = parseType("time", json);
23310    if (time != null)
23311      res.setTime(time);
23312  }
23313
23314  protected Specimen.SpecimenContainerComponent parseSpecimenSpecimenContainerComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
23315    Specimen.SpecimenContainerComponent res = new Specimen.SpecimenContainerComponent();
23316    parseSpecimenSpecimenContainerComponentProperties(json, owner, res);
23317    return res;
23318  }
23319
23320  protected void parseSpecimenSpecimenContainerComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenContainerComponent res) throws IOException, FHIRFormatError {
23321    parseBackboneElementProperties(json, res);
23322    if (json.has("identifier")) {
23323      JsonArray array = json.getAsJsonArray("identifier");
23324      for (int i = 0; i < array.size(); i++) {
23325        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23326      }
23327    };
23328    if (json.has("description"))
23329      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23330    if (json.has("_description"))
23331      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23332    if (json.has("type"))
23333      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23334    if (json.has("capacity"))
23335      res.setCapacity(parseQuantity(json.getAsJsonObject("capacity")));
23336    if (json.has("specimenQuantity"))
23337      res.setSpecimenQuantity(parseQuantity(json.getAsJsonObject("specimenQuantity")));
23338    Type additive = parseType("additive", json);
23339    if (additive != null)
23340      res.setAdditive(additive);
23341  }
23342
23343  protected SpecimenDefinition parseSpecimenDefinition(JsonObject json) throws IOException, FHIRFormatError {
23344    SpecimenDefinition res = new SpecimenDefinition();
23345    parseSpecimenDefinitionProperties(json, res);
23346    return res;
23347  }
23348
23349  protected void parseSpecimenDefinitionProperties(JsonObject json, SpecimenDefinition res) throws IOException, FHIRFormatError {
23350    parseDomainResourceProperties(json, res);
23351    if (json.has("identifier"))
23352      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
23353    if (json.has("typeCollected"))
23354      res.setTypeCollected(parseCodeableConcept(json.getAsJsonObject("typeCollected")));
23355    if (json.has("patientPreparation")) {
23356      JsonArray array = json.getAsJsonArray("patientPreparation");
23357      for (int i = 0; i < array.size(); i++) {
23358        res.getPatientPreparation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23359      }
23360    };
23361    if (json.has("timeAspect"))
23362      res.setTimeAspectElement(parseString(json.get("timeAspect").getAsString()));
23363    if (json.has("_timeAspect"))
23364      parseElementProperties(json.getAsJsonObject("_timeAspect"), res.getTimeAspectElement());
23365    if (json.has("collection")) {
23366      JsonArray array = json.getAsJsonArray("collection");
23367      for (int i = 0; i < array.size(); i++) {
23368        res.getCollection().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23369      }
23370    };
23371    if (json.has("typeTested")) {
23372      JsonArray array = json.getAsJsonArray("typeTested");
23373      for (int i = 0; i < array.size(); i++) {
23374        res.getTypeTested().add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(array.get(i).getAsJsonObject(), res));
23375      }
23376    };
23377  }
23378
23379  protected SpecimenDefinition.SpecimenDefinitionTypeTestedComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
23380    SpecimenDefinition.SpecimenDefinitionTypeTestedComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedComponent();
23381    parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponentProperties(json, owner, res);
23382    return res;
23383  }
23384
23385  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedComponent res) throws IOException, FHIRFormatError {
23386    parseBackboneElementProperties(json, res);
23387    if (json.has("isDerived"))
23388      res.setIsDerivedElement(parseBoolean(json.get("isDerived").getAsBoolean()));
23389    if (json.has("_isDerived"))
23390      parseElementProperties(json.getAsJsonObject("_isDerived"), res.getIsDerivedElement());
23391    if (json.has("type"))
23392      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23393    if (json.has("preference"))
23394      res.setPreferenceElement(parseEnumeration(json.get("preference").getAsString(), SpecimenDefinition.SpecimenContainedPreference.NULL, new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory()));
23395    if (json.has("_preference"))
23396      parseElementProperties(json.getAsJsonObject("_preference"), res.getPreferenceElement());
23397    if (json.has("container"))
23398      res.setContainer(parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(json.getAsJsonObject("container"), owner));
23399    if (json.has("requirement"))
23400      res.setRequirementElement(parseString(json.get("requirement").getAsString()));
23401    if (json.has("_requirement"))
23402      parseElementProperties(json.getAsJsonObject("_requirement"), res.getRequirementElement());
23403    if (json.has("retentionTime"))
23404      res.setRetentionTime(parseDuration(json.getAsJsonObject("retentionTime")));
23405    if (json.has("rejectionCriterion")) {
23406      JsonArray array = json.getAsJsonArray("rejectionCriterion");
23407      for (int i = 0; i < array.size(); i++) {
23408        res.getRejectionCriterion().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23409      }
23410    };
23411    if (json.has("handling")) {
23412      JsonArray array = json.getAsJsonArray("handling");
23413      for (int i = 0; i < array.size(); i++) {
23414        res.getHandling().add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(array.get(i).getAsJsonObject(), owner));
23415      }
23416    };
23417  }
23418
23419  protected SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
23420    SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent();
23421    parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentProperties(json, owner, res);
23422    return res;
23423  }
23424
23425  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent res) throws IOException, FHIRFormatError {
23426    parseBackboneElementProperties(json, res);
23427    if (json.has("material"))
23428      res.setMaterial(parseCodeableConcept(json.getAsJsonObject("material")));
23429    if (json.has("type"))
23430      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23431    if (json.has("cap"))
23432      res.setCap(parseCodeableConcept(json.getAsJsonObject("cap")));
23433    if (json.has("description"))
23434      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23435    if (json.has("_description"))
23436      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23437    if (json.has("capacity"))
23438      res.setCapacity(parseQuantity(json.getAsJsonObject("capacity")));
23439    Type minimumVolume = parseType("minimumVolume", json);
23440    if (minimumVolume != null)
23441      res.setMinimumVolume(minimumVolume);
23442    if (json.has("additive")) {
23443      JsonArray array = json.getAsJsonArray("additive");
23444      for (int i = 0; i < array.size(); i++) {
23445        res.getAdditive().add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(array.get(i).getAsJsonObject(), owner));
23446      }
23447    };
23448    if (json.has("preparation"))
23449      res.setPreparationElement(parseString(json.get("preparation").getAsString()));
23450    if (json.has("_preparation"))
23451      parseElementProperties(json.getAsJsonObject("_preparation"), res.getPreparationElement());
23452  }
23453
23454  protected SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
23455    SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent();
23456    parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(json, owner, res);
23457    return res;
23458  }
23459
23460  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent res) throws IOException, FHIRFormatError {
23461    parseBackboneElementProperties(json, res);
23462    Type additive = parseType("additive", json);
23463    if (additive != null)
23464      res.setAdditive(additive);
23465  }
23466
23467  protected SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
23468    SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent();
23469    parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentProperties(json, owner, res);
23470    return res;
23471  }
23472
23473  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent res) throws IOException, FHIRFormatError {
23474    parseBackboneElementProperties(json, res);
23475    if (json.has("temperatureQualifier"))
23476      res.setTemperatureQualifier(parseCodeableConcept(json.getAsJsonObject("temperatureQualifier")));
23477    if (json.has("temperatureRange"))
23478      res.setTemperatureRange(parseRange(json.getAsJsonObject("temperatureRange")));
23479    if (json.has("maxDuration"))
23480      res.setMaxDuration(parseDuration(json.getAsJsonObject("maxDuration")));
23481    if (json.has("instruction"))
23482      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
23483    if (json.has("_instruction"))
23484      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
23485  }
23486
23487  protected StructureDefinition parseStructureDefinition(JsonObject json) throws IOException, FHIRFormatError {
23488    StructureDefinition res = new StructureDefinition();
23489    parseStructureDefinitionProperties(json, res);
23490    return res;
23491  }
23492
23493  protected void parseStructureDefinitionProperties(JsonObject json, StructureDefinition res) throws IOException, FHIRFormatError {
23494    parseDomainResourceProperties(json, res);
23495    if (json.has("url"))
23496      res.setUrlElement(parseUri(json.get("url").getAsString()));
23497    if (json.has("_url"))
23498      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
23499    if (json.has("identifier")) {
23500      JsonArray array = json.getAsJsonArray("identifier");
23501      for (int i = 0; i < array.size(); i++) {
23502        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23503      }
23504    };
23505    if (json.has("version"))
23506      res.setVersionElement(parseString(json.get("version").getAsString()));
23507    if (json.has("_version"))
23508      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
23509    if (json.has("name"))
23510      res.setNameElement(parseString(json.get("name").getAsString()));
23511    if (json.has("_name"))
23512      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23513    if (json.has("title"))
23514      res.setTitleElement(parseString(json.get("title").getAsString()));
23515    if (json.has("_title"))
23516      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
23517    if (json.has("status"))
23518      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
23519    if (json.has("_status"))
23520      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23521    if (json.has("experimental"))
23522      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
23523    if (json.has("_experimental"))
23524      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
23525    if (json.has("date"))
23526      res.setDateElement(parseDateTime(json.get("date").getAsString()));
23527    if (json.has("_date"))
23528      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
23529    if (json.has("publisher"))
23530      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
23531    if (json.has("_publisher"))
23532      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
23533    if (json.has("contact")) {
23534      JsonArray array = json.getAsJsonArray("contact");
23535      for (int i = 0; i < array.size(); i++) {
23536        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
23537      }
23538    };
23539    if (json.has("description"))
23540      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
23541    if (json.has("_description"))
23542      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23543    if (json.has("useContext")) {
23544      JsonArray array = json.getAsJsonArray("useContext");
23545      for (int i = 0; i < array.size(); i++) {
23546        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
23547      }
23548    };
23549    if (json.has("jurisdiction")) {
23550      JsonArray array = json.getAsJsonArray("jurisdiction");
23551      for (int i = 0; i < array.size(); i++) {
23552        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23553      }
23554    };
23555    if (json.has("purpose"))
23556      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
23557    if (json.has("_purpose"))
23558      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
23559    if (json.has("copyright"))
23560      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
23561    if (json.has("_copyright"))
23562      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
23563    if (json.has("keyword")) {
23564      JsonArray array = json.getAsJsonArray("keyword");
23565      for (int i = 0; i < array.size(); i++) {
23566        res.getKeyword().add(parseCoding(array.get(i).getAsJsonObject()));
23567      }
23568    };
23569    if (json.has("fhirVersion"))
23570      res.setFhirVersionElement(parseEnumeration(json.get("fhirVersion").getAsString(), Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
23571    if (json.has("_fhirVersion"))
23572      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
23573    if (json.has("mapping")) {
23574      JsonArray array = json.getAsJsonArray("mapping");
23575      for (int i = 0; i < array.size(); i++) {
23576        res.getMapping().add(parseStructureDefinitionStructureDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
23577      }
23578    };
23579    if (json.has("kind"))
23580      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), StructureDefinition.StructureDefinitionKind.NULL, new StructureDefinition.StructureDefinitionKindEnumFactory()));
23581    if (json.has("_kind"))
23582      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
23583    if (json.has("abstract"))
23584      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
23585    if (json.has("_abstract"))
23586      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
23587    if (json.has("context")) {
23588      JsonArray array = json.getAsJsonArray("context");
23589      for (int i = 0; i < array.size(); i++) {
23590        res.getContext().add(parseStructureDefinitionStructureDefinitionContextComponent(array.get(i).getAsJsonObject(), res));
23591      }
23592    };
23593    if (json.has("contextInvariant")) {
23594      JsonArray array = json.getAsJsonArray("contextInvariant");
23595      for (int i = 0; i < array.size(); i++) {
23596        res.getContextInvariant().add(parseString(array.get(i).getAsString()));
23597      }
23598    };
23599    if (json.has("_contextInvariant")) {
23600      JsonArray array = json.getAsJsonArray("_contextInvariant");
23601      for (int i = 0; i < array.size(); i++) {
23602        if (i == res.getContextInvariant().size())
23603          res.getContextInvariant().add(parseString(null));
23604        if (array.get(i) instanceof JsonObject) 
23605          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextInvariant().get(i));
23606      }
23607    };
23608    if (json.has("type"))
23609      res.setTypeElement(parseUri(json.get("type").getAsString()));
23610    if (json.has("_type"))
23611      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
23612    if (json.has("baseDefinition"))
23613      res.setBaseDefinitionElement(parseCanonical(json.get("baseDefinition").getAsString()));
23614    if (json.has("_baseDefinition"))
23615      parseElementProperties(json.getAsJsonObject("_baseDefinition"), res.getBaseDefinitionElement());
23616    if (json.has("derivation"))
23617      res.setDerivationElement(parseEnumeration(json.get("derivation").getAsString(), StructureDefinition.TypeDerivationRule.NULL, new StructureDefinition.TypeDerivationRuleEnumFactory()));
23618    if (json.has("_derivation"))
23619      parseElementProperties(json.getAsJsonObject("_derivation"), res.getDerivationElement());
23620    if (json.has("snapshot"))
23621      res.setSnapshot(parseStructureDefinitionStructureDefinitionSnapshotComponent(json.getAsJsonObject("snapshot"), res));
23622    if (json.has("differential"))
23623      res.setDifferential(parseStructureDefinitionStructureDefinitionDifferentialComponent(json.getAsJsonObject("differential"), res));
23624  }
23625
23626  protected StructureDefinition.StructureDefinitionMappingComponent parseStructureDefinitionStructureDefinitionMappingComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
23627    StructureDefinition.StructureDefinitionMappingComponent res = new StructureDefinition.StructureDefinitionMappingComponent();
23628    parseStructureDefinitionStructureDefinitionMappingComponentProperties(json, owner, res);
23629    return res;
23630  }
23631
23632  protected void parseStructureDefinitionStructureDefinitionMappingComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionMappingComponent res) throws IOException, FHIRFormatError {
23633    parseBackboneElementProperties(json, res);
23634    if (json.has("identity"))
23635      res.setIdentityElement(parseId(json.get("identity").getAsString()));
23636    if (json.has("_identity"))
23637      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
23638    if (json.has("uri"))
23639      res.setUriElement(parseUri(json.get("uri").getAsString()));
23640    if (json.has("_uri"))
23641      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
23642    if (json.has("name"))
23643      res.setNameElement(parseString(json.get("name").getAsString()));
23644    if (json.has("_name"))
23645      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23646    if (json.has("comment"))
23647      res.setCommentElement(parseString(json.get("comment").getAsString()));
23648    if (json.has("_comment"))
23649      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
23650  }
23651
23652  protected StructureDefinition.StructureDefinitionContextComponent parseStructureDefinitionStructureDefinitionContextComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
23653    StructureDefinition.StructureDefinitionContextComponent res = new StructureDefinition.StructureDefinitionContextComponent();
23654    parseStructureDefinitionStructureDefinitionContextComponentProperties(json, owner, res);
23655    return res;
23656  }
23657
23658  protected void parseStructureDefinitionStructureDefinitionContextComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionContextComponent res) throws IOException, FHIRFormatError {
23659    parseBackboneElementProperties(json, res);
23660    if (json.has("type"))
23661      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), StructureDefinition.ExtensionContextType.NULL, new StructureDefinition.ExtensionContextTypeEnumFactory()));
23662    if (json.has("_type"))
23663      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
23664    if (json.has("expression"))
23665      res.setExpressionElement(parseString(json.get("expression").getAsString()));
23666    if (json.has("_expression"))
23667      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
23668  }
23669
23670  protected StructureDefinition.StructureDefinitionSnapshotComponent parseStructureDefinitionStructureDefinitionSnapshotComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
23671    StructureDefinition.StructureDefinitionSnapshotComponent res = new StructureDefinition.StructureDefinitionSnapshotComponent();
23672    parseStructureDefinitionStructureDefinitionSnapshotComponentProperties(json, owner, res);
23673    return res;
23674  }
23675
23676  protected void parseStructureDefinitionStructureDefinitionSnapshotComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionSnapshotComponent res) throws IOException, FHIRFormatError {
23677    parseBackboneElementProperties(json, res);
23678    if (json.has("element")) {
23679      JsonArray array = json.getAsJsonArray("element");
23680      for (int i = 0; i < array.size(); i++) {
23681        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
23682      }
23683    };
23684  }
23685
23686  protected StructureDefinition.StructureDefinitionDifferentialComponent parseStructureDefinitionStructureDefinitionDifferentialComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
23687    StructureDefinition.StructureDefinitionDifferentialComponent res = new StructureDefinition.StructureDefinitionDifferentialComponent();
23688    parseStructureDefinitionStructureDefinitionDifferentialComponentProperties(json, owner, res);
23689    return res;
23690  }
23691
23692  protected void parseStructureDefinitionStructureDefinitionDifferentialComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionDifferentialComponent res) throws IOException, FHIRFormatError {
23693    parseBackboneElementProperties(json, res);
23694    if (json.has("element")) {
23695      JsonArray array = json.getAsJsonArray("element");
23696      for (int i = 0; i < array.size(); i++) {
23697        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
23698      }
23699    };
23700  }
23701
23702  protected StructureMap parseStructureMap(JsonObject json) throws IOException, FHIRFormatError {
23703    StructureMap res = new StructureMap();
23704    parseStructureMapProperties(json, res);
23705    return res;
23706  }
23707
23708  protected void parseStructureMapProperties(JsonObject json, StructureMap res) throws IOException, FHIRFormatError {
23709    parseDomainResourceProperties(json, res);
23710    if (json.has("url"))
23711      res.setUrlElement(parseUri(json.get("url").getAsString()));
23712    if (json.has("_url"))
23713      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
23714    if (json.has("identifier")) {
23715      JsonArray array = json.getAsJsonArray("identifier");
23716      for (int i = 0; i < array.size(); i++) {
23717        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23718      }
23719    };
23720    if (json.has("version"))
23721      res.setVersionElement(parseString(json.get("version").getAsString()));
23722    if (json.has("_version"))
23723      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
23724    if (json.has("name"))
23725      res.setNameElement(parseString(json.get("name").getAsString()));
23726    if (json.has("_name"))
23727      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23728    if (json.has("title"))
23729      res.setTitleElement(parseString(json.get("title").getAsString()));
23730    if (json.has("_title"))
23731      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
23732    if (json.has("status"))
23733      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
23734    if (json.has("_status"))
23735      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23736    if (json.has("experimental"))
23737      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
23738    if (json.has("_experimental"))
23739      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
23740    if (json.has("date"))
23741      res.setDateElement(parseDateTime(json.get("date").getAsString()));
23742    if (json.has("_date"))
23743      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
23744    if (json.has("publisher"))
23745      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
23746    if (json.has("_publisher"))
23747      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
23748    if (json.has("contact")) {
23749      JsonArray array = json.getAsJsonArray("contact");
23750      for (int i = 0; i < array.size(); i++) {
23751        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
23752      }
23753    };
23754    if (json.has("description"))
23755      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
23756    if (json.has("_description"))
23757      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23758    if (json.has("useContext")) {
23759      JsonArray array = json.getAsJsonArray("useContext");
23760      for (int i = 0; i < array.size(); i++) {
23761        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
23762      }
23763    };
23764    if (json.has("jurisdiction")) {
23765      JsonArray array = json.getAsJsonArray("jurisdiction");
23766      for (int i = 0; i < array.size(); i++) {
23767        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23768      }
23769    };
23770    if (json.has("purpose"))
23771      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
23772    if (json.has("_purpose"))
23773      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
23774    if (json.has("copyright"))
23775      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
23776    if (json.has("_copyright"))
23777      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
23778    if (json.has("structure")) {
23779      JsonArray array = json.getAsJsonArray("structure");
23780      for (int i = 0; i < array.size(); i++) {
23781        res.getStructure().add(parseStructureMapStructureMapStructureComponent(array.get(i).getAsJsonObject(), res));
23782      }
23783    };
23784    if (json.has("import")) {
23785      JsonArray array = json.getAsJsonArray("import");
23786      for (int i = 0; i < array.size(); i++) {
23787        res.getImport().add(parseCanonical(array.get(i).getAsString()));
23788      }
23789    };
23790    if (json.has("_import")) {
23791      JsonArray array = json.getAsJsonArray("_import");
23792      for (int i = 0; i < array.size(); i++) {
23793        if (i == res.getImport().size())
23794          res.getImport().add(parseCanonical(null));
23795        if (array.get(i) instanceof JsonObject) 
23796          parseElementProperties(array.get(i).getAsJsonObject(), res.getImport().get(i));
23797      }
23798    };
23799    if (json.has("group")) {
23800      JsonArray array = json.getAsJsonArray("group");
23801      for (int i = 0; i < array.size(); i++) {
23802        res.getGroup().add(parseStructureMapStructureMapGroupComponent(array.get(i).getAsJsonObject(), res));
23803      }
23804    };
23805  }
23806
23807  protected StructureMap.StructureMapStructureComponent parseStructureMapStructureMapStructureComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
23808    StructureMap.StructureMapStructureComponent res = new StructureMap.StructureMapStructureComponent();
23809    parseStructureMapStructureMapStructureComponentProperties(json, owner, res);
23810    return res;
23811  }
23812
23813  protected void parseStructureMapStructureMapStructureComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapStructureComponent res) throws IOException, FHIRFormatError {
23814    parseBackboneElementProperties(json, res);
23815    if (json.has("url"))
23816      res.setUrlElement(parseCanonical(json.get("url").getAsString()));
23817    if (json.has("_url"))
23818      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
23819    if (json.has("mode"))
23820      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapModelMode.NULL, new StructureMap.StructureMapModelModeEnumFactory()));
23821    if (json.has("_mode"))
23822      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
23823    if (json.has("alias"))
23824      res.setAliasElement(parseString(json.get("alias").getAsString()));
23825    if (json.has("_alias"))
23826      parseElementProperties(json.getAsJsonObject("_alias"), res.getAliasElement());
23827    if (json.has("documentation"))
23828      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
23829    if (json.has("_documentation"))
23830      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
23831  }
23832
23833  protected StructureMap.StructureMapGroupComponent parseStructureMapStructureMapGroupComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
23834    StructureMap.StructureMapGroupComponent res = new StructureMap.StructureMapGroupComponent();
23835    parseStructureMapStructureMapGroupComponentProperties(json, owner, res);
23836    return res;
23837  }
23838
23839  protected void parseStructureMapStructureMapGroupComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupComponent res) throws IOException, FHIRFormatError {
23840    parseBackboneElementProperties(json, res);
23841    if (json.has("name"))
23842      res.setNameElement(parseId(json.get("name").getAsString()));
23843    if (json.has("_name"))
23844      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23845    if (json.has("extends"))
23846      res.setExtendsElement(parseId(json.get("extends").getAsString()));
23847    if (json.has("_extends"))
23848      parseElementProperties(json.getAsJsonObject("_extends"), res.getExtendsElement());
23849    if (json.has("typeMode"))
23850      res.setTypeModeElement(parseEnumeration(json.get("typeMode").getAsString(), StructureMap.StructureMapGroupTypeMode.NULL, new StructureMap.StructureMapGroupTypeModeEnumFactory()));
23851    if (json.has("_typeMode"))
23852      parseElementProperties(json.getAsJsonObject("_typeMode"), res.getTypeModeElement());
23853    if (json.has("documentation"))
23854      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
23855    if (json.has("_documentation"))
23856      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
23857    if (json.has("input")) {
23858      JsonArray array = json.getAsJsonArray("input");
23859      for (int i = 0; i < array.size(); i++) {
23860        res.getInput().add(parseStructureMapStructureMapGroupInputComponent(array.get(i).getAsJsonObject(), owner));
23861      }
23862    };
23863    if (json.has("rule")) {
23864      JsonArray array = json.getAsJsonArray("rule");
23865      for (int i = 0; i < array.size(); i++) {
23866        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
23867      }
23868    };
23869  }
23870
23871  protected StructureMap.StructureMapGroupInputComponent parseStructureMapStructureMapGroupInputComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
23872    StructureMap.StructureMapGroupInputComponent res = new StructureMap.StructureMapGroupInputComponent();
23873    parseStructureMapStructureMapGroupInputComponentProperties(json, owner, res);
23874    return res;
23875  }
23876
23877  protected void parseStructureMapStructureMapGroupInputComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupInputComponent res) throws IOException, FHIRFormatError {
23878    parseBackboneElementProperties(json, res);
23879    if (json.has("name"))
23880      res.setNameElement(parseId(json.get("name").getAsString()));
23881    if (json.has("_name"))
23882      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23883    if (json.has("type"))
23884      res.setTypeElement(parseString(json.get("type").getAsString()));
23885    if (json.has("_type"))
23886      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
23887    if (json.has("mode"))
23888      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapInputMode.NULL, new StructureMap.StructureMapInputModeEnumFactory()));
23889    if (json.has("_mode"))
23890      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
23891    if (json.has("documentation"))
23892      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
23893    if (json.has("_documentation"))
23894      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
23895  }
23896
23897  protected StructureMap.StructureMapGroupRuleComponent parseStructureMapStructureMapGroupRuleComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
23898    StructureMap.StructureMapGroupRuleComponent res = new StructureMap.StructureMapGroupRuleComponent();
23899    parseStructureMapStructureMapGroupRuleComponentProperties(json, owner, res);
23900    return res;
23901  }
23902
23903  protected void parseStructureMapStructureMapGroupRuleComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleComponent res) throws IOException, FHIRFormatError {
23904    parseBackboneElementProperties(json, res);
23905    if (json.has("name"))
23906      res.setNameElement(parseId(json.get("name").getAsString()));
23907    if (json.has("_name"))
23908      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23909    if (json.has("source")) {
23910      JsonArray array = json.getAsJsonArray("source");
23911      for (int i = 0; i < array.size(); i++) {
23912        res.getSource().add(parseStructureMapStructureMapGroupRuleSourceComponent(array.get(i).getAsJsonObject(), owner));
23913      }
23914    };
23915    if (json.has("target")) {
23916      JsonArray array = json.getAsJsonArray("target");
23917      for (int i = 0; i < array.size(); i++) {
23918        res.getTarget().add(parseStructureMapStructureMapGroupRuleTargetComponent(array.get(i).getAsJsonObject(), owner));
23919      }
23920    };
23921    if (json.has("rule")) {
23922      JsonArray array = json.getAsJsonArray("rule");
23923      for (int i = 0; i < array.size(); i++) {
23924        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
23925      }
23926    };
23927    if (json.has("dependent")) {
23928      JsonArray array = json.getAsJsonArray("dependent");
23929      for (int i = 0; i < array.size(); i++) {
23930        res.getDependent().add(parseStructureMapStructureMapGroupRuleDependentComponent(array.get(i).getAsJsonObject(), owner));
23931      }
23932    };
23933    if (json.has("documentation"))
23934      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
23935    if (json.has("_documentation"))
23936      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
23937  }
23938
23939  protected StructureMap.StructureMapGroupRuleSourceComponent parseStructureMapStructureMapGroupRuleSourceComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
23940    StructureMap.StructureMapGroupRuleSourceComponent res = new StructureMap.StructureMapGroupRuleSourceComponent();
23941    parseStructureMapStructureMapGroupRuleSourceComponentProperties(json, owner, res);
23942    return res;
23943  }
23944
23945  protected void parseStructureMapStructureMapGroupRuleSourceComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleSourceComponent res) throws IOException, FHIRFormatError {
23946    parseBackboneElementProperties(json, res);
23947    if (json.has("context"))
23948      res.setContextElement(parseId(json.get("context").getAsString()));
23949    if (json.has("_context"))
23950      parseElementProperties(json.getAsJsonObject("_context"), res.getContextElement());
23951    if (json.has("min"))
23952      res.setMinElement(parseInteger(json.get("min").getAsLong()));
23953    if (json.has("_min"))
23954      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
23955    if (json.has("max"))
23956      res.setMaxElement(parseString(json.get("max").getAsString()));
23957    if (json.has("_max"))
23958      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
23959    if (json.has("type"))
23960      res.setTypeElement(parseString(json.get("type").getAsString()));
23961    if (json.has("_type"))
23962      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
23963    Type defaultValue = parseType("defaultValue", json);
23964    if (defaultValue != null)
23965      res.setDefaultValue(defaultValue);
23966    if (json.has("element"))
23967      res.setElementElement(parseString(json.get("element").getAsString()));
23968    if (json.has("_element"))
23969      parseElementProperties(json.getAsJsonObject("_element"), res.getElementElement());
23970    if (json.has("listMode"))
23971      res.setListModeElement(parseEnumeration(json.get("listMode").getAsString(), StructureMap.StructureMapSourceListMode.NULL, new StructureMap.StructureMapSourceListModeEnumFactory()));
23972    if (json.has("_listMode"))
23973      parseElementProperties(json.getAsJsonObject("_listMode"), res.getListModeElement());
23974    if (json.has("variable"))
23975      res.setVariableElement(parseId(json.get("variable").getAsString()));
23976    if (json.has("_variable"))
23977      parseElementProperties(json.getAsJsonObject("_variable"), res.getVariableElement());
23978    if (json.has("condition"))
23979      res.setConditionElement(parseString(json.get("condition").getAsString()));
23980    if (json.has("_condition"))
23981      parseElementProperties(json.getAsJsonObject("_condition"), res.getConditionElement());
23982    if (json.has("check"))
23983      res.setCheckElement(parseString(json.get("check").getAsString()));
23984    if (json.has("_check"))
23985      parseElementProperties(json.getAsJsonObject("_check"), res.getCheckElement());
23986    if (json.has("logMessage"))
23987      res.setLogMessageElement(parseString(json.get("logMessage").getAsString()));
23988    if (json.has("_logMessage"))
23989      parseElementProperties(json.getAsJsonObject("_logMessage"), res.getLogMessageElement());
23990  }
23991
23992  protected StructureMap.StructureMapGroupRuleTargetComponent parseStructureMapStructureMapGroupRuleTargetComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
23993    StructureMap.StructureMapGroupRuleTargetComponent res = new StructureMap.StructureMapGroupRuleTargetComponent();
23994    parseStructureMapStructureMapGroupRuleTargetComponentProperties(json, owner, res);
23995    return res;
23996  }
23997
23998  protected void parseStructureMapStructureMapGroupRuleTargetComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleTargetComponent res) throws IOException, FHIRFormatError {
23999    parseBackboneElementProperties(json, res);
24000    if (json.has("context"))
24001      res.setContextElement(parseId(json.get("context").getAsString()));
24002    if (json.has("_context"))
24003      parseElementProperties(json.getAsJsonObject("_context"), res.getContextElement());
24004    if (json.has("contextType"))
24005      res.setContextTypeElement(parseEnumeration(json.get("contextType").getAsString(), StructureMap.StructureMapContextType.NULL, new StructureMap.StructureMapContextTypeEnumFactory()));
24006    if (json.has("_contextType"))
24007      parseElementProperties(json.getAsJsonObject("_contextType"), res.getContextTypeElement());
24008    if (json.has("element"))
24009      res.setElementElement(parseString(json.get("element").getAsString()));
24010    if (json.has("_element"))
24011      parseElementProperties(json.getAsJsonObject("_element"), res.getElementElement());
24012    if (json.has("variable"))
24013      res.setVariableElement(parseId(json.get("variable").getAsString()));
24014    if (json.has("_variable"))
24015      parseElementProperties(json.getAsJsonObject("_variable"), res.getVariableElement());
24016    if (json.has("listMode")) {
24017      JsonArray array = json.getAsJsonArray("listMode");
24018      for (int i = 0; i < array.size(); i++) {
24019        res.getListMode().add(parseEnumeration(array.get(i).getAsString(), StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
24020      }
24021    };
24022    if (json.has("_listMode")) {
24023      JsonArray array = json.getAsJsonArray("_listMode");
24024      for (int i = 0; i < array.size(); i++) {
24025        if (i == res.getListMode().size())
24026          res.getListMode().add(parseEnumeration(null, StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
24027        if (array.get(i) instanceof JsonObject) 
24028          parseElementProperties(array.get(i).getAsJsonObject(), res.getListMode().get(i));
24029      }
24030    };
24031    if (json.has("listRuleId"))
24032      res.setListRuleIdElement(parseId(json.get("listRuleId").getAsString()));
24033    if (json.has("_listRuleId"))
24034      parseElementProperties(json.getAsJsonObject("_listRuleId"), res.getListRuleIdElement());
24035    if (json.has("transform"))
24036      res.setTransformElement(parseEnumeration(json.get("transform").getAsString(), StructureMap.StructureMapTransform.NULL, new StructureMap.StructureMapTransformEnumFactory()));
24037    if (json.has("_transform"))
24038      parseElementProperties(json.getAsJsonObject("_transform"), res.getTransformElement());
24039    if (json.has("parameter")) {
24040      JsonArray array = json.getAsJsonArray("parameter");
24041      for (int i = 0; i < array.size(); i++) {
24042        res.getParameter().add(parseStructureMapStructureMapGroupRuleTargetParameterComponent(array.get(i).getAsJsonObject(), owner));
24043      }
24044    };
24045  }
24046
24047  protected StructureMap.StructureMapGroupRuleTargetParameterComponent parseStructureMapStructureMapGroupRuleTargetParameterComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
24048    StructureMap.StructureMapGroupRuleTargetParameterComponent res = new StructureMap.StructureMapGroupRuleTargetParameterComponent();
24049    parseStructureMapStructureMapGroupRuleTargetParameterComponentProperties(json, owner, res);
24050    return res;
24051  }
24052
24053  protected void parseStructureMapStructureMapGroupRuleTargetParameterComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleTargetParameterComponent res) throws IOException, FHIRFormatError {
24054    parseBackboneElementProperties(json, res);
24055    Type value = parseType("value", json);
24056    if (value != null)
24057      res.setValue(value);
24058  }
24059
24060  protected StructureMap.StructureMapGroupRuleDependentComponent parseStructureMapStructureMapGroupRuleDependentComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
24061    StructureMap.StructureMapGroupRuleDependentComponent res = new StructureMap.StructureMapGroupRuleDependentComponent();
24062    parseStructureMapStructureMapGroupRuleDependentComponentProperties(json, owner, res);
24063    return res;
24064  }
24065
24066  protected void parseStructureMapStructureMapGroupRuleDependentComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleDependentComponent res) throws IOException, FHIRFormatError {
24067    parseBackboneElementProperties(json, res);
24068    if (json.has("name"))
24069      res.setNameElement(parseId(json.get("name").getAsString()));
24070    if (json.has("_name"))
24071      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24072    if (json.has("variable")) {
24073      JsonArray array = json.getAsJsonArray("variable");
24074      for (int i = 0; i < array.size(); i++) {
24075        res.getVariable().add(parseString(array.get(i).getAsString()));
24076      }
24077    };
24078    if (json.has("_variable")) {
24079      JsonArray array = json.getAsJsonArray("_variable");
24080      for (int i = 0; i < array.size(); i++) {
24081        if (i == res.getVariable().size())
24082          res.getVariable().add(parseString(null));
24083        if (array.get(i) instanceof JsonObject) 
24084          parseElementProperties(array.get(i).getAsJsonObject(), res.getVariable().get(i));
24085      }
24086    };
24087  }
24088
24089  protected Subscription parseSubscription(JsonObject json) throws IOException, FHIRFormatError {
24090    Subscription res = new Subscription();
24091    parseSubscriptionProperties(json, res);
24092    return res;
24093  }
24094
24095  protected void parseSubscriptionProperties(JsonObject json, Subscription res) throws IOException, FHIRFormatError {
24096    parseDomainResourceProperties(json, res);
24097    if (json.has("status"))
24098      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Subscription.SubscriptionStatus.NULL, new Subscription.SubscriptionStatusEnumFactory()));
24099    if (json.has("_status"))
24100      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
24101    if (json.has("contact")) {
24102      JsonArray array = json.getAsJsonArray("contact");
24103      for (int i = 0; i < array.size(); i++) {
24104        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
24105      }
24106    };
24107    if (json.has("end"))
24108      res.setEndElement(parseInstant(json.get("end").getAsString()));
24109    if (json.has("_end"))
24110      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
24111    if (json.has("reason"))
24112      res.setReasonElement(parseString(json.get("reason").getAsString()));
24113    if (json.has("_reason"))
24114      parseElementProperties(json.getAsJsonObject("_reason"), res.getReasonElement());
24115    if (json.has("criteria"))
24116      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
24117    if (json.has("_criteria"))
24118      parseElementProperties(json.getAsJsonObject("_criteria"), res.getCriteriaElement());
24119    if (json.has("error"))
24120      res.setErrorElement(parseString(json.get("error").getAsString()));
24121    if (json.has("_error"))
24122      parseElementProperties(json.getAsJsonObject("_error"), res.getErrorElement());
24123    if (json.has("channel"))
24124      res.setChannel(parseSubscriptionSubscriptionChannelComponent(json.getAsJsonObject("channel"), res));
24125  }
24126
24127  protected Subscription.SubscriptionChannelComponent parseSubscriptionSubscriptionChannelComponent(JsonObject json, Subscription owner) throws IOException, FHIRFormatError {
24128    Subscription.SubscriptionChannelComponent res = new Subscription.SubscriptionChannelComponent();
24129    parseSubscriptionSubscriptionChannelComponentProperties(json, owner, res);
24130    return res;
24131  }
24132
24133  protected void parseSubscriptionSubscriptionChannelComponentProperties(JsonObject json, Subscription owner, Subscription.SubscriptionChannelComponent res) throws IOException, FHIRFormatError {
24134    parseBackboneElementProperties(json, res);
24135    if (json.has("type"))
24136      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Subscription.SubscriptionChannelType.NULL, new Subscription.SubscriptionChannelTypeEnumFactory()));
24137    if (json.has("_type"))
24138      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
24139    if (json.has("endpoint"))
24140      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
24141    if (json.has("_endpoint"))
24142      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
24143    if (json.has("payload"))
24144      res.setPayloadElement(parseCode(json.get("payload").getAsString()));
24145    if (json.has("_payload"))
24146      parseElementProperties(json.getAsJsonObject("_payload"), res.getPayloadElement());
24147    if (json.has("header")) {
24148      JsonArray array = json.getAsJsonArray("header");
24149      for (int i = 0; i < array.size(); i++) {
24150        res.getHeader().add(parseString(array.get(i).getAsString()));
24151      }
24152    };
24153    if (json.has("_header")) {
24154      JsonArray array = json.getAsJsonArray("_header");
24155      for (int i = 0; i < array.size(); i++) {
24156        if (i == res.getHeader().size())
24157          res.getHeader().add(parseString(null));
24158        if (array.get(i) instanceof JsonObject) 
24159          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
24160      }
24161    };
24162  }
24163
24164  protected Substance parseSubstance(JsonObject json) throws IOException, FHIRFormatError {
24165    Substance res = new Substance();
24166    parseSubstanceProperties(json, res);
24167    return res;
24168  }
24169
24170  protected void parseSubstanceProperties(JsonObject json, Substance res) throws IOException, FHIRFormatError {
24171    parseDomainResourceProperties(json, res);
24172    if (json.has("identifier")) {
24173      JsonArray array = json.getAsJsonArray("identifier");
24174      for (int i = 0; i < array.size(); i++) {
24175        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24176      }
24177    };
24178    if (json.has("status"))
24179      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Substance.FHIRSubstanceStatus.NULL, new Substance.FHIRSubstanceStatusEnumFactory()));
24180    if (json.has("_status"))
24181      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
24182    if (json.has("category")) {
24183      JsonArray array = json.getAsJsonArray("category");
24184      for (int i = 0; i < array.size(); i++) {
24185        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24186      }
24187    };
24188    if (json.has("code"))
24189      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
24190    if (json.has("description"))
24191      res.setDescriptionElement(parseString(json.get("description").getAsString()));
24192    if (json.has("_description"))
24193      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
24194    if (json.has("instance")) {
24195      JsonArray array = json.getAsJsonArray("instance");
24196      for (int i = 0; i < array.size(); i++) {
24197        res.getInstance().add(parseSubstanceSubstanceInstanceComponent(array.get(i).getAsJsonObject(), res));
24198      }
24199    };
24200    if (json.has("ingredient")) {
24201      JsonArray array = json.getAsJsonArray("ingredient");
24202      for (int i = 0; i < array.size(); i++) {
24203        res.getIngredient().add(parseSubstanceSubstanceIngredientComponent(array.get(i).getAsJsonObject(), res));
24204      }
24205    };
24206  }
24207
24208  protected Substance.SubstanceInstanceComponent parseSubstanceSubstanceInstanceComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
24209    Substance.SubstanceInstanceComponent res = new Substance.SubstanceInstanceComponent();
24210    parseSubstanceSubstanceInstanceComponentProperties(json, owner, res);
24211    return res;
24212  }
24213
24214  protected void parseSubstanceSubstanceInstanceComponentProperties(JsonObject json, Substance owner, Substance.SubstanceInstanceComponent res) throws IOException, FHIRFormatError {
24215    parseBackboneElementProperties(json, res);
24216    if (json.has("identifier"))
24217      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
24218    if (json.has("expiry"))
24219      res.setExpiryElement(parseDateTime(json.get("expiry").getAsString()));
24220    if (json.has("_expiry"))
24221      parseElementProperties(json.getAsJsonObject("_expiry"), res.getExpiryElement());
24222    if (json.has("quantity"))
24223      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
24224  }
24225
24226  protected Substance.SubstanceIngredientComponent parseSubstanceSubstanceIngredientComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
24227    Substance.SubstanceIngredientComponent res = new Substance.SubstanceIngredientComponent();
24228    parseSubstanceSubstanceIngredientComponentProperties(json, owner, res);
24229    return res;
24230  }
24231
24232  protected void parseSubstanceSubstanceIngredientComponentProperties(JsonObject json, Substance owner, Substance.SubstanceIngredientComponent res) throws IOException, FHIRFormatError {
24233    parseBackboneElementProperties(json, res);
24234    if (json.has("quantity"))
24235      res.setQuantity(parseRatio(json.getAsJsonObject("quantity")));
24236    Type substance = parseType("substance", json);
24237    if (substance != null)
24238      res.setSubstance(substance);
24239  }
24240
24241  protected SubstanceNucleicAcid parseSubstanceNucleicAcid(JsonObject json) throws IOException, FHIRFormatError {
24242    SubstanceNucleicAcid res = new SubstanceNucleicAcid();
24243    parseSubstanceNucleicAcidProperties(json, res);
24244    return res;
24245  }
24246
24247  protected void parseSubstanceNucleicAcidProperties(JsonObject json, SubstanceNucleicAcid res) throws IOException, FHIRFormatError {
24248    parseDomainResourceProperties(json, res);
24249    if (json.has("sequenceType"))
24250      res.setSequenceType(parseCodeableConcept(json.getAsJsonObject("sequenceType")));
24251    if (json.has("numberOfSubunits"))
24252      res.setNumberOfSubunitsElement(parseInteger(json.get("numberOfSubunits").getAsLong()));
24253    if (json.has("_numberOfSubunits"))
24254      parseElementProperties(json.getAsJsonObject("_numberOfSubunits"), res.getNumberOfSubunitsElement());
24255    if (json.has("areaOfHybridisation"))
24256      res.setAreaOfHybridisationElement(parseString(json.get("areaOfHybridisation").getAsString()));
24257    if (json.has("_areaOfHybridisation"))
24258      parseElementProperties(json.getAsJsonObject("_areaOfHybridisation"), res.getAreaOfHybridisationElement());
24259    if (json.has("oligoNucleotideType"))
24260      res.setOligoNucleotideType(parseCodeableConcept(json.getAsJsonObject("oligoNucleotideType")));
24261    if (json.has("subunit")) {
24262      JsonArray array = json.getAsJsonArray("subunit");
24263      for (int i = 0; i < array.size(); i++) {
24264        res.getSubunit().add(parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(array.get(i).getAsJsonObject(), res));
24265      }
24266    };
24267  }
24268
24269  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(JsonObject json, SubstanceNucleicAcid owner) throws IOException, FHIRFormatError {
24270    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent();
24271    parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentProperties(json, owner, res);
24272    return res;
24273  }
24274
24275  protected void parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentProperties(JsonObject json, SubstanceNucleicAcid owner, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent res) throws IOException, FHIRFormatError {
24276    parseBackboneElementProperties(json, res);
24277    if (json.has("subunit"))
24278      res.setSubunitElement(parseInteger(json.get("subunit").getAsLong()));
24279    if (json.has("_subunit"))
24280      parseElementProperties(json.getAsJsonObject("_subunit"), res.getSubunitElement());
24281    if (json.has("sequence"))
24282      res.setSequenceElement(parseString(json.get("sequence").getAsString()));
24283    if (json.has("_sequence"))
24284      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
24285    if (json.has("length"))
24286      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
24287    if (json.has("_length"))
24288      parseElementProperties(json.getAsJsonObject("_length"), res.getLengthElement());
24289    if (json.has("sequenceAttachment"))
24290      res.setSequenceAttachment(parseAttachment(json.getAsJsonObject("sequenceAttachment")));
24291    if (json.has("fivePrime"))
24292      res.setFivePrime(parseCodeableConcept(json.getAsJsonObject("fivePrime")));
24293    if (json.has("threePrime"))
24294      res.setThreePrime(parseCodeableConcept(json.getAsJsonObject("threePrime")));
24295    if (json.has("linkage")) {
24296      JsonArray array = json.getAsJsonArray("linkage");
24297      for (int i = 0; i < array.size(); i++) {
24298        res.getLinkage().add(parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(array.get(i).getAsJsonObject(), owner));
24299      }
24300    };
24301    if (json.has("sugar")) {
24302      JsonArray array = json.getAsJsonArray("sugar");
24303      for (int i = 0; i < array.size(); i++) {
24304        res.getSugar().add(parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(array.get(i).getAsJsonObject(), owner));
24305      }
24306    };
24307  }
24308
24309  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(JsonObject json, SubstanceNucleicAcid owner) throws IOException, FHIRFormatError {
24310    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent();
24311    parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentProperties(json, owner, res);
24312    return res;
24313  }
24314
24315  protected void parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentProperties(JsonObject json, SubstanceNucleicAcid owner, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent res) throws IOException, FHIRFormatError {
24316    parseBackboneElementProperties(json, res);
24317    if (json.has("connectivity"))
24318      res.setConnectivityElement(parseString(json.get("connectivity").getAsString()));
24319    if (json.has("_connectivity"))
24320      parseElementProperties(json.getAsJsonObject("_connectivity"), res.getConnectivityElement());
24321    if (json.has("identifier"))
24322      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
24323    if (json.has("name"))
24324      res.setNameElement(parseString(json.get("name").getAsString()));
24325    if (json.has("_name"))
24326      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24327    if (json.has("residueSite"))
24328      res.setResidueSiteElement(parseString(json.get("residueSite").getAsString()));
24329    if (json.has("_residueSite"))
24330      parseElementProperties(json.getAsJsonObject("_residueSite"), res.getResidueSiteElement());
24331  }
24332
24333  protected SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(JsonObject json, SubstanceNucleicAcid owner) throws IOException, FHIRFormatError {
24334    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent();
24335    parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentProperties(json, owner, res);
24336    return res;
24337  }
24338
24339  protected void parseSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentProperties(JsonObject json, SubstanceNucleicAcid owner, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent res) throws IOException, FHIRFormatError {
24340    parseBackboneElementProperties(json, res);
24341    if (json.has("identifier"))
24342      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
24343    if (json.has("name"))
24344      res.setNameElement(parseString(json.get("name").getAsString()));
24345    if (json.has("_name"))
24346      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24347    if (json.has("residueSite"))
24348      res.setResidueSiteElement(parseString(json.get("residueSite").getAsString()));
24349    if (json.has("_residueSite"))
24350      parseElementProperties(json.getAsJsonObject("_residueSite"), res.getResidueSiteElement());
24351  }
24352
24353  protected SubstancePolymer parseSubstancePolymer(JsonObject json) throws IOException, FHIRFormatError {
24354    SubstancePolymer res = new SubstancePolymer();
24355    parseSubstancePolymerProperties(json, res);
24356    return res;
24357  }
24358
24359  protected void parseSubstancePolymerProperties(JsonObject json, SubstancePolymer res) throws IOException, FHIRFormatError {
24360    parseDomainResourceProperties(json, res);
24361    if (json.has("class"))
24362      res.setClass_(parseCodeableConcept(json.getAsJsonObject("class")));
24363    if (json.has("geometry"))
24364      res.setGeometry(parseCodeableConcept(json.getAsJsonObject("geometry")));
24365    if (json.has("copolymerConnectivity")) {
24366      JsonArray array = json.getAsJsonArray("copolymerConnectivity");
24367      for (int i = 0; i < array.size(); i++) {
24368        res.getCopolymerConnectivity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24369      }
24370    };
24371    if (json.has("modification")) {
24372      JsonArray array = json.getAsJsonArray("modification");
24373      for (int i = 0; i < array.size(); i++) {
24374        res.getModification().add(parseString(array.get(i).getAsString()));
24375      }
24376    };
24377    if (json.has("_modification")) {
24378      JsonArray array = json.getAsJsonArray("_modification");
24379      for (int i = 0; i < array.size(); i++) {
24380        if (i == res.getModification().size())
24381          res.getModification().add(parseString(null));
24382        if (array.get(i) instanceof JsonObject) 
24383          parseElementProperties(array.get(i).getAsJsonObject(), res.getModification().get(i));
24384      }
24385    };
24386    if (json.has("monomerSet")) {
24387      JsonArray array = json.getAsJsonArray("monomerSet");
24388      for (int i = 0; i < array.size(); i++) {
24389        res.getMonomerSet().add(parseSubstancePolymerSubstancePolymerMonomerSetComponent(array.get(i).getAsJsonObject(), res));
24390      }
24391    };
24392    if (json.has("repeat")) {
24393      JsonArray array = json.getAsJsonArray("repeat");
24394      for (int i = 0; i < array.size(); i++) {
24395        res.getRepeat().add(parseSubstancePolymerSubstancePolymerRepeatComponent(array.get(i).getAsJsonObject(), res));
24396      }
24397    };
24398  }
24399
24400  protected SubstancePolymer.SubstancePolymerMonomerSetComponent parseSubstancePolymerSubstancePolymerMonomerSetComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
24401    SubstancePolymer.SubstancePolymerMonomerSetComponent res = new SubstancePolymer.SubstancePolymerMonomerSetComponent();
24402    parseSubstancePolymerSubstancePolymerMonomerSetComponentProperties(json, owner, res);
24403    return res;
24404  }
24405
24406  protected void parseSubstancePolymerSubstancePolymerMonomerSetComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerMonomerSetComponent res) throws IOException, FHIRFormatError {
24407    parseBackboneElementProperties(json, res);
24408    if (json.has("ratioType"))
24409      res.setRatioType(parseCodeableConcept(json.getAsJsonObject("ratioType")));
24410    if (json.has("startingMaterial")) {
24411      JsonArray array = json.getAsJsonArray("startingMaterial");
24412      for (int i = 0; i < array.size(); i++) {
24413        res.getStartingMaterial().add(parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(array.get(i).getAsJsonObject(), owner));
24414      }
24415    };
24416  }
24417
24418  protected SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
24419    SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent res = new SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent();
24420    parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentProperties(json, owner, res);
24421    return res;
24422  }
24423
24424  protected void parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent res) throws IOException, FHIRFormatError {
24425    parseBackboneElementProperties(json, res);
24426    if (json.has("material"))
24427      res.setMaterial(parseCodeableConcept(json.getAsJsonObject("material")));
24428    if (json.has("type"))
24429      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
24430    if (json.has("isDefining"))
24431      res.setIsDefiningElement(parseBoolean(json.get("isDefining").getAsBoolean()));
24432    if (json.has("_isDefining"))
24433      parseElementProperties(json.getAsJsonObject("_isDefining"), res.getIsDefiningElement());
24434    if (json.has("amount"))
24435      res.setAmount(parseSubstanceAmount(json.getAsJsonObject("amount")));
24436  }
24437
24438  protected SubstancePolymer.SubstancePolymerRepeatComponent parseSubstancePolymerSubstancePolymerRepeatComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
24439    SubstancePolymer.SubstancePolymerRepeatComponent res = new SubstancePolymer.SubstancePolymerRepeatComponent();
24440    parseSubstancePolymerSubstancePolymerRepeatComponentProperties(json, owner, res);
24441    return res;
24442  }
24443
24444  protected void parseSubstancePolymerSubstancePolymerRepeatComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatComponent res) throws IOException, FHIRFormatError {
24445    parseBackboneElementProperties(json, res);
24446    if (json.has("numberOfUnits"))
24447      res.setNumberOfUnitsElement(parseInteger(json.get("numberOfUnits").getAsLong()));
24448    if (json.has("_numberOfUnits"))
24449      parseElementProperties(json.getAsJsonObject("_numberOfUnits"), res.getNumberOfUnitsElement());
24450    if (json.has("averageMolecularFormula"))
24451      res.setAverageMolecularFormulaElement(parseString(json.get("averageMolecularFormula").getAsString()));
24452    if (json.has("_averageMolecularFormula"))
24453      parseElementProperties(json.getAsJsonObject("_averageMolecularFormula"), res.getAverageMolecularFormulaElement());
24454    if (json.has("repeatUnitAmountType"))
24455      res.setRepeatUnitAmountType(parseCodeableConcept(json.getAsJsonObject("repeatUnitAmountType")));
24456    if (json.has("repeatUnit")) {
24457      JsonArray array = json.getAsJsonArray("repeatUnit");
24458      for (int i = 0; i < array.size(); i++) {
24459        res.getRepeatUnit().add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(array.get(i).getAsJsonObject(), owner));
24460      }
24461    };
24462  }
24463
24464  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
24465    SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent();
24466    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentProperties(json, owner, res);
24467    return res;
24468  }
24469
24470  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent res) throws IOException, FHIRFormatError {
24471    parseBackboneElementProperties(json, res);
24472    if (json.has("orientationOfPolymerisation"))
24473      res.setOrientationOfPolymerisation(parseCodeableConcept(json.getAsJsonObject("orientationOfPolymerisation")));
24474    if (json.has("repeatUnit"))
24475      res.setRepeatUnitElement(parseString(json.get("repeatUnit").getAsString()));
24476    if (json.has("_repeatUnit"))
24477      parseElementProperties(json.getAsJsonObject("_repeatUnit"), res.getRepeatUnitElement());
24478    if (json.has("amount"))
24479      res.setAmount(parseSubstanceAmount(json.getAsJsonObject("amount")));
24480    if (json.has("degreeOfPolymerisation")) {
24481      JsonArray array = json.getAsJsonArray("degreeOfPolymerisation");
24482      for (int i = 0; i < array.size(); i++) {
24483        res.getDegreeOfPolymerisation().add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(array.get(i).getAsJsonObject(), owner));
24484      }
24485    };
24486    if (json.has("structuralRepresentation")) {
24487      JsonArray array = json.getAsJsonArray("structuralRepresentation");
24488      for (int i = 0; i < array.size(); i++) {
24489        res.getStructuralRepresentation().add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(array.get(i).getAsJsonObject(), owner));
24490      }
24491    };
24492  }
24493
24494  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
24495    SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent();
24496    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(json, owner, res);
24497    return res;
24498  }
24499
24500  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent res) throws IOException, FHIRFormatError {
24501    parseBackboneElementProperties(json, res);
24502    if (json.has("degree"))
24503      res.setDegree(parseCodeableConcept(json.getAsJsonObject("degree")));
24504    if (json.has("amount"))
24505      res.setAmount(parseSubstanceAmount(json.getAsJsonObject("amount")));
24506  }
24507
24508  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
24509    SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent();
24510    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(json, owner, res);
24511    return res;
24512  }
24513
24514  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent res) throws IOException, FHIRFormatError {
24515    parseBackboneElementProperties(json, res);
24516    if (json.has("type"))
24517      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
24518    if (json.has("representation"))
24519      res.setRepresentationElement(parseString(json.get("representation").getAsString()));
24520    if (json.has("_representation"))
24521      parseElementProperties(json.getAsJsonObject("_representation"), res.getRepresentationElement());
24522    if (json.has("attachment"))
24523      res.setAttachment(parseAttachment(json.getAsJsonObject("attachment")));
24524  }
24525
24526  protected SubstanceProtein parseSubstanceProtein(JsonObject json) throws IOException, FHIRFormatError {
24527    SubstanceProtein res = new SubstanceProtein();
24528    parseSubstanceProteinProperties(json, res);
24529    return res;
24530  }
24531
24532  protected void parseSubstanceProteinProperties(JsonObject json, SubstanceProtein res) throws IOException, FHIRFormatError {
24533    parseDomainResourceProperties(json, res);
24534    if (json.has("sequenceType"))
24535      res.setSequenceType(parseCodeableConcept(json.getAsJsonObject("sequenceType")));
24536    if (json.has("numberOfSubunits"))
24537      res.setNumberOfSubunitsElement(parseInteger(json.get("numberOfSubunits").getAsLong()));
24538    if (json.has("_numberOfSubunits"))
24539      parseElementProperties(json.getAsJsonObject("_numberOfSubunits"), res.getNumberOfSubunitsElement());
24540    if (json.has("disulfideLinkage")) {
24541      JsonArray array = json.getAsJsonArray("disulfideLinkage");
24542      for (int i = 0; i < array.size(); i++) {
24543        res.getDisulfideLinkage().add(parseString(array.get(i).getAsString()));
24544      }
24545    };
24546    if (json.has("_disulfideLinkage")) {
24547      JsonArray array = json.getAsJsonArray("_disulfideLinkage");
24548      for (int i = 0; i < array.size(); i++) {
24549        if (i == res.getDisulfideLinkage().size())
24550          res.getDisulfideLinkage().add(parseString(null));
24551        if (array.get(i) instanceof JsonObject) 
24552          parseElementProperties(array.get(i).getAsJsonObject(), res.getDisulfideLinkage().get(i));
24553      }
24554    };
24555    if (json.has("subunit")) {
24556      JsonArray array = json.getAsJsonArray("subunit");
24557      for (int i = 0; i < array.size(); i++) {
24558        res.getSubunit().add(parseSubstanceProteinSubstanceProteinSubunitComponent(array.get(i).getAsJsonObject(), res));
24559      }
24560    };
24561  }
24562
24563  protected SubstanceProtein.SubstanceProteinSubunitComponent parseSubstanceProteinSubstanceProteinSubunitComponent(JsonObject json, SubstanceProtein owner) throws IOException, FHIRFormatError {
24564    SubstanceProtein.SubstanceProteinSubunitComponent res = new SubstanceProtein.SubstanceProteinSubunitComponent();
24565    parseSubstanceProteinSubstanceProteinSubunitComponentProperties(json, owner, res);
24566    return res;
24567  }
24568
24569  protected void parseSubstanceProteinSubstanceProteinSubunitComponentProperties(JsonObject json, SubstanceProtein owner, SubstanceProtein.SubstanceProteinSubunitComponent res) throws IOException, FHIRFormatError {
24570    parseBackboneElementProperties(json, res);
24571    if (json.has("subunit"))
24572      res.setSubunitElement(parseInteger(json.get("subunit").getAsLong()));
24573    if (json.has("_subunit"))
24574      parseElementProperties(json.getAsJsonObject("_subunit"), res.getSubunitElement());
24575    if (json.has("sequence"))
24576      res.setSequenceElement(parseString(json.get("sequence").getAsString()));
24577    if (json.has("_sequence"))
24578      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
24579    if (json.has("length"))
24580      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
24581    if (json.has("_length"))
24582      parseElementProperties(json.getAsJsonObject("_length"), res.getLengthElement());
24583    if (json.has("sequenceAttachment"))
24584      res.setSequenceAttachment(parseAttachment(json.getAsJsonObject("sequenceAttachment")));
24585    if (json.has("nTerminalModificationId"))
24586      res.setNTerminalModificationId(parseIdentifier(json.getAsJsonObject("nTerminalModificationId")));
24587    if (json.has("nTerminalModification"))
24588      res.setNTerminalModificationElement(parseString(json.get("nTerminalModification").getAsString()));
24589    if (json.has("_nTerminalModification"))
24590      parseElementProperties(json.getAsJsonObject("_nTerminalModification"), res.getNTerminalModificationElement());
24591    if (json.has("cTerminalModificationId"))
24592      res.setCTerminalModificationId(parseIdentifier(json.getAsJsonObject("cTerminalModificationId")));
24593    if (json.has("cTerminalModification"))
24594      res.setCTerminalModificationElement(parseString(json.get("cTerminalModification").getAsString()));
24595    if (json.has("_cTerminalModification"))
24596      parseElementProperties(json.getAsJsonObject("_cTerminalModification"), res.getCTerminalModificationElement());
24597  }
24598
24599  protected SubstanceReferenceInformation parseSubstanceReferenceInformation(JsonObject json) throws IOException, FHIRFormatError {
24600    SubstanceReferenceInformation res = new SubstanceReferenceInformation();
24601    parseSubstanceReferenceInformationProperties(json, res);
24602    return res;
24603  }
24604
24605  protected void parseSubstanceReferenceInformationProperties(JsonObject json, SubstanceReferenceInformation res) throws IOException, FHIRFormatError {
24606    parseDomainResourceProperties(json, res);
24607    if (json.has("comment"))
24608      res.setCommentElement(parseString(json.get("comment").getAsString()));
24609    if (json.has("_comment"))
24610      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
24611    if (json.has("gene")) {
24612      JsonArray array = json.getAsJsonArray("gene");
24613      for (int i = 0; i < array.size(); i++) {
24614        res.getGene().add(parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(array.get(i).getAsJsonObject(), res));
24615      }
24616    };
24617    if (json.has("geneElement")) {
24618      JsonArray array = json.getAsJsonArray("geneElement");
24619      for (int i = 0; i < array.size(); i++) {
24620        res.getGeneElement().add(parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(array.get(i).getAsJsonObject(), res));
24621      }
24622    };
24623    if (json.has("classification")) {
24624      JsonArray array = json.getAsJsonArray("classification");
24625      for (int i = 0; i < array.size(); i++) {
24626        res.getClassification().add(parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(array.get(i).getAsJsonObject(), res));
24627      }
24628    };
24629    if (json.has("target")) {
24630      JsonArray array = json.getAsJsonArray("target");
24631      for (int i = 0; i < array.size(); i++) {
24632        res.getTarget().add(parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(array.get(i).getAsJsonObject(), res));
24633      }
24634    };
24635  }
24636
24637  protected SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
24638    SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent();
24639    parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentProperties(json, owner, res);
24640    return res;
24641  }
24642
24643  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent res) throws IOException, FHIRFormatError {
24644    parseBackboneElementProperties(json, res);
24645    if (json.has("geneSequenceOrigin"))
24646      res.setGeneSequenceOrigin(parseCodeableConcept(json.getAsJsonObject("geneSequenceOrigin")));
24647    if (json.has("gene"))
24648      res.setGene(parseCodeableConcept(json.getAsJsonObject("gene")));
24649    if (json.has("source")) {
24650      JsonArray array = json.getAsJsonArray("source");
24651      for (int i = 0; i < array.size(); i++) {
24652        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
24653      }
24654    };
24655  }
24656
24657  protected SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
24658    SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent();
24659    parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentProperties(json, owner, res);
24660    return res;
24661  }
24662
24663  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent res) throws IOException, FHIRFormatError {
24664    parseBackboneElementProperties(json, res);
24665    if (json.has("type"))
24666      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
24667    if (json.has("element"))
24668      res.setElement(parseIdentifier(json.getAsJsonObject("element")));
24669    if (json.has("source")) {
24670      JsonArray array = json.getAsJsonArray("source");
24671      for (int i = 0; i < array.size(); i++) {
24672        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
24673      }
24674    };
24675  }
24676
24677  protected SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
24678    SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent();
24679    parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentProperties(json, owner, res);
24680    return res;
24681  }
24682
24683  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent res) throws IOException, FHIRFormatError {
24684    parseBackboneElementProperties(json, res);
24685    if (json.has("domain"))
24686      res.setDomain(parseCodeableConcept(json.getAsJsonObject("domain")));
24687    if (json.has("classification"))
24688      res.setClassification(parseCodeableConcept(json.getAsJsonObject("classification")));
24689    if (json.has("subtype")) {
24690      JsonArray array = json.getAsJsonArray("subtype");
24691      for (int i = 0; i < array.size(); i++) {
24692        res.getSubtype().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24693      }
24694    };
24695    if (json.has("source")) {
24696      JsonArray array = json.getAsJsonArray("source");
24697      for (int i = 0; i < array.size(); i++) {
24698        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
24699      }
24700    };
24701  }
24702
24703  protected SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
24704    SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent();
24705    parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentProperties(json, owner, res);
24706    return res;
24707  }
24708
24709  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent res) throws IOException, FHIRFormatError {
24710    parseBackboneElementProperties(json, res);
24711    if (json.has("target"))
24712      res.setTarget(parseIdentifier(json.getAsJsonObject("target")));
24713    if (json.has("type"))
24714      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
24715    if (json.has("interaction"))
24716      res.setInteraction(parseCodeableConcept(json.getAsJsonObject("interaction")));
24717    if (json.has("organism"))
24718      res.setOrganism(parseCodeableConcept(json.getAsJsonObject("organism")));
24719    if (json.has("organismType"))
24720      res.setOrganismType(parseCodeableConcept(json.getAsJsonObject("organismType")));
24721    Type amount = parseType("amount", json);
24722    if (amount != null)
24723      res.setAmount(amount);
24724    if (json.has("amountType"))
24725      res.setAmountType(parseCodeableConcept(json.getAsJsonObject("amountType")));
24726    if (json.has("source")) {
24727      JsonArray array = json.getAsJsonArray("source");
24728      for (int i = 0; i < array.size(); i++) {
24729        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
24730      }
24731    };
24732  }
24733
24734  protected SubstanceSourceMaterial parseSubstanceSourceMaterial(JsonObject json) throws IOException, FHIRFormatError {
24735    SubstanceSourceMaterial res = new SubstanceSourceMaterial();
24736    parseSubstanceSourceMaterialProperties(json, res);
24737    return res;
24738  }
24739
24740  protected void parseSubstanceSourceMaterialProperties(JsonObject json, SubstanceSourceMaterial res) throws IOException, FHIRFormatError {
24741    parseDomainResourceProperties(json, res);
24742    if (json.has("sourceMaterialClass"))
24743      res.setSourceMaterialClass(parseCodeableConcept(json.getAsJsonObject("sourceMaterialClass")));
24744    if (json.has("sourceMaterialType"))
24745      res.setSourceMaterialType(parseCodeableConcept(json.getAsJsonObject("sourceMaterialType")));
24746    if (json.has("sourceMaterialState"))
24747      res.setSourceMaterialState(parseCodeableConcept(json.getAsJsonObject("sourceMaterialState")));
24748    if (json.has("organismId"))
24749      res.setOrganismId(parseIdentifier(json.getAsJsonObject("organismId")));
24750    if (json.has("organismName"))
24751      res.setOrganismNameElement(parseString(json.get("organismName").getAsString()));
24752    if (json.has("_organismName"))
24753      parseElementProperties(json.getAsJsonObject("_organismName"), res.getOrganismNameElement());
24754    if (json.has("parentSubstanceId")) {
24755      JsonArray array = json.getAsJsonArray("parentSubstanceId");
24756      for (int i = 0; i < array.size(); i++) {
24757        res.getParentSubstanceId().add(parseIdentifier(array.get(i).getAsJsonObject()));
24758      }
24759    };
24760    if (json.has("parentSubstanceName")) {
24761      JsonArray array = json.getAsJsonArray("parentSubstanceName");
24762      for (int i = 0; i < array.size(); i++) {
24763        res.getParentSubstanceName().add(parseString(array.get(i).getAsString()));
24764      }
24765    };
24766    if (json.has("_parentSubstanceName")) {
24767      JsonArray array = json.getAsJsonArray("_parentSubstanceName");
24768      for (int i = 0; i < array.size(); i++) {
24769        if (i == res.getParentSubstanceName().size())
24770          res.getParentSubstanceName().add(parseString(null));
24771        if (array.get(i) instanceof JsonObject) 
24772          parseElementProperties(array.get(i).getAsJsonObject(), res.getParentSubstanceName().get(i));
24773      }
24774    };
24775    if (json.has("countryOfOrigin")) {
24776      JsonArray array = json.getAsJsonArray("countryOfOrigin");
24777      for (int i = 0; i < array.size(); i++) {
24778        res.getCountryOfOrigin().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24779      }
24780    };
24781    if (json.has("geographicalLocation")) {
24782      JsonArray array = json.getAsJsonArray("geographicalLocation");
24783      for (int i = 0; i < array.size(); i++) {
24784        res.getGeographicalLocation().add(parseString(array.get(i).getAsString()));
24785      }
24786    };
24787    if (json.has("_geographicalLocation")) {
24788      JsonArray array = json.getAsJsonArray("_geographicalLocation");
24789      for (int i = 0; i < array.size(); i++) {
24790        if (i == res.getGeographicalLocation().size())
24791          res.getGeographicalLocation().add(parseString(null));
24792        if (array.get(i) instanceof JsonObject) 
24793          parseElementProperties(array.get(i).getAsJsonObject(), res.getGeographicalLocation().get(i));
24794      }
24795    };
24796    if (json.has("developmentStage"))
24797      res.setDevelopmentStage(parseCodeableConcept(json.getAsJsonObject("developmentStage")));
24798    if (json.has("fractionDescription")) {
24799      JsonArray array = json.getAsJsonArray("fractionDescription");
24800      for (int i = 0; i < array.size(); i++) {
24801        res.getFractionDescription().add(parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(array.get(i).getAsJsonObject(), res));
24802      }
24803    };
24804    if (json.has("organism"))
24805      res.setOrganism(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent(json.getAsJsonObject("organism"), res));
24806    if (json.has("partDescription")) {
24807      JsonArray array = json.getAsJsonArray("partDescription");
24808      for (int i = 0; i < array.size(); i++) {
24809        res.getPartDescription().add(parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(array.get(i).getAsJsonObject(), res));
24810      }
24811    };
24812  }
24813
24814  protected SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
24815    SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent();
24816    parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentProperties(json, owner, res);
24817    return res;
24818  }
24819
24820  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent res) throws IOException, FHIRFormatError {
24821    parseBackboneElementProperties(json, res);
24822    if (json.has("fraction"))
24823      res.setFractionElement(parseString(json.get("fraction").getAsString()));
24824    if (json.has("_fraction"))
24825      parseElementProperties(json.getAsJsonObject("_fraction"), res.getFractionElement());
24826    if (json.has("materialType"))
24827      res.setMaterialType(parseCodeableConcept(json.getAsJsonObject("materialType")));
24828  }
24829
24830  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
24831    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent();
24832    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentProperties(json, owner, res);
24833    return res;
24834  }
24835
24836  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent res) throws IOException, FHIRFormatError {
24837    parseBackboneElementProperties(json, res);
24838    if (json.has("family"))
24839      res.setFamily(parseCodeableConcept(json.getAsJsonObject("family")));
24840    if (json.has("genus"))
24841      res.setGenus(parseCodeableConcept(json.getAsJsonObject("genus")));
24842    if (json.has("species"))
24843      res.setSpecies(parseCodeableConcept(json.getAsJsonObject("species")));
24844    if (json.has("intraspecificType"))
24845      res.setIntraspecificType(parseCodeableConcept(json.getAsJsonObject("intraspecificType")));
24846    if (json.has("intraspecificDescription"))
24847      res.setIntraspecificDescriptionElement(parseString(json.get("intraspecificDescription").getAsString()));
24848    if (json.has("_intraspecificDescription"))
24849      parseElementProperties(json.getAsJsonObject("_intraspecificDescription"), res.getIntraspecificDescriptionElement());
24850    if (json.has("author")) {
24851      JsonArray array = json.getAsJsonArray("author");
24852      for (int i = 0; i < array.size(); i++) {
24853        res.getAuthor().add(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(array.get(i).getAsJsonObject(), owner));
24854      }
24855    };
24856    if (json.has("hybrid"))
24857      res.setHybrid(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent(json.getAsJsonObject("hybrid"), owner));
24858    if (json.has("organismGeneral"))
24859      res.setOrganismGeneral(parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent(json.getAsJsonObject("organismGeneral"), owner));
24860  }
24861
24862  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
24863    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent();
24864    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentProperties(json, owner, res);
24865    return res;
24866  }
24867
24868  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent res) throws IOException, FHIRFormatError {
24869    parseBackboneElementProperties(json, res);
24870    if (json.has("authorType"))
24871      res.setAuthorType(parseCodeableConcept(json.getAsJsonObject("authorType")));
24872    if (json.has("authorDescription"))
24873      res.setAuthorDescriptionElement(parseString(json.get("authorDescription").getAsString()));
24874    if (json.has("_authorDescription"))
24875      parseElementProperties(json.getAsJsonObject("_authorDescription"), res.getAuthorDescriptionElement());
24876  }
24877
24878  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
24879    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent();
24880    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentProperties(json, owner, res);
24881    return res;
24882  }
24883
24884  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent res) throws IOException, FHIRFormatError {
24885    parseBackboneElementProperties(json, res);
24886    if (json.has("maternalOrganismId"))
24887      res.setMaternalOrganismIdElement(parseString(json.get("maternalOrganismId").getAsString()));
24888    if (json.has("_maternalOrganismId"))
24889      parseElementProperties(json.getAsJsonObject("_maternalOrganismId"), res.getMaternalOrganismIdElement());
24890    if (json.has("maternalOrganismName"))
24891      res.setMaternalOrganismNameElement(parseString(json.get("maternalOrganismName").getAsString()));
24892    if (json.has("_maternalOrganismName"))
24893      parseElementProperties(json.getAsJsonObject("_maternalOrganismName"), res.getMaternalOrganismNameElement());
24894    if (json.has("paternalOrganismId"))
24895      res.setPaternalOrganismIdElement(parseString(json.get("paternalOrganismId").getAsString()));
24896    if (json.has("_paternalOrganismId"))
24897      parseElementProperties(json.getAsJsonObject("_paternalOrganismId"), res.getPaternalOrganismIdElement());
24898    if (json.has("paternalOrganismName"))
24899      res.setPaternalOrganismNameElement(parseString(json.get("paternalOrganismName").getAsString()));
24900    if (json.has("_paternalOrganismName"))
24901      parseElementProperties(json.getAsJsonObject("_paternalOrganismName"), res.getPaternalOrganismNameElement());
24902    if (json.has("hybridType"))
24903      res.setHybridType(parseCodeableConcept(json.getAsJsonObject("hybridType")));
24904  }
24905
24906  protected SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
24907    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent();
24908    parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentProperties(json, owner, res);
24909    return res;
24910  }
24911
24912  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent res) throws IOException, FHIRFormatError {
24913    parseBackboneElementProperties(json, res);
24914    if (json.has("kingdom"))
24915      res.setKingdom(parseCodeableConcept(json.getAsJsonObject("kingdom")));
24916    if (json.has("phylum"))
24917      res.setPhylum(parseCodeableConcept(json.getAsJsonObject("phylum")));
24918    if (json.has("class"))
24919      res.setClass_(parseCodeableConcept(json.getAsJsonObject("class")));
24920    if (json.has("order"))
24921      res.setOrder(parseCodeableConcept(json.getAsJsonObject("order")));
24922  }
24923
24924  protected SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(JsonObject json, SubstanceSourceMaterial owner) throws IOException, FHIRFormatError {
24925    SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent();
24926    parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentProperties(json, owner, res);
24927    return res;
24928  }
24929
24930  protected void parseSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentProperties(JsonObject json, SubstanceSourceMaterial owner, SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent res) throws IOException, FHIRFormatError {
24931    parseBackboneElementProperties(json, res);
24932    if (json.has("part"))
24933      res.setPart(parseCodeableConcept(json.getAsJsonObject("part")));
24934    if (json.has("partLocation"))
24935      res.setPartLocation(parseCodeableConcept(json.getAsJsonObject("partLocation")));
24936  }
24937
24938  protected SubstanceSpecification parseSubstanceSpecification(JsonObject json) throws IOException, FHIRFormatError {
24939    SubstanceSpecification res = new SubstanceSpecification();
24940    parseSubstanceSpecificationProperties(json, res);
24941    return res;
24942  }
24943
24944  protected void parseSubstanceSpecificationProperties(JsonObject json, SubstanceSpecification res) throws IOException, FHIRFormatError {
24945    parseDomainResourceProperties(json, res);
24946    if (json.has("identifier"))
24947      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
24948    if (json.has("type"))
24949      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
24950    if (json.has("status"))
24951      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
24952    if (json.has("domain"))
24953      res.setDomain(parseCodeableConcept(json.getAsJsonObject("domain")));
24954    if (json.has("description"))
24955      res.setDescriptionElement(parseString(json.get("description").getAsString()));
24956    if (json.has("_description"))
24957      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
24958    if (json.has("source")) {
24959      JsonArray array = json.getAsJsonArray("source");
24960      for (int i = 0; i < array.size(); i++) {
24961        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
24962      }
24963    };
24964    if (json.has("comment"))
24965      res.setCommentElement(parseString(json.get("comment").getAsString()));
24966    if (json.has("_comment"))
24967      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
24968    if (json.has("moiety")) {
24969      JsonArray array = json.getAsJsonArray("moiety");
24970      for (int i = 0; i < array.size(); i++) {
24971        res.getMoiety().add(parseSubstanceSpecificationSubstanceSpecificationMoietyComponent(array.get(i).getAsJsonObject(), res));
24972      }
24973    };
24974    if (json.has("property")) {
24975      JsonArray array = json.getAsJsonArray("property");
24976      for (int i = 0; i < array.size(); i++) {
24977        res.getProperty().add(parseSubstanceSpecificationSubstanceSpecificationPropertyComponent(array.get(i).getAsJsonObject(), res));
24978      }
24979    };
24980    if (json.has("referenceInformation"))
24981      res.setReferenceInformation(parseReference(json.getAsJsonObject("referenceInformation")));
24982    if (json.has("structure"))
24983      res.setStructure(parseSubstanceSpecificationSubstanceSpecificationStructureComponent(json.getAsJsonObject("structure"), res));
24984    if (json.has("code")) {
24985      JsonArray array = json.getAsJsonArray("code");
24986      for (int i = 0; i < array.size(); i++) {
24987        res.getCode().add(parseSubstanceSpecificationSubstanceSpecificationCodeComponent(array.get(i).getAsJsonObject(), res));
24988      }
24989    };
24990    if (json.has("name")) {
24991      JsonArray array = json.getAsJsonArray("name");
24992      for (int i = 0; i < array.size(); i++) {
24993        res.getName().add(parseSubstanceSpecificationSubstanceSpecificationNameComponent(array.get(i).getAsJsonObject(), res));
24994      }
24995    };
24996    if (json.has("molecularWeight")) {
24997      JsonArray array = json.getAsJsonArray("molecularWeight");
24998      for (int i = 0; i < array.size(); i++) {
24999        res.getMolecularWeight().add(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(array.get(i).getAsJsonObject(), res));
25000      }
25001    };
25002    if (json.has("relationship")) {
25003      JsonArray array = json.getAsJsonArray("relationship");
25004      for (int i = 0; i < array.size(); i++) {
25005        res.getRelationship().add(parseSubstanceSpecificationSubstanceSpecificationRelationshipComponent(array.get(i).getAsJsonObject(), res));
25006      }
25007    };
25008    if (json.has("nucleicAcid"))
25009      res.setNucleicAcid(parseReference(json.getAsJsonObject("nucleicAcid")));
25010    if (json.has("polymer"))
25011      res.setPolymer(parseReference(json.getAsJsonObject("polymer")));
25012    if (json.has("protein"))
25013      res.setProtein(parseReference(json.getAsJsonObject("protein")));
25014    if (json.has("sourceMaterial"))
25015      res.setSourceMaterial(parseReference(json.getAsJsonObject("sourceMaterial")));
25016  }
25017
25018  protected SubstanceSpecification.SubstanceSpecificationMoietyComponent parseSubstanceSpecificationSubstanceSpecificationMoietyComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25019    SubstanceSpecification.SubstanceSpecificationMoietyComponent res = new SubstanceSpecification.SubstanceSpecificationMoietyComponent();
25020    parseSubstanceSpecificationSubstanceSpecificationMoietyComponentProperties(json, owner, res);
25021    return res;
25022  }
25023
25024  protected void parseSubstanceSpecificationSubstanceSpecificationMoietyComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationMoietyComponent res) throws IOException, FHIRFormatError {
25025    parseBackboneElementProperties(json, res);
25026    if (json.has("role"))
25027      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
25028    if (json.has("identifier"))
25029      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
25030    if (json.has("name"))
25031      res.setNameElement(parseString(json.get("name").getAsString()));
25032    if (json.has("_name"))
25033      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25034    if (json.has("stereochemistry"))
25035      res.setStereochemistry(parseCodeableConcept(json.getAsJsonObject("stereochemistry")));
25036    if (json.has("opticalActivity"))
25037      res.setOpticalActivity(parseCodeableConcept(json.getAsJsonObject("opticalActivity")));
25038    if (json.has("molecularFormula"))
25039      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
25040    if (json.has("_molecularFormula"))
25041      parseElementProperties(json.getAsJsonObject("_molecularFormula"), res.getMolecularFormulaElement());
25042    Type amount = parseType("amount", json);
25043    if (amount != null)
25044      res.setAmount(amount);
25045  }
25046
25047  protected SubstanceSpecification.SubstanceSpecificationPropertyComponent parseSubstanceSpecificationSubstanceSpecificationPropertyComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25048    SubstanceSpecification.SubstanceSpecificationPropertyComponent res = new SubstanceSpecification.SubstanceSpecificationPropertyComponent();
25049    parseSubstanceSpecificationSubstanceSpecificationPropertyComponentProperties(json, owner, res);
25050    return res;
25051  }
25052
25053  protected void parseSubstanceSpecificationSubstanceSpecificationPropertyComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationPropertyComponent res) throws IOException, FHIRFormatError {
25054    parseBackboneElementProperties(json, res);
25055    if (json.has("category"))
25056      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
25057    if (json.has("code"))
25058      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
25059    if (json.has("parameters"))
25060      res.setParametersElement(parseString(json.get("parameters").getAsString()));
25061    if (json.has("_parameters"))
25062      parseElementProperties(json.getAsJsonObject("_parameters"), res.getParametersElement());
25063    Type definingSubstance = parseType("definingSubstance", json);
25064    if (definingSubstance != null)
25065      res.setDefiningSubstance(definingSubstance);
25066    Type amount = parseType("amount", json);
25067    if (amount != null)
25068      res.setAmount(amount);
25069  }
25070
25071  protected SubstanceSpecification.SubstanceSpecificationStructureComponent parseSubstanceSpecificationSubstanceSpecificationStructureComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25072    SubstanceSpecification.SubstanceSpecificationStructureComponent res = new SubstanceSpecification.SubstanceSpecificationStructureComponent();
25073    parseSubstanceSpecificationSubstanceSpecificationStructureComponentProperties(json, owner, res);
25074    return res;
25075  }
25076
25077  protected void parseSubstanceSpecificationSubstanceSpecificationStructureComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureComponent res) throws IOException, FHIRFormatError {
25078    parseBackboneElementProperties(json, res);
25079    if (json.has("stereochemistry"))
25080      res.setStereochemistry(parseCodeableConcept(json.getAsJsonObject("stereochemistry")));
25081    if (json.has("opticalActivity"))
25082      res.setOpticalActivity(parseCodeableConcept(json.getAsJsonObject("opticalActivity")));
25083    if (json.has("molecularFormula"))
25084      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
25085    if (json.has("_molecularFormula"))
25086      parseElementProperties(json.getAsJsonObject("_molecularFormula"), res.getMolecularFormulaElement());
25087    if (json.has("molecularFormulaByMoiety"))
25088      res.setMolecularFormulaByMoietyElement(parseString(json.get("molecularFormulaByMoiety").getAsString()));
25089    if (json.has("_molecularFormulaByMoiety"))
25090      parseElementProperties(json.getAsJsonObject("_molecularFormulaByMoiety"), res.getMolecularFormulaByMoietyElement());
25091    if (json.has("isotope")) {
25092      JsonArray array = json.getAsJsonArray("isotope");
25093      for (int i = 0; i < array.size(); i++) {
25094        res.getIsotope().add(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(array.get(i).getAsJsonObject(), owner));
25095      }
25096    };
25097    if (json.has("molecularWeight"))
25098      res.setMolecularWeight(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(json.getAsJsonObject("molecularWeight"), owner));
25099    if (json.has("source")) {
25100      JsonArray array = json.getAsJsonArray("source");
25101      for (int i = 0; i < array.size(); i++) {
25102        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25103      }
25104    };
25105    if (json.has("representation")) {
25106      JsonArray array = json.getAsJsonArray("representation");
25107      for (int i = 0; i < array.size(); i++) {
25108        res.getRepresentation().add(parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent(array.get(i).getAsJsonObject(), owner));
25109      }
25110    };
25111  }
25112
25113  protected SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25114    SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent res = new SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent();
25115    parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentProperties(json, owner, res);
25116    return res;
25117  }
25118
25119  protected void parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent res) throws IOException, FHIRFormatError {
25120    parseBackboneElementProperties(json, res);
25121    if (json.has("identifier"))
25122      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
25123    if (json.has("name"))
25124      res.setName(parseCodeableConcept(json.getAsJsonObject("name")));
25125    if (json.has("substitution"))
25126      res.setSubstitution(parseCodeableConcept(json.getAsJsonObject("substitution")));
25127    if (json.has("halfLife"))
25128      res.setHalfLife(parseQuantity(json.getAsJsonObject("halfLife")));
25129    if (json.has("molecularWeight"))
25130      res.setMolecularWeight(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(json.getAsJsonObject("molecularWeight"), owner));
25131  }
25132
25133  protected SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25134    SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent res = new SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent();
25135    parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentProperties(json, owner, res);
25136    return res;
25137  }
25138
25139  protected void parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent res) throws IOException, FHIRFormatError {
25140    parseBackboneElementProperties(json, res);
25141    if (json.has("method"))
25142      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
25143    if (json.has("type"))
25144      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
25145    if (json.has("amount"))
25146      res.setAmount(parseQuantity(json.getAsJsonObject("amount")));
25147  }
25148
25149  protected SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25150    SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent res = new SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent();
25151    parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentProperties(json, owner, res);
25152    return res;
25153  }
25154
25155  protected void parseSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent res) throws IOException, FHIRFormatError {
25156    parseBackboneElementProperties(json, res);
25157    if (json.has("type"))
25158      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
25159    if (json.has("representation"))
25160      res.setRepresentationElement(parseString(json.get("representation").getAsString()));
25161    if (json.has("_representation"))
25162      parseElementProperties(json.getAsJsonObject("_representation"), res.getRepresentationElement());
25163    if (json.has("attachment"))
25164      res.setAttachment(parseAttachment(json.getAsJsonObject("attachment")));
25165  }
25166
25167  protected SubstanceSpecification.SubstanceSpecificationCodeComponent parseSubstanceSpecificationSubstanceSpecificationCodeComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25168    SubstanceSpecification.SubstanceSpecificationCodeComponent res = new SubstanceSpecification.SubstanceSpecificationCodeComponent();
25169    parseSubstanceSpecificationSubstanceSpecificationCodeComponentProperties(json, owner, res);
25170    return res;
25171  }
25172
25173  protected void parseSubstanceSpecificationSubstanceSpecificationCodeComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationCodeComponent res) throws IOException, FHIRFormatError {
25174    parseBackboneElementProperties(json, res);
25175    if (json.has("code"))
25176      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
25177    if (json.has("status"))
25178      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
25179    if (json.has("statusDate"))
25180      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
25181    if (json.has("_statusDate"))
25182      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
25183    if (json.has("comment"))
25184      res.setCommentElement(parseString(json.get("comment").getAsString()));
25185    if (json.has("_comment"))
25186      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
25187    if (json.has("source")) {
25188      JsonArray array = json.getAsJsonArray("source");
25189      for (int i = 0; i < array.size(); i++) {
25190        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25191      }
25192    };
25193  }
25194
25195  protected SubstanceSpecification.SubstanceSpecificationNameComponent parseSubstanceSpecificationSubstanceSpecificationNameComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25196    SubstanceSpecification.SubstanceSpecificationNameComponent res = new SubstanceSpecification.SubstanceSpecificationNameComponent();
25197    parseSubstanceSpecificationSubstanceSpecificationNameComponentProperties(json, owner, res);
25198    return res;
25199  }
25200
25201  protected void parseSubstanceSpecificationSubstanceSpecificationNameComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationNameComponent res) throws IOException, FHIRFormatError {
25202    parseBackboneElementProperties(json, res);
25203    if (json.has("name"))
25204      res.setNameElement(parseString(json.get("name").getAsString()));
25205    if (json.has("_name"))
25206      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25207    if (json.has("type"))
25208      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
25209    if (json.has("status"))
25210      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
25211    if (json.has("preferred"))
25212      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
25213    if (json.has("_preferred"))
25214      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
25215    if (json.has("language")) {
25216      JsonArray array = json.getAsJsonArray("language");
25217      for (int i = 0; i < array.size(); i++) {
25218        res.getLanguage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25219      }
25220    };
25221    if (json.has("domain")) {
25222      JsonArray array = json.getAsJsonArray("domain");
25223      for (int i = 0; i < array.size(); i++) {
25224        res.getDomain().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25225      }
25226    };
25227    if (json.has("jurisdiction")) {
25228      JsonArray array = json.getAsJsonArray("jurisdiction");
25229      for (int i = 0; i < array.size(); i++) {
25230        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25231      }
25232    };
25233    if (json.has("synonym")) {
25234      JsonArray array = json.getAsJsonArray("synonym");
25235      for (int i = 0; i < array.size(); i++) {
25236        res.getSynonym().add(parseSubstanceSpecificationSubstanceSpecificationNameComponent(array.get(i).getAsJsonObject(), owner));
25237      }
25238    };
25239    if (json.has("translation")) {
25240      JsonArray array = json.getAsJsonArray("translation");
25241      for (int i = 0; i < array.size(); i++) {
25242        res.getTranslation().add(parseSubstanceSpecificationSubstanceSpecificationNameComponent(array.get(i).getAsJsonObject(), owner));
25243      }
25244    };
25245    if (json.has("official")) {
25246      JsonArray array = json.getAsJsonArray("official");
25247      for (int i = 0; i < array.size(); i++) {
25248        res.getOfficial().add(parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponent(array.get(i).getAsJsonObject(), owner));
25249      }
25250    };
25251    if (json.has("source")) {
25252      JsonArray array = json.getAsJsonArray("source");
25253      for (int i = 0; i < array.size(); i++) {
25254        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25255      }
25256    };
25257  }
25258
25259  protected SubstanceSpecification.SubstanceSpecificationNameOfficialComponent parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25260    SubstanceSpecification.SubstanceSpecificationNameOfficialComponent res = new SubstanceSpecification.SubstanceSpecificationNameOfficialComponent();
25261    parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponentProperties(json, owner, res);
25262    return res;
25263  }
25264
25265  protected void parseSubstanceSpecificationSubstanceSpecificationNameOfficialComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationNameOfficialComponent res) throws IOException, FHIRFormatError {
25266    parseBackboneElementProperties(json, res);
25267    if (json.has("authority"))
25268      res.setAuthority(parseCodeableConcept(json.getAsJsonObject("authority")));
25269    if (json.has("status"))
25270      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
25271    if (json.has("date"))
25272      res.setDateElement(parseDateTime(json.get("date").getAsString()));
25273    if (json.has("_date"))
25274      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
25275  }
25276
25277  protected SubstanceSpecification.SubstanceSpecificationRelationshipComponent parseSubstanceSpecificationSubstanceSpecificationRelationshipComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
25278    SubstanceSpecification.SubstanceSpecificationRelationshipComponent res = new SubstanceSpecification.SubstanceSpecificationRelationshipComponent();
25279    parseSubstanceSpecificationSubstanceSpecificationRelationshipComponentProperties(json, owner, res);
25280    return res;
25281  }
25282
25283  protected void parseSubstanceSpecificationSubstanceSpecificationRelationshipComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationRelationshipComponent res) throws IOException, FHIRFormatError {
25284    parseBackboneElementProperties(json, res);
25285    Type substance = parseType("substance", json);
25286    if (substance != null)
25287      res.setSubstance(substance);
25288    if (json.has("relationship"))
25289      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
25290    if (json.has("isDefining"))
25291      res.setIsDefiningElement(parseBoolean(json.get("isDefining").getAsBoolean()));
25292    if (json.has("_isDefining"))
25293      parseElementProperties(json.getAsJsonObject("_isDefining"), res.getIsDefiningElement());
25294    Type amount = parseType("amount", json);
25295    if (amount != null)
25296      res.setAmount(amount);
25297    if (json.has("amountRatioLowLimit"))
25298      res.setAmountRatioLowLimit(parseRatio(json.getAsJsonObject("amountRatioLowLimit")));
25299    if (json.has("amountType"))
25300      res.setAmountType(parseCodeableConcept(json.getAsJsonObject("amountType")));
25301    if (json.has("source")) {
25302      JsonArray array = json.getAsJsonArray("source");
25303      for (int i = 0; i < array.size(); i++) {
25304        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
25305      }
25306    };
25307  }
25308
25309  protected SupplyDelivery parseSupplyDelivery(JsonObject json) throws IOException, FHIRFormatError {
25310    SupplyDelivery res = new SupplyDelivery();
25311    parseSupplyDeliveryProperties(json, res);
25312    return res;
25313  }
25314
25315  protected void parseSupplyDeliveryProperties(JsonObject json, SupplyDelivery res) throws IOException, FHIRFormatError {
25316    parseDomainResourceProperties(json, res);
25317    if (json.has("identifier")) {
25318      JsonArray array = json.getAsJsonArray("identifier");
25319      for (int i = 0; i < array.size(); i++) {
25320        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25321      }
25322    };
25323    if (json.has("basedOn")) {
25324      JsonArray array = json.getAsJsonArray("basedOn");
25325      for (int i = 0; i < array.size(); i++) {
25326        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
25327      }
25328    };
25329    if (json.has("partOf")) {
25330      JsonArray array = json.getAsJsonArray("partOf");
25331      for (int i = 0; i < array.size(); i++) {
25332        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
25333      }
25334    };
25335    if (json.has("status"))
25336      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyDelivery.SupplyDeliveryStatus.NULL, new SupplyDelivery.SupplyDeliveryStatusEnumFactory()));
25337    if (json.has("_status"))
25338      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
25339    if (json.has("patient"))
25340      res.setPatient(parseReference(json.getAsJsonObject("patient")));
25341    if (json.has("type"))
25342      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
25343    if (json.has("suppliedItem"))
25344      res.setSuppliedItem(parseSupplyDeliverySupplyDeliverySuppliedItemComponent(json.getAsJsonObject("suppliedItem"), res));
25345    Type occurrence = parseType("occurrence", json);
25346    if (occurrence != null)
25347      res.setOccurrence(occurrence);
25348    if (json.has("supplier"))
25349      res.setSupplier(parseReference(json.getAsJsonObject("supplier")));
25350    if (json.has("destination"))
25351      res.setDestination(parseReference(json.getAsJsonObject("destination")));
25352    if (json.has("receiver")) {
25353      JsonArray array = json.getAsJsonArray("receiver");
25354      for (int i = 0; i < array.size(); i++) {
25355        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
25356      }
25357    };
25358  }
25359
25360  protected SupplyDelivery.SupplyDeliverySuppliedItemComponent parseSupplyDeliverySupplyDeliverySuppliedItemComponent(JsonObject json, SupplyDelivery owner) throws IOException, FHIRFormatError {
25361    SupplyDelivery.SupplyDeliverySuppliedItemComponent res = new SupplyDelivery.SupplyDeliverySuppliedItemComponent();
25362    parseSupplyDeliverySupplyDeliverySuppliedItemComponentProperties(json, owner, res);
25363    return res;
25364  }
25365
25366  protected void parseSupplyDeliverySupplyDeliverySuppliedItemComponentProperties(JsonObject json, SupplyDelivery owner, SupplyDelivery.SupplyDeliverySuppliedItemComponent res) throws IOException, FHIRFormatError {
25367    parseBackboneElementProperties(json, res);
25368    if (json.has("quantity"))
25369      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
25370    Type item = parseType("item", json);
25371    if (item != null)
25372      res.setItem(item);
25373  }
25374
25375  protected SupplyRequest parseSupplyRequest(JsonObject json) throws IOException, FHIRFormatError {
25376    SupplyRequest res = new SupplyRequest();
25377    parseSupplyRequestProperties(json, res);
25378    return res;
25379  }
25380
25381  protected void parseSupplyRequestProperties(JsonObject json, SupplyRequest res) throws IOException, FHIRFormatError {
25382    parseDomainResourceProperties(json, res);
25383    if (json.has("identifier")) {
25384      JsonArray array = json.getAsJsonArray("identifier");
25385      for (int i = 0; i < array.size(); i++) {
25386        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25387      }
25388    };
25389    if (json.has("status"))
25390      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyRequest.SupplyRequestStatus.NULL, new SupplyRequest.SupplyRequestStatusEnumFactory()));
25391    if (json.has("_status"))
25392      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
25393    if (json.has("category"))
25394      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
25395    if (json.has("priority"))
25396      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), SupplyRequest.RequestPriority.NULL, new SupplyRequest.RequestPriorityEnumFactory()));
25397    if (json.has("_priority"))
25398      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
25399    Type item = parseType("item", json);
25400    if (item != null)
25401      res.setItem(item);
25402    if (json.has("quantity"))
25403      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
25404    if (json.has("parameter")) {
25405      JsonArray array = json.getAsJsonArray("parameter");
25406      for (int i = 0; i < array.size(); i++) {
25407        res.getParameter().add(parseSupplyRequestSupplyRequestParameterComponent(array.get(i).getAsJsonObject(), res));
25408      }
25409    };
25410    Type occurrence = parseType("occurrence", json);
25411    if (occurrence != null)
25412      res.setOccurrence(occurrence);
25413    if (json.has("authoredOn"))
25414      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
25415    if (json.has("_authoredOn"))
25416      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
25417    if (json.has("requester"))
25418      res.setRequester(parseReference(json.getAsJsonObject("requester")));
25419    if (json.has("supplier")) {
25420      JsonArray array = json.getAsJsonArray("supplier");
25421      for (int i = 0; i < array.size(); i++) {
25422        res.getSupplier().add(parseReference(array.get(i).getAsJsonObject()));
25423      }
25424    };
25425    if (json.has("reasonCode")) {
25426      JsonArray array = json.getAsJsonArray("reasonCode");
25427      for (int i = 0; i < array.size(); i++) {
25428        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25429      }
25430    };
25431    if (json.has("reasonReference")) {
25432      JsonArray array = json.getAsJsonArray("reasonReference");
25433      for (int i = 0; i < array.size(); i++) {
25434        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
25435      }
25436    };
25437    if (json.has("deliverFrom"))
25438      res.setDeliverFrom(parseReference(json.getAsJsonObject("deliverFrom")));
25439    if (json.has("deliverTo"))
25440      res.setDeliverTo(parseReference(json.getAsJsonObject("deliverTo")));
25441  }
25442
25443  protected SupplyRequest.SupplyRequestParameterComponent parseSupplyRequestSupplyRequestParameterComponent(JsonObject json, SupplyRequest owner) throws IOException, FHIRFormatError {
25444    SupplyRequest.SupplyRequestParameterComponent res = new SupplyRequest.SupplyRequestParameterComponent();
25445    parseSupplyRequestSupplyRequestParameterComponentProperties(json, owner, res);
25446    return res;
25447  }
25448
25449  protected void parseSupplyRequestSupplyRequestParameterComponentProperties(JsonObject json, SupplyRequest owner, SupplyRequest.SupplyRequestParameterComponent res) throws IOException, FHIRFormatError {
25450    parseBackboneElementProperties(json, res);
25451    if (json.has("code"))
25452      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
25453    Type value = parseType("value", json);
25454    if (value != null)
25455      res.setValue(value);
25456  }
25457
25458  protected Task parseTask(JsonObject json) throws IOException, FHIRFormatError {
25459    Task res = new Task();
25460    parseTaskProperties(json, res);
25461    return res;
25462  }
25463
25464  protected void parseTaskProperties(JsonObject json, Task res) throws IOException, FHIRFormatError {
25465    parseDomainResourceProperties(json, res);
25466    if (json.has("identifier")) {
25467      JsonArray array = json.getAsJsonArray("identifier");
25468      for (int i = 0; i < array.size(); i++) {
25469        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25470      }
25471    };
25472    if (json.has("instantiatesCanonical"))
25473      res.setInstantiatesCanonicalElement(parseCanonical(json.get("instantiatesCanonical").getAsString()));
25474    if (json.has("_instantiatesCanonical"))
25475      parseElementProperties(json.getAsJsonObject("_instantiatesCanonical"), res.getInstantiatesCanonicalElement());
25476    if (json.has("instantiatesUri"))
25477      res.setInstantiatesUriElement(parseUri(json.get("instantiatesUri").getAsString()));
25478    if (json.has("_instantiatesUri"))
25479      parseElementProperties(json.getAsJsonObject("_instantiatesUri"), res.getInstantiatesUriElement());
25480    if (json.has("basedOn")) {
25481      JsonArray array = json.getAsJsonArray("basedOn");
25482      for (int i = 0; i < array.size(); i++) {
25483        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
25484      }
25485    };
25486    if (json.has("groupIdentifier"))
25487      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
25488    if (json.has("partOf")) {
25489      JsonArray array = json.getAsJsonArray("partOf");
25490      for (int i = 0; i < array.size(); i++) {
25491        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
25492      }
25493    };
25494    if (json.has("status"))
25495      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Task.TaskStatus.NULL, new Task.TaskStatusEnumFactory()));
25496    if (json.has("_status"))
25497      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
25498    if (json.has("statusReason"))
25499      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
25500    if (json.has("businessStatus"))
25501      res.setBusinessStatus(parseCodeableConcept(json.getAsJsonObject("businessStatus")));
25502    if (json.has("intent"))
25503      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Task.TaskIntent.NULL, new Task.TaskIntentEnumFactory()));
25504    if (json.has("_intent"))
25505      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
25506    if (json.has("priority"))
25507      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Task.TaskPriority.NULL, new Task.TaskPriorityEnumFactory()));
25508    if (json.has("_priority"))
25509      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
25510    if (json.has("code"))
25511      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
25512    if (json.has("description"))
25513      res.setDescriptionElement(parseString(json.get("description").getAsString()));
25514    if (json.has("_description"))
25515      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
25516    if (json.has("focus"))
25517      res.setFocus(parseReference(json.getAsJsonObject("focus")));
25518    if (json.has("for"))
25519      res.setFor(parseReference(json.getAsJsonObject("for")));
25520    if (json.has("encounter"))
25521      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
25522    if (json.has("executionPeriod"))
25523      res.setExecutionPeriod(parsePeriod(json.getAsJsonObject("executionPeriod")));
25524    if (json.has("authoredOn"))
25525      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
25526    if (json.has("_authoredOn"))
25527      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
25528    if (json.has("lastModified"))
25529      res.setLastModifiedElement(parseDateTime(json.get("lastModified").getAsString()));
25530    if (json.has("_lastModified"))
25531      parseElementProperties(json.getAsJsonObject("_lastModified"), res.getLastModifiedElement());
25532    if (json.has("requester"))
25533      res.setRequester(parseReference(json.getAsJsonObject("requester")));
25534    if (json.has("performerType")) {
25535      JsonArray array = json.getAsJsonArray("performerType");
25536      for (int i = 0; i < array.size(); i++) {
25537        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25538      }
25539    };
25540    if (json.has("owner"))
25541      res.setOwner(parseReference(json.getAsJsonObject("owner")));
25542    if (json.has("location"))
25543      res.setLocation(parseReference(json.getAsJsonObject("location")));
25544    if (json.has("reasonCode"))
25545      res.setReasonCode(parseCodeableConcept(json.getAsJsonObject("reasonCode")));
25546    if (json.has("reasonReference"))
25547      res.setReasonReference(parseReference(json.getAsJsonObject("reasonReference")));
25548    if (json.has("insurance")) {
25549      JsonArray array = json.getAsJsonArray("insurance");
25550      for (int i = 0; i < array.size(); i++) {
25551        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
25552      }
25553    };
25554    if (json.has("note")) {
25555      JsonArray array = json.getAsJsonArray("note");
25556      for (int i = 0; i < array.size(); i++) {
25557        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
25558      }
25559    };
25560    if (json.has("relevantHistory")) {
25561      JsonArray array = json.getAsJsonArray("relevantHistory");
25562      for (int i = 0; i < array.size(); i++) {
25563        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
25564      }
25565    };
25566    if (json.has("restriction"))
25567      res.setRestriction(parseTaskTaskRestrictionComponent(json.getAsJsonObject("restriction"), res));
25568    if (json.has("input")) {
25569      JsonArray array = json.getAsJsonArray("input");
25570      for (int i = 0; i < array.size(); i++) {
25571        res.getInput().add(parseTaskParameterComponent(array.get(i).getAsJsonObject(), res));
25572      }
25573    };
25574    if (json.has("output")) {
25575      JsonArray array = json.getAsJsonArray("output");
25576      for (int i = 0; i < array.size(); i++) {
25577        res.getOutput().add(parseTaskTaskOutputComponent(array.get(i).getAsJsonObject(), res));
25578      }
25579    };
25580  }
25581
25582  protected Task.TaskRestrictionComponent parseTaskTaskRestrictionComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
25583    Task.TaskRestrictionComponent res = new Task.TaskRestrictionComponent();
25584    parseTaskTaskRestrictionComponentProperties(json, owner, res);
25585    return res;
25586  }
25587
25588  protected void parseTaskTaskRestrictionComponentProperties(JsonObject json, Task owner, Task.TaskRestrictionComponent res) throws IOException, FHIRFormatError {
25589    parseBackboneElementProperties(json, res);
25590    if (json.has("repetitions"))
25591      res.setRepetitionsElement(parsePositiveInt(json.get("repetitions").getAsString()));
25592    if (json.has("_repetitions"))
25593      parseElementProperties(json.getAsJsonObject("_repetitions"), res.getRepetitionsElement());
25594    if (json.has("period"))
25595      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
25596    if (json.has("recipient")) {
25597      JsonArray array = json.getAsJsonArray("recipient");
25598      for (int i = 0; i < array.size(); i++) {
25599        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
25600      }
25601    };
25602  }
25603
25604  protected Task.ParameterComponent parseTaskParameterComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
25605    Task.ParameterComponent res = new Task.ParameterComponent();
25606    parseTaskParameterComponentProperties(json, owner, res);
25607    return res;
25608  }
25609
25610  protected void parseTaskParameterComponentProperties(JsonObject json, Task owner, Task.ParameterComponent res) throws IOException, FHIRFormatError {
25611    parseBackboneElementProperties(json, res);
25612    if (json.has("type"))
25613      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
25614    Type value = parseType("value", json);
25615    if (value != null)
25616      res.setValue(value);
25617  }
25618
25619  protected Task.TaskOutputComponent parseTaskTaskOutputComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
25620    Task.TaskOutputComponent res = new Task.TaskOutputComponent();
25621    parseTaskTaskOutputComponentProperties(json, owner, res);
25622    return res;
25623  }
25624
25625  protected void parseTaskTaskOutputComponentProperties(JsonObject json, Task owner, Task.TaskOutputComponent res) throws IOException, FHIRFormatError {
25626    parseBackboneElementProperties(json, res);
25627    if (json.has("type"))
25628      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
25629    Type value = parseType("value", json);
25630    if (value != null)
25631      res.setValue(value);
25632  }
25633
25634  protected TerminologyCapabilities parseTerminologyCapabilities(JsonObject json) throws IOException, FHIRFormatError {
25635    TerminologyCapabilities res = new TerminologyCapabilities();
25636    parseTerminologyCapabilitiesProperties(json, res);
25637    return res;
25638  }
25639
25640  protected void parseTerminologyCapabilitiesProperties(JsonObject json, TerminologyCapabilities res) throws IOException, FHIRFormatError {
25641    parseDomainResourceProperties(json, res);
25642    if (json.has("url"))
25643      res.setUrlElement(parseUri(json.get("url").getAsString()));
25644    if (json.has("_url"))
25645      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
25646    if (json.has("version"))
25647      res.setVersionElement(parseString(json.get("version").getAsString()));
25648    if (json.has("_version"))
25649      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
25650    if (json.has("name"))
25651      res.setNameElement(parseString(json.get("name").getAsString()));
25652    if (json.has("_name"))
25653      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25654    if (json.has("title"))
25655      res.setTitleElement(parseString(json.get("title").getAsString()));
25656    if (json.has("_title"))
25657      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
25658    if (json.has("status"))
25659      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
25660    if (json.has("_status"))
25661      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
25662    if (json.has("experimental"))
25663      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
25664    if (json.has("_experimental"))
25665      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
25666    if (json.has("date"))
25667      res.setDateElement(parseDateTime(json.get("date").getAsString()));
25668    if (json.has("_date"))
25669      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
25670    if (json.has("publisher"))
25671      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
25672    if (json.has("_publisher"))
25673      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
25674    if (json.has("contact")) {
25675      JsonArray array = json.getAsJsonArray("contact");
25676      for (int i = 0; i < array.size(); i++) {
25677        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
25678      }
25679    };
25680    if (json.has("description"))
25681      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
25682    if (json.has("_description"))
25683      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
25684    if (json.has("useContext")) {
25685      JsonArray array = json.getAsJsonArray("useContext");
25686      for (int i = 0; i < array.size(); i++) {
25687        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
25688      }
25689    };
25690    if (json.has("jurisdiction")) {
25691      JsonArray array = json.getAsJsonArray("jurisdiction");
25692      for (int i = 0; i < array.size(); i++) {
25693        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25694      }
25695    };
25696    if (json.has("purpose"))
25697      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
25698    if (json.has("_purpose"))
25699      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
25700    if (json.has("copyright"))
25701      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
25702    if (json.has("_copyright"))
25703      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
25704    if (json.has("kind"))
25705      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), TerminologyCapabilities.CapabilityStatementKind.NULL, new TerminologyCapabilities.CapabilityStatementKindEnumFactory()));
25706    if (json.has("_kind"))
25707      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
25708    if (json.has("software"))
25709      res.setSoftware(parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(json.getAsJsonObject("software"), res));
25710    if (json.has("implementation"))
25711      res.setImplementation(parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(json.getAsJsonObject("implementation"), res));
25712    if (json.has("lockedDate"))
25713      res.setLockedDateElement(parseBoolean(json.get("lockedDate").getAsBoolean()));
25714    if (json.has("_lockedDate"))
25715      parseElementProperties(json.getAsJsonObject("_lockedDate"), res.getLockedDateElement());
25716    if (json.has("codeSystem")) {
25717      JsonArray array = json.getAsJsonArray("codeSystem");
25718      for (int i = 0; i < array.size(); i++) {
25719        res.getCodeSystem().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(array.get(i).getAsJsonObject(), res));
25720      }
25721    };
25722    if (json.has("expansion"))
25723      res.setExpansion(parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(json.getAsJsonObject("expansion"), res));
25724    if (json.has("codeSearch"))
25725      res.setCodeSearchElement(parseEnumeration(json.get("codeSearch").getAsString(), TerminologyCapabilities.CodeSearchSupport.NULL, new TerminologyCapabilities.CodeSearchSupportEnumFactory()));
25726    if (json.has("_codeSearch"))
25727      parseElementProperties(json.getAsJsonObject("_codeSearch"), res.getCodeSearchElement());
25728    if (json.has("validateCode"))
25729      res.setValidateCode(parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(json.getAsJsonObject("validateCode"), res));
25730    if (json.has("translation"))
25731      res.setTranslation(parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(json.getAsJsonObject("translation"), res));
25732    if (json.has("closure"))
25733      res.setClosure(parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(json.getAsJsonObject("closure"), res));
25734  }
25735
25736  protected TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25737    TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent res = new TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent();
25738    parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentProperties(json, owner, res);
25739    return res;
25740  }
25741
25742  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent res) throws IOException, FHIRFormatError {
25743    parseBackboneElementProperties(json, res);
25744    if (json.has("name"))
25745      res.setNameElement(parseString(json.get("name").getAsString()));
25746    if (json.has("_name"))
25747      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25748    if (json.has("version"))
25749      res.setVersionElement(parseString(json.get("version").getAsString()));
25750    if (json.has("_version"))
25751      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
25752  }
25753
25754  protected TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25755    TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent();
25756    parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentProperties(json, owner, res);
25757    return res;
25758  }
25759
25760  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent res) throws IOException, FHIRFormatError {
25761    parseBackboneElementProperties(json, res);
25762    if (json.has("description"))
25763      res.setDescriptionElement(parseString(json.get("description").getAsString()));
25764    if (json.has("_description"))
25765      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
25766    if (json.has("url"))
25767      res.setUrlElement(parseUrl(json.get("url").getAsString()));
25768    if (json.has("_url"))
25769      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
25770  }
25771
25772  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25773    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent();
25774    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentProperties(json, owner, res);
25775    return res;
25776  }
25777
25778  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res) throws IOException, FHIRFormatError {
25779    parseBackboneElementProperties(json, res);
25780    if (json.has("uri"))
25781      res.setUriElement(parseCanonical(json.get("uri").getAsString()));
25782    if (json.has("_uri"))
25783      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
25784    if (json.has("version")) {
25785      JsonArray array = json.getAsJsonArray("version");
25786      for (int i = 0; i < array.size(); i++) {
25787        res.getVersion().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(array.get(i).getAsJsonObject(), owner));
25788      }
25789    };
25790    if (json.has("subsumption"))
25791      res.setSubsumptionElement(parseBoolean(json.get("subsumption").getAsBoolean()));
25792    if (json.has("_subsumption"))
25793      parseElementProperties(json.getAsJsonObject("_subsumption"), res.getSubsumptionElement());
25794  }
25795
25796  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25797    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent();
25798    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentProperties(json, owner, res);
25799    return res;
25800  }
25801
25802  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res) throws IOException, FHIRFormatError {
25803    parseBackboneElementProperties(json, res);
25804    if (json.has("code"))
25805      res.setCodeElement(parseString(json.get("code").getAsString()));
25806    if (json.has("_code"))
25807      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
25808    if (json.has("isDefault"))
25809      res.setIsDefaultElement(parseBoolean(json.get("isDefault").getAsBoolean()));
25810    if (json.has("_isDefault"))
25811      parseElementProperties(json.getAsJsonObject("_isDefault"), res.getIsDefaultElement());
25812    if (json.has("compositional"))
25813      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
25814    if (json.has("_compositional"))
25815      parseElementProperties(json.getAsJsonObject("_compositional"), res.getCompositionalElement());
25816    if (json.has("language")) {
25817      JsonArray array = json.getAsJsonArray("language");
25818      for (int i = 0; i < array.size(); i++) {
25819        res.getLanguage().add(parseCode(array.get(i).getAsString()));
25820      }
25821    };
25822    if (json.has("_language")) {
25823      JsonArray array = json.getAsJsonArray("_language");
25824      for (int i = 0; i < array.size(); i++) {
25825        if (i == res.getLanguage().size())
25826          res.getLanguage().add(parseCode(null));
25827        if (array.get(i) instanceof JsonObject) 
25828          parseElementProperties(array.get(i).getAsJsonObject(), res.getLanguage().get(i));
25829      }
25830    };
25831    if (json.has("filter")) {
25832      JsonArray array = json.getAsJsonArray("filter");
25833      for (int i = 0; i < array.size(); i++) {
25834        res.getFilter().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(array.get(i).getAsJsonObject(), owner));
25835      }
25836    };
25837    if (json.has("property")) {
25838      JsonArray array = json.getAsJsonArray("property");
25839      for (int i = 0; i < array.size(); i++) {
25840        res.getProperty().add(parseCode(array.get(i).getAsString()));
25841      }
25842    };
25843    if (json.has("_property")) {
25844      JsonArray array = json.getAsJsonArray("_property");
25845      for (int i = 0; i < array.size(); i++) {
25846        if (i == res.getProperty().size())
25847          res.getProperty().add(parseCode(null));
25848        if (array.get(i) instanceof JsonObject) 
25849          parseElementProperties(array.get(i).getAsJsonObject(), res.getProperty().get(i));
25850      }
25851    };
25852  }
25853
25854  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25855    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent();
25856    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(json, owner, res);
25857    return res;
25858  }
25859
25860  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res) throws IOException, FHIRFormatError {
25861    parseBackboneElementProperties(json, res);
25862    if (json.has("code"))
25863      res.setCodeElement(parseCode(json.get("code").getAsString()));
25864    if (json.has("_code"))
25865      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
25866    if (json.has("op")) {
25867      JsonArray array = json.getAsJsonArray("op");
25868      for (int i = 0; i < array.size(); i++) {
25869        res.getOp().add(parseCode(array.get(i).getAsString()));
25870      }
25871    };
25872    if (json.has("_op")) {
25873      JsonArray array = json.getAsJsonArray("_op");
25874      for (int i = 0; i < array.size(); i++) {
25875        if (i == res.getOp().size())
25876          res.getOp().add(parseCode(null));
25877        if (array.get(i) instanceof JsonObject) 
25878          parseElementProperties(array.get(i).getAsJsonObject(), res.getOp().get(i));
25879      }
25880    };
25881  }
25882
25883  protected TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25884    TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent();
25885    parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentProperties(json, owner, res);
25886    return res;
25887  }
25888
25889  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res) throws IOException, FHIRFormatError {
25890    parseBackboneElementProperties(json, res);
25891    if (json.has("hierarchical"))
25892      res.setHierarchicalElement(parseBoolean(json.get("hierarchical").getAsBoolean()));
25893    if (json.has("_hierarchical"))
25894      parseElementProperties(json.getAsJsonObject("_hierarchical"), res.getHierarchicalElement());
25895    if (json.has("paging"))
25896      res.setPagingElement(parseBoolean(json.get("paging").getAsBoolean()));
25897    if (json.has("_paging"))
25898      parseElementProperties(json.getAsJsonObject("_paging"), res.getPagingElement());
25899    if (json.has("incomplete"))
25900      res.setIncompleteElement(parseBoolean(json.get("incomplete").getAsBoolean()));
25901    if (json.has("_incomplete"))
25902      parseElementProperties(json.getAsJsonObject("_incomplete"), res.getIncompleteElement());
25903    if (json.has("parameter")) {
25904      JsonArray array = json.getAsJsonArray("parameter");
25905      for (int i = 0; i < array.size(); i++) {
25906        res.getParameter().add(parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(array.get(i).getAsJsonObject(), owner));
25907      }
25908    };
25909    if (json.has("textFilter"))
25910      res.setTextFilterElement(parseMarkdown(json.get("textFilter").getAsString()));
25911    if (json.has("_textFilter"))
25912      parseElementProperties(json.getAsJsonObject("_textFilter"), res.getTextFilterElement());
25913  }
25914
25915  protected TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25916    TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent();
25917    parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentProperties(json, owner, res);
25918    return res;
25919  }
25920
25921  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent res) throws IOException, FHIRFormatError {
25922    parseBackboneElementProperties(json, res);
25923    if (json.has("name"))
25924      res.setNameElement(parseCode(json.get("name").getAsString()));
25925    if (json.has("_name"))
25926      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25927    if (json.has("documentation"))
25928      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
25929    if (json.has("_documentation"))
25930      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
25931  }
25932
25933  protected TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25934    TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res = new TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent();
25935    parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentProperties(json, owner, res);
25936    return res;
25937  }
25938
25939  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res) throws IOException, FHIRFormatError {
25940    parseBackboneElementProperties(json, res);
25941    if (json.has("translations"))
25942      res.setTranslationsElement(parseBoolean(json.get("translations").getAsBoolean()));
25943    if (json.has("_translations"))
25944      parseElementProperties(json.getAsJsonObject("_translations"), res.getTranslationsElement());
25945  }
25946
25947  protected TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25948    TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent();
25949    parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentProperties(json, owner, res);
25950    return res;
25951  }
25952
25953  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res) throws IOException, FHIRFormatError {
25954    parseBackboneElementProperties(json, res);
25955    if (json.has("needsMap"))
25956      res.setNeedsMapElement(parseBoolean(json.get("needsMap").getAsBoolean()));
25957    if (json.has("_needsMap"))
25958      parseElementProperties(json.getAsJsonObject("_needsMap"), res.getNeedsMapElement());
25959  }
25960
25961  protected TerminologyCapabilities.TerminologyCapabilitiesClosureComponent parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
25962    TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res = new TerminologyCapabilities.TerminologyCapabilitiesClosureComponent();
25963    parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentProperties(json, owner, res);
25964    return res;
25965  }
25966
25967  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res) throws IOException, FHIRFormatError {
25968    parseBackboneElementProperties(json, res);
25969    if (json.has("translation"))
25970      res.setTranslationElement(parseBoolean(json.get("translation").getAsBoolean()));
25971    if (json.has("_translation"))
25972      parseElementProperties(json.getAsJsonObject("_translation"), res.getTranslationElement());
25973  }
25974
25975  protected TestReport parseTestReport(JsonObject json) throws IOException, FHIRFormatError {
25976    TestReport res = new TestReport();
25977    parseTestReportProperties(json, res);
25978    return res;
25979  }
25980
25981  protected void parseTestReportProperties(JsonObject json, TestReport res) throws IOException, FHIRFormatError {
25982    parseDomainResourceProperties(json, res);
25983    if (json.has("identifier"))
25984      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
25985    if (json.has("name"))
25986      res.setNameElement(parseString(json.get("name").getAsString()));
25987    if (json.has("_name"))
25988      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25989    if (json.has("status"))
25990      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), TestReport.TestReportStatus.NULL, new TestReport.TestReportStatusEnumFactory()));
25991    if (json.has("_status"))
25992      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
25993    if (json.has("testScript"))
25994      res.setTestScript(parseReference(json.getAsJsonObject("testScript")));
25995    if (json.has("result"))
25996      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportResult.NULL, new TestReport.TestReportResultEnumFactory()));
25997    if (json.has("_result"))
25998      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
25999    if (json.has("score"))
26000      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
26001    if (json.has("_score"))
26002      parseElementProperties(json.getAsJsonObject("_score"), res.getScoreElement());
26003    if (json.has("tester"))
26004      res.setTesterElement(parseString(json.get("tester").getAsString()));
26005    if (json.has("_tester"))
26006      parseElementProperties(json.getAsJsonObject("_tester"), res.getTesterElement());
26007    if (json.has("issued"))
26008      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
26009    if (json.has("_issued"))
26010      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
26011    if (json.has("participant")) {
26012      JsonArray array = json.getAsJsonArray("participant");
26013      for (int i = 0; i < array.size(); i++) {
26014        res.getParticipant().add(parseTestReportTestReportParticipantComponent(array.get(i).getAsJsonObject(), res));
26015      }
26016    };
26017    if (json.has("setup"))
26018      res.setSetup(parseTestReportTestReportSetupComponent(json.getAsJsonObject("setup"), res));
26019    if (json.has("test")) {
26020      JsonArray array = json.getAsJsonArray("test");
26021      for (int i = 0; i < array.size(); i++) {
26022        res.getTest().add(parseTestReportTestReportTestComponent(array.get(i).getAsJsonObject(), res));
26023      }
26024    };
26025    if (json.has("teardown"))
26026      res.setTeardown(parseTestReportTestReportTeardownComponent(json.getAsJsonObject("teardown"), res));
26027  }
26028
26029  protected TestReport.TestReportParticipantComponent parseTestReportTestReportParticipantComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26030    TestReport.TestReportParticipantComponent res = new TestReport.TestReportParticipantComponent();
26031    parseTestReportTestReportParticipantComponentProperties(json, owner, res);
26032    return res;
26033  }
26034
26035  protected void parseTestReportTestReportParticipantComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportParticipantComponent res) throws IOException, FHIRFormatError {
26036    parseBackboneElementProperties(json, res);
26037    if (json.has("type"))
26038      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TestReport.TestReportParticipantType.NULL, new TestReport.TestReportParticipantTypeEnumFactory()));
26039    if (json.has("_type"))
26040      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
26041    if (json.has("uri"))
26042      res.setUriElement(parseUri(json.get("uri").getAsString()));
26043    if (json.has("_uri"))
26044      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
26045    if (json.has("display"))
26046      res.setDisplayElement(parseString(json.get("display").getAsString()));
26047    if (json.has("_display"))
26048      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
26049  }
26050
26051  protected TestReport.TestReportSetupComponent parseTestReportTestReportSetupComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26052    TestReport.TestReportSetupComponent res = new TestReport.TestReportSetupComponent();
26053    parseTestReportTestReportSetupComponentProperties(json, owner, res);
26054    return res;
26055  }
26056
26057  protected void parseTestReportTestReportSetupComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportSetupComponent res) throws IOException, FHIRFormatError {
26058    parseBackboneElementProperties(json, res);
26059    if (json.has("action")) {
26060      JsonArray array = json.getAsJsonArray("action");
26061      for (int i = 0; i < array.size(); i++) {
26062        res.getAction().add(parseTestReportSetupActionComponent(array.get(i).getAsJsonObject(), owner));
26063      }
26064    };
26065  }
26066
26067  protected TestReport.SetupActionComponent parseTestReportSetupActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26068    TestReport.SetupActionComponent res = new TestReport.SetupActionComponent();
26069    parseTestReportSetupActionComponentProperties(json, owner, res);
26070    return res;
26071  }
26072
26073  protected void parseTestReportSetupActionComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionComponent res) throws IOException, FHIRFormatError {
26074    parseBackboneElementProperties(json, res);
26075    if (json.has("operation"))
26076      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
26077    if (json.has("assert"))
26078      res.setAssert(parseTestReportSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
26079  }
26080
26081  protected TestReport.SetupActionOperationComponent parseTestReportSetupActionOperationComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26082    TestReport.SetupActionOperationComponent res = new TestReport.SetupActionOperationComponent();
26083    parseTestReportSetupActionOperationComponentProperties(json, owner, res);
26084    return res;
26085  }
26086
26087  protected void parseTestReportSetupActionOperationComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
26088    parseBackboneElementProperties(json, res);
26089    if (json.has("result"))
26090      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
26091    if (json.has("_result"))
26092      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
26093    if (json.has("message"))
26094      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
26095    if (json.has("_message"))
26096      parseElementProperties(json.getAsJsonObject("_message"), res.getMessageElement());
26097    if (json.has("detail"))
26098      res.setDetailElement(parseUri(json.get("detail").getAsString()));
26099    if (json.has("_detail"))
26100      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
26101  }
26102
26103  protected TestReport.SetupActionAssertComponent parseTestReportSetupActionAssertComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26104    TestReport.SetupActionAssertComponent res = new TestReport.SetupActionAssertComponent();
26105    parseTestReportSetupActionAssertComponentProperties(json, owner, res);
26106    return res;
26107  }
26108
26109  protected void parseTestReportSetupActionAssertComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
26110    parseBackboneElementProperties(json, res);
26111    if (json.has("result"))
26112      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
26113    if (json.has("_result"))
26114      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
26115    if (json.has("message"))
26116      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
26117    if (json.has("_message"))
26118      parseElementProperties(json.getAsJsonObject("_message"), res.getMessageElement());
26119    if (json.has("detail"))
26120      res.setDetailElement(parseString(json.get("detail").getAsString()));
26121    if (json.has("_detail"))
26122      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
26123  }
26124
26125  protected TestReport.TestReportTestComponent parseTestReportTestReportTestComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26126    TestReport.TestReportTestComponent res = new TestReport.TestReportTestComponent();
26127    parseTestReportTestReportTestComponentProperties(json, owner, res);
26128    return res;
26129  }
26130
26131  protected void parseTestReportTestReportTestComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportTestComponent res) throws IOException, FHIRFormatError {
26132    parseBackboneElementProperties(json, res);
26133    if (json.has("name"))
26134      res.setNameElement(parseString(json.get("name").getAsString()));
26135    if (json.has("_name"))
26136      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
26137    if (json.has("description"))
26138      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26139    if (json.has("_description"))
26140      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26141    if (json.has("action")) {
26142      JsonArray array = json.getAsJsonArray("action");
26143      for (int i = 0; i < array.size(); i++) {
26144        res.getAction().add(parseTestReportTestActionComponent(array.get(i).getAsJsonObject(), owner));
26145      }
26146    };
26147  }
26148
26149  protected TestReport.TestActionComponent parseTestReportTestActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26150    TestReport.TestActionComponent res = new TestReport.TestActionComponent();
26151    parseTestReportTestActionComponentProperties(json, owner, res);
26152    return res;
26153  }
26154
26155  protected void parseTestReportTestActionComponentProperties(JsonObject json, TestReport owner, TestReport.TestActionComponent res) throws IOException, FHIRFormatError {
26156    parseBackboneElementProperties(json, res);
26157    if (json.has("operation"))
26158      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
26159    if (json.has("assert"))
26160      res.setAssert(parseTestReportSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
26161  }
26162
26163  protected TestReport.TestReportTeardownComponent parseTestReportTestReportTeardownComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26164    TestReport.TestReportTeardownComponent res = new TestReport.TestReportTeardownComponent();
26165    parseTestReportTestReportTeardownComponentProperties(json, owner, res);
26166    return res;
26167  }
26168
26169  protected void parseTestReportTestReportTeardownComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportTeardownComponent res) throws IOException, FHIRFormatError {
26170    parseBackboneElementProperties(json, res);
26171    if (json.has("action")) {
26172      JsonArray array = json.getAsJsonArray("action");
26173      for (int i = 0; i < array.size(); i++) {
26174        res.getAction().add(parseTestReportTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
26175      }
26176    };
26177  }
26178
26179  protected TestReport.TeardownActionComponent parseTestReportTeardownActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
26180    TestReport.TeardownActionComponent res = new TestReport.TeardownActionComponent();
26181    parseTestReportTeardownActionComponentProperties(json, owner, res);
26182    return res;
26183  }
26184
26185  protected void parseTestReportTeardownActionComponentProperties(JsonObject json, TestReport owner, TestReport.TeardownActionComponent res) throws IOException, FHIRFormatError {
26186    parseBackboneElementProperties(json, res);
26187    if (json.has("operation"))
26188      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
26189  }
26190
26191  protected TestScript parseTestScript(JsonObject json) throws IOException, FHIRFormatError {
26192    TestScript res = new TestScript();
26193    parseTestScriptProperties(json, res);
26194    return res;
26195  }
26196
26197  protected void parseTestScriptProperties(JsonObject json, TestScript res) throws IOException, FHIRFormatError {
26198    parseDomainResourceProperties(json, res);
26199    if (json.has("url"))
26200      res.setUrlElement(parseUri(json.get("url").getAsString()));
26201    if (json.has("_url"))
26202      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
26203    if (json.has("identifier"))
26204      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
26205    if (json.has("version"))
26206      res.setVersionElement(parseString(json.get("version").getAsString()));
26207    if (json.has("_version"))
26208      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
26209    if (json.has("name"))
26210      res.setNameElement(parseString(json.get("name").getAsString()));
26211    if (json.has("_name"))
26212      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
26213    if (json.has("title"))
26214      res.setTitleElement(parseString(json.get("title").getAsString()));
26215    if (json.has("_title"))
26216      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
26217    if (json.has("status"))
26218      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
26219    if (json.has("_status"))
26220      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
26221    if (json.has("experimental"))
26222      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
26223    if (json.has("_experimental"))
26224      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
26225    if (json.has("date"))
26226      res.setDateElement(parseDateTime(json.get("date").getAsString()));
26227    if (json.has("_date"))
26228      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
26229    if (json.has("publisher"))
26230      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
26231    if (json.has("_publisher"))
26232      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
26233    if (json.has("contact")) {
26234      JsonArray array = json.getAsJsonArray("contact");
26235      for (int i = 0; i < array.size(); i++) {
26236        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
26237      }
26238    };
26239    if (json.has("description"))
26240      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
26241    if (json.has("_description"))
26242      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26243    if (json.has("useContext")) {
26244      JsonArray array = json.getAsJsonArray("useContext");
26245      for (int i = 0; i < array.size(); i++) {
26246        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
26247      }
26248    };
26249    if (json.has("jurisdiction")) {
26250      JsonArray array = json.getAsJsonArray("jurisdiction");
26251      for (int i = 0; i < array.size(); i++) {
26252        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26253      }
26254    };
26255    if (json.has("purpose"))
26256      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
26257    if (json.has("_purpose"))
26258      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
26259    if (json.has("copyright"))
26260      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
26261    if (json.has("_copyright"))
26262      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
26263    if (json.has("origin")) {
26264      JsonArray array = json.getAsJsonArray("origin");
26265      for (int i = 0; i < array.size(); i++) {
26266        res.getOrigin().add(parseTestScriptTestScriptOriginComponent(array.get(i).getAsJsonObject(), res));
26267      }
26268    };
26269    if (json.has("destination")) {
26270      JsonArray array = json.getAsJsonArray("destination");
26271      for (int i = 0; i < array.size(); i++) {
26272        res.getDestination().add(parseTestScriptTestScriptDestinationComponent(array.get(i).getAsJsonObject(), res));
26273      }
26274    };
26275    if (json.has("metadata"))
26276      res.setMetadata(parseTestScriptTestScriptMetadataComponent(json.getAsJsonObject("metadata"), res));
26277    if (json.has("fixture")) {
26278      JsonArray array = json.getAsJsonArray("fixture");
26279      for (int i = 0; i < array.size(); i++) {
26280        res.getFixture().add(parseTestScriptTestScriptFixtureComponent(array.get(i).getAsJsonObject(), res));
26281      }
26282    };
26283    if (json.has("profile")) {
26284      JsonArray array = json.getAsJsonArray("profile");
26285      for (int i = 0; i < array.size(); i++) {
26286        res.getProfile().add(parseReference(array.get(i).getAsJsonObject()));
26287      }
26288    };
26289    if (json.has("variable")) {
26290      JsonArray array = json.getAsJsonArray("variable");
26291      for (int i = 0; i < array.size(); i++) {
26292        res.getVariable().add(parseTestScriptTestScriptVariableComponent(array.get(i).getAsJsonObject(), res));
26293      }
26294    };
26295    if (json.has("setup"))
26296      res.setSetup(parseTestScriptTestScriptSetupComponent(json.getAsJsonObject("setup"), res));
26297    if (json.has("test")) {
26298      JsonArray array = json.getAsJsonArray("test");
26299      for (int i = 0; i < array.size(); i++) {
26300        res.getTest().add(parseTestScriptTestScriptTestComponent(array.get(i).getAsJsonObject(), res));
26301      }
26302    };
26303    if (json.has("teardown"))
26304      res.setTeardown(parseTestScriptTestScriptTeardownComponent(json.getAsJsonObject("teardown"), res));
26305  }
26306
26307  protected TestScript.TestScriptOriginComponent parseTestScriptTestScriptOriginComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26308    TestScript.TestScriptOriginComponent res = new TestScript.TestScriptOriginComponent();
26309    parseTestScriptTestScriptOriginComponentProperties(json, owner, res);
26310    return res;
26311  }
26312
26313  protected void parseTestScriptTestScriptOriginComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptOriginComponent res) throws IOException, FHIRFormatError {
26314    parseBackboneElementProperties(json, res);
26315    if (json.has("index"))
26316      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
26317    if (json.has("_index"))
26318      parseElementProperties(json.getAsJsonObject("_index"), res.getIndexElement());
26319    if (json.has("profile"))
26320      res.setProfile(parseCoding(json.getAsJsonObject("profile")));
26321  }
26322
26323  protected TestScript.TestScriptDestinationComponent parseTestScriptTestScriptDestinationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26324    TestScript.TestScriptDestinationComponent res = new TestScript.TestScriptDestinationComponent();
26325    parseTestScriptTestScriptDestinationComponentProperties(json, owner, res);
26326    return res;
26327  }
26328
26329  protected void parseTestScriptTestScriptDestinationComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptDestinationComponent res) throws IOException, FHIRFormatError {
26330    parseBackboneElementProperties(json, res);
26331    if (json.has("index"))
26332      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
26333    if (json.has("_index"))
26334      parseElementProperties(json.getAsJsonObject("_index"), res.getIndexElement());
26335    if (json.has("profile"))
26336      res.setProfile(parseCoding(json.getAsJsonObject("profile")));
26337  }
26338
26339  protected TestScript.TestScriptMetadataComponent parseTestScriptTestScriptMetadataComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26340    TestScript.TestScriptMetadataComponent res = new TestScript.TestScriptMetadataComponent();
26341    parseTestScriptTestScriptMetadataComponentProperties(json, owner, res);
26342    return res;
26343  }
26344
26345  protected void parseTestScriptTestScriptMetadataComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataComponent res) throws IOException, FHIRFormatError {
26346    parseBackboneElementProperties(json, res);
26347    if (json.has("link")) {
26348      JsonArray array = json.getAsJsonArray("link");
26349      for (int i = 0; i < array.size(); i++) {
26350        res.getLink().add(parseTestScriptTestScriptMetadataLinkComponent(array.get(i).getAsJsonObject(), owner));
26351      }
26352    };
26353    if (json.has("capability")) {
26354      JsonArray array = json.getAsJsonArray("capability");
26355      for (int i = 0; i < array.size(); i++) {
26356        res.getCapability().add(parseTestScriptTestScriptMetadataCapabilityComponent(array.get(i).getAsJsonObject(), owner));
26357      }
26358    };
26359  }
26360
26361  protected TestScript.TestScriptMetadataLinkComponent parseTestScriptTestScriptMetadataLinkComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26362    TestScript.TestScriptMetadataLinkComponent res = new TestScript.TestScriptMetadataLinkComponent();
26363    parseTestScriptTestScriptMetadataLinkComponentProperties(json, owner, res);
26364    return res;
26365  }
26366
26367  protected void parseTestScriptTestScriptMetadataLinkComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataLinkComponent res) throws IOException, FHIRFormatError {
26368    parseBackboneElementProperties(json, res);
26369    if (json.has("url"))
26370      res.setUrlElement(parseUri(json.get("url").getAsString()));
26371    if (json.has("_url"))
26372      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
26373    if (json.has("description"))
26374      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26375    if (json.has("_description"))
26376      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26377  }
26378
26379  protected TestScript.TestScriptMetadataCapabilityComponent parseTestScriptTestScriptMetadataCapabilityComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26380    TestScript.TestScriptMetadataCapabilityComponent res = new TestScript.TestScriptMetadataCapabilityComponent();
26381    parseTestScriptTestScriptMetadataCapabilityComponentProperties(json, owner, res);
26382    return res;
26383  }
26384
26385  protected void parseTestScriptTestScriptMetadataCapabilityComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataCapabilityComponent res) throws IOException, FHIRFormatError {
26386    parseBackboneElementProperties(json, res);
26387    if (json.has("required"))
26388      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
26389    if (json.has("_required"))
26390      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
26391    if (json.has("validated"))
26392      res.setValidatedElement(parseBoolean(json.get("validated").getAsBoolean()));
26393    if (json.has("_validated"))
26394      parseElementProperties(json.getAsJsonObject("_validated"), res.getValidatedElement());
26395    if (json.has("description"))
26396      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26397    if (json.has("_description"))
26398      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26399    if (json.has("origin")) {
26400      JsonArray array = json.getAsJsonArray("origin");
26401      for (int i = 0; i < array.size(); i++) {
26402        res.getOrigin().add(parseInteger(array.get(i).getAsLong()));
26403      }
26404    };
26405    if (json.has("_origin")) {
26406      JsonArray array = json.getAsJsonArray("_origin");
26407      for (int i = 0; i < array.size(); i++) {
26408        if (i == res.getOrigin().size())
26409          res.getOrigin().add(parseInteger(null));
26410        if (array.get(i) instanceof JsonObject) 
26411          parseElementProperties(array.get(i).getAsJsonObject(), res.getOrigin().get(i));
26412      }
26413    };
26414    if (json.has("destination"))
26415      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
26416    if (json.has("_destination"))
26417      parseElementProperties(json.getAsJsonObject("_destination"), res.getDestinationElement());
26418    if (json.has("link")) {
26419      JsonArray array = json.getAsJsonArray("link");
26420      for (int i = 0; i < array.size(); i++) {
26421        res.getLink().add(parseUri(array.get(i).getAsString()));
26422      }
26423    };
26424    if (json.has("_link")) {
26425      JsonArray array = json.getAsJsonArray("_link");
26426      for (int i = 0; i < array.size(); i++) {
26427        if (i == res.getLink().size())
26428          res.getLink().add(parseUri(null));
26429        if (array.get(i) instanceof JsonObject) 
26430          parseElementProperties(array.get(i).getAsJsonObject(), res.getLink().get(i));
26431      }
26432    };
26433    if (json.has("capabilities"))
26434      res.setCapabilitiesElement(parseCanonical(json.get("capabilities").getAsString()));
26435    if (json.has("_capabilities"))
26436      parseElementProperties(json.getAsJsonObject("_capabilities"), res.getCapabilitiesElement());
26437  }
26438
26439  protected TestScript.TestScriptFixtureComponent parseTestScriptTestScriptFixtureComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26440    TestScript.TestScriptFixtureComponent res = new TestScript.TestScriptFixtureComponent();
26441    parseTestScriptTestScriptFixtureComponentProperties(json, owner, res);
26442    return res;
26443  }
26444
26445  protected void parseTestScriptTestScriptFixtureComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptFixtureComponent res) throws IOException, FHIRFormatError {
26446    parseBackboneElementProperties(json, res);
26447    if (json.has("autocreate"))
26448      res.setAutocreateElement(parseBoolean(json.get("autocreate").getAsBoolean()));
26449    if (json.has("_autocreate"))
26450      parseElementProperties(json.getAsJsonObject("_autocreate"), res.getAutocreateElement());
26451    if (json.has("autodelete"))
26452      res.setAutodeleteElement(parseBoolean(json.get("autodelete").getAsBoolean()));
26453    if (json.has("_autodelete"))
26454      parseElementProperties(json.getAsJsonObject("_autodelete"), res.getAutodeleteElement());
26455    if (json.has("resource"))
26456      res.setResource(parseReference(json.getAsJsonObject("resource")));
26457  }
26458
26459  protected TestScript.TestScriptVariableComponent parseTestScriptTestScriptVariableComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26460    TestScript.TestScriptVariableComponent res = new TestScript.TestScriptVariableComponent();
26461    parseTestScriptTestScriptVariableComponentProperties(json, owner, res);
26462    return res;
26463  }
26464
26465  protected void parseTestScriptTestScriptVariableComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptVariableComponent res) throws IOException, FHIRFormatError {
26466    parseBackboneElementProperties(json, res);
26467    if (json.has("name"))
26468      res.setNameElement(parseString(json.get("name").getAsString()));
26469    if (json.has("_name"))
26470      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
26471    if (json.has("defaultValue"))
26472      res.setDefaultValueElement(parseString(json.get("defaultValue").getAsString()));
26473    if (json.has("_defaultValue"))
26474      parseElementProperties(json.getAsJsonObject("_defaultValue"), res.getDefaultValueElement());
26475    if (json.has("description"))
26476      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26477    if (json.has("_description"))
26478      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26479    if (json.has("expression"))
26480      res.setExpressionElement(parseString(json.get("expression").getAsString()));
26481    if (json.has("_expression"))
26482      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
26483    if (json.has("headerField"))
26484      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
26485    if (json.has("_headerField"))
26486      parseElementProperties(json.getAsJsonObject("_headerField"), res.getHeaderFieldElement());
26487    if (json.has("hint"))
26488      res.setHintElement(parseString(json.get("hint").getAsString()));
26489    if (json.has("_hint"))
26490      parseElementProperties(json.getAsJsonObject("_hint"), res.getHintElement());
26491    if (json.has("path"))
26492      res.setPathElement(parseString(json.get("path").getAsString()));
26493    if (json.has("_path"))
26494      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
26495    if (json.has("sourceId"))
26496      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
26497    if (json.has("_sourceId"))
26498      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
26499  }
26500
26501  protected TestScript.TestScriptSetupComponent parseTestScriptTestScriptSetupComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26502    TestScript.TestScriptSetupComponent res = new TestScript.TestScriptSetupComponent();
26503    parseTestScriptTestScriptSetupComponentProperties(json, owner, res);
26504    return res;
26505  }
26506
26507  protected void parseTestScriptTestScriptSetupComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptSetupComponent res) throws IOException, FHIRFormatError {
26508    parseBackboneElementProperties(json, res);
26509    if (json.has("action")) {
26510      JsonArray array = json.getAsJsonArray("action");
26511      for (int i = 0; i < array.size(); i++) {
26512        res.getAction().add(parseTestScriptSetupActionComponent(array.get(i).getAsJsonObject(), owner));
26513      }
26514    };
26515  }
26516
26517  protected TestScript.SetupActionComponent parseTestScriptSetupActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26518    TestScript.SetupActionComponent res = new TestScript.SetupActionComponent();
26519    parseTestScriptSetupActionComponentProperties(json, owner, res);
26520    return res;
26521  }
26522
26523  protected void parseTestScriptSetupActionComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionComponent res) throws IOException, FHIRFormatError {
26524    parseBackboneElementProperties(json, res);
26525    if (json.has("operation"))
26526      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
26527    if (json.has("assert"))
26528      res.setAssert(parseTestScriptSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
26529  }
26530
26531  protected TestScript.SetupActionOperationComponent parseTestScriptSetupActionOperationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26532    TestScript.SetupActionOperationComponent res = new TestScript.SetupActionOperationComponent();
26533    parseTestScriptSetupActionOperationComponentProperties(json, owner, res);
26534    return res;
26535  }
26536
26537  protected void parseTestScriptSetupActionOperationComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
26538    parseBackboneElementProperties(json, res);
26539    if (json.has("type"))
26540      res.setType(parseCoding(json.getAsJsonObject("type")));
26541    if (json.has("resource"))
26542      res.setResourceElement(parseCode(json.get("resource").getAsString()));
26543    if (json.has("_resource"))
26544      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
26545    if (json.has("label"))
26546      res.setLabelElement(parseString(json.get("label").getAsString()));
26547    if (json.has("_label"))
26548      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
26549    if (json.has("description"))
26550      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26551    if (json.has("_description"))
26552      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26553    if (json.has("accept"))
26554      res.setAcceptElement(parseCode(json.get("accept").getAsString()));
26555    if (json.has("_accept"))
26556      parseElementProperties(json.getAsJsonObject("_accept"), res.getAcceptElement());
26557    if (json.has("contentType"))
26558      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
26559    if (json.has("_contentType"))
26560      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
26561    if (json.has("destination"))
26562      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
26563    if (json.has("_destination"))
26564      parseElementProperties(json.getAsJsonObject("_destination"), res.getDestinationElement());
26565    if (json.has("encodeRequestUrl"))
26566      res.setEncodeRequestUrlElement(parseBoolean(json.get("encodeRequestUrl").getAsBoolean()));
26567    if (json.has("_encodeRequestUrl"))
26568      parseElementProperties(json.getAsJsonObject("_encodeRequestUrl"), res.getEncodeRequestUrlElement());
26569    if (json.has("method"))
26570      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
26571    if (json.has("_method"))
26572      parseElementProperties(json.getAsJsonObject("_method"), res.getMethodElement());
26573    if (json.has("origin"))
26574      res.setOriginElement(parseInteger(json.get("origin").getAsLong()));
26575    if (json.has("_origin"))
26576      parseElementProperties(json.getAsJsonObject("_origin"), res.getOriginElement());
26577    if (json.has("params"))
26578      res.setParamsElement(parseString(json.get("params").getAsString()));
26579    if (json.has("_params"))
26580      parseElementProperties(json.getAsJsonObject("_params"), res.getParamsElement());
26581    if (json.has("requestHeader")) {
26582      JsonArray array = json.getAsJsonArray("requestHeader");
26583      for (int i = 0; i < array.size(); i++) {
26584        res.getRequestHeader().add(parseTestScriptSetupActionOperationRequestHeaderComponent(array.get(i).getAsJsonObject(), owner));
26585      }
26586    };
26587    if (json.has("requestId"))
26588      res.setRequestIdElement(parseId(json.get("requestId").getAsString()));
26589    if (json.has("_requestId"))
26590      parseElementProperties(json.getAsJsonObject("_requestId"), res.getRequestIdElement());
26591    if (json.has("responseId"))
26592      res.setResponseIdElement(parseId(json.get("responseId").getAsString()));
26593    if (json.has("_responseId"))
26594      parseElementProperties(json.getAsJsonObject("_responseId"), res.getResponseIdElement());
26595    if (json.has("sourceId"))
26596      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
26597    if (json.has("_sourceId"))
26598      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
26599    if (json.has("targetId"))
26600      res.setTargetIdElement(parseId(json.get("targetId").getAsString()));
26601    if (json.has("_targetId"))
26602      parseElementProperties(json.getAsJsonObject("_targetId"), res.getTargetIdElement());
26603    if (json.has("url"))
26604      res.setUrlElement(parseString(json.get("url").getAsString()));
26605    if (json.has("_url"))
26606      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
26607  }
26608
26609  protected TestScript.SetupActionOperationRequestHeaderComponent parseTestScriptSetupActionOperationRequestHeaderComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26610    TestScript.SetupActionOperationRequestHeaderComponent res = new TestScript.SetupActionOperationRequestHeaderComponent();
26611    parseTestScriptSetupActionOperationRequestHeaderComponentProperties(json, owner, res);
26612    return res;
26613  }
26614
26615  protected void parseTestScriptSetupActionOperationRequestHeaderComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionOperationRequestHeaderComponent res) throws IOException, FHIRFormatError {
26616    parseBackboneElementProperties(json, res);
26617    if (json.has("field"))
26618      res.setFieldElement(parseString(json.get("field").getAsString()));
26619    if (json.has("_field"))
26620      parseElementProperties(json.getAsJsonObject("_field"), res.getFieldElement());
26621    if (json.has("value"))
26622      res.setValueElement(parseString(json.get("value").getAsString()));
26623    if (json.has("_value"))
26624      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
26625  }
26626
26627  protected TestScript.SetupActionAssertComponent parseTestScriptSetupActionAssertComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26628    TestScript.SetupActionAssertComponent res = new TestScript.SetupActionAssertComponent();
26629    parseTestScriptSetupActionAssertComponentProperties(json, owner, res);
26630    return res;
26631  }
26632
26633  protected void parseTestScriptSetupActionAssertComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
26634    parseBackboneElementProperties(json, res);
26635    if (json.has("label"))
26636      res.setLabelElement(parseString(json.get("label").getAsString()));
26637    if (json.has("_label"))
26638      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
26639    if (json.has("description"))
26640      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26641    if (json.has("_description"))
26642      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26643    if (json.has("direction"))
26644      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), TestScript.AssertionDirectionType.NULL, new TestScript.AssertionDirectionTypeEnumFactory()));
26645    if (json.has("_direction"))
26646      parseElementProperties(json.getAsJsonObject("_direction"), res.getDirectionElement());
26647    if (json.has("compareToSourceId"))
26648      res.setCompareToSourceIdElement(parseString(json.get("compareToSourceId").getAsString()));
26649    if (json.has("_compareToSourceId"))
26650      parseElementProperties(json.getAsJsonObject("_compareToSourceId"), res.getCompareToSourceIdElement());
26651    if (json.has("compareToSourceExpression"))
26652      res.setCompareToSourceExpressionElement(parseString(json.get("compareToSourceExpression").getAsString()));
26653    if (json.has("_compareToSourceExpression"))
26654      parseElementProperties(json.getAsJsonObject("_compareToSourceExpression"), res.getCompareToSourceExpressionElement());
26655    if (json.has("compareToSourcePath"))
26656      res.setCompareToSourcePathElement(parseString(json.get("compareToSourcePath").getAsString()));
26657    if (json.has("_compareToSourcePath"))
26658      parseElementProperties(json.getAsJsonObject("_compareToSourcePath"), res.getCompareToSourcePathElement());
26659    if (json.has("contentType"))
26660      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
26661    if (json.has("_contentType"))
26662      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
26663    if (json.has("expression"))
26664      res.setExpressionElement(parseString(json.get("expression").getAsString()));
26665    if (json.has("_expression"))
26666      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
26667    if (json.has("headerField"))
26668      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
26669    if (json.has("_headerField"))
26670      parseElementProperties(json.getAsJsonObject("_headerField"), res.getHeaderFieldElement());
26671    if (json.has("minimumId"))
26672      res.setMinimumIdElement(parseString(json.get("minimumId").getAsString()));
26673    if (json.has("_minimumId"))
26674      parseElementProperties(json.getAsJsonObject("_minimumId"), res.getMinimumIdElement());
26675    if (json.has("navigationLinks"))
26676      res.setNavigationLinksElement(parseBoolean(json.get("navigationLinks").getAsBoolean()));
26677    if (json.has("_navigationLinks"))
26678      parseElementProperties(json.getAsJsonObject("_navigationLinks"), res.getNavigationLinksElement());
26679    if (json.has("operator"))
26680      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), TestScript.AssertionOperatorType.NULL, new TestScript.AssertionOperatorTypeEnumFactory()));
26681    if (json.has("_operator"))
26682      parseElementProperties(json.getAsJsonObject("_operator"), res.getOperatorElement());
26683    if (json.has("path"))
26684      res.setPathElement(parseString(json.get("path").getAsString()));
26685    if (json.has("_path"))
26686      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
26687    if (json.has("requestMethod"))
26688      res.setRequestMethodElement(parseEnumeration(json.get("requestMethod").getAsString(), TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
26689    if (json.has("_requestMethod"))
26690      parseElementProperties(json.getAsJsonObject("_requestMethod"), res.getRequestMethodElement());
26691    if (json.has("requestURL"))
26692      res.setRequestURLElement(parseString(json.get("requestURL").getAsString()));
26693    if (json.has("_requestURL"))
26694      parseElementProperties(json.getAsJsonObject("_requestURL"), res.getRequestURLElement());
26695    if (json.has("resource"))
26696      res.setResourceElement(parseCode(json.get("resource").getAsString()));
26697    if (json.has("_resource"))
26698      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
26699    if (json.has("response"))
26700      res.setResponseElement(parseEnumeration(json.get("response").getAsString(), TestScript.AssertionResponseTypes.NULL, new TestScript.AssertionResponseTypesEnumFactory()));
26701    if (json.has("_response"))
26702      parseElementProperties(json.getAsJsonObject("_response"), res.getResponseElement());
26703    if (json.has("responseCode"))
26704      res.setResponseCodeElement(parseString(json.get("responseCode").getAsString()));
26705    if (json.has("_responseCode"))
26706      parseElementProperties(json.getAsJsonObject("_responseCode"), res.getResponseCodeElement());
26707    if (json.has("sourceId"))
26708      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
26709    if (json.has("_sourceId"))
26710      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
26711    if (json.has("validateProfileId"))
26712      res.setValidateProfileIdElement(parseId(json.get("validateProfileId").getAsString()));
26713    if (json.has("_validateProfileId"))
26714      parseElementProperties(json.getAsJsonObject("_validateProfileId"), res.getValidateProfileIdElement());
26715    if (json.has("value"))
26716      res.setValueElement(parseString(json.get("value").getAsString()));
26717    if (json.has("_value"))
26718      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
26719    if (json.has("warningOnly"))
26720      res.setWarningOnlyElement(parseBoolean(json.get("warningOnly").getAsBoolean()));
26721    if (json.has("_warningOnly"))
26722      parseElementProperties(json.getAsJsonObject("_warningOnly"), res.getWarningOnlyElement());
26723  }
26724
26725  protected TestScript.TestScriptTestComponent parseTestScriptTestScriptTestComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26726    TestScript.TestScriptTestComponent res = new TestScript.TestScriptTestComponent();
26727    parseTestScriptTestScriptTestComponentProperties(json, owner, res);
26728    return res;
26729  }
26730
26731  protected void parseTestScriptTestScriptTestComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptTestComponent res) throws IOException, FHIRFormatError {
26732    parseBackboneElementProperties(json, res);
26733    if (json.has("name"))
26734      res.setNameElement(parseString(json.get("name").getAsString()));
26735    if (json.has("_name"))
26736      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
26737    if (json.has("description"))
26738      res.setDescriptionElement(parseString(json.get("description").getAsString()));
26739    if (json.has("_description"))
26740      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26741    if (json.has("action")) {
26742      JsonArray array = json.getAsJsonArray("action");
26743      for (int i = 0; i < array.size(); i++) {
26744        res.getAction().add(parseTestScriptTestActionComponent(array.get(i).getAsJsonObject(), owner));
26745      }
26746    };
26747  }
26748
26749  protected TestScript.TestActionComponent parseTestScriptTestActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26750    TestScript.TestActionComponent res = new TestScript.TestActionComponent();
26751    parseTestScriptTestActionComponentProperties(json, owner, res);
26752    return res;
26753  }
26754
26755  protected void parseTestScriptTestActionComponentProperties(JsonObject json, TestScript owner, TestScript.TestActionComponent res) throws IOException, FHIRFormatError {
26756    parseBackboneElementProperties(json, res);
26757    if (json.has("operation"))
26758      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
26759    if (json.has("assert"))
26760      res.setAssert(parseTestScriptSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
26761  }
26762
26763  protected TestScript.TestScriptTeardownComponent parseTestScriptTestScriptTeardownComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26764    TestScript.TestScriptTeardownComponent res = new TestScript.TestScriptTeardownComponent();
26765    parseTestScriptTestScriptTeardownComponentProperties(json, owner, res);
26766    return res;
26767  }
26768
26769  protected void parseTestScriptTestScriptTeardownComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptTeardownComponent res) throws IOException, FHIRFormatError {
26770    parseBackboneElementProperties(json, res);
26771    if (json.has("action")) {
26772      JsonArray array = json.getAsJsonArray("action");
26773      for (int i = 0; i < array.size(); i++) {
26774        res.getAction().add(parseTestScriptTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
26775      }
26776    };
26777  }
26778
26779  protected TestScript.TeardownActionComponent parseTestScriptTeardownActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
26780    TestScript.TeardownActionComponent res = new TestScript.TeardownActionComponent();
26781    parseTestScriptTeardownActionComponentProperties(json, owner, res);
26782    return res;
26783  }
26784
26785  protected void parseTestScriptTeardownActionComponentProperties(JsonObject json, TestScript owner, TestScript.TeardownActionComponent res) throws IOException, FHIRFormatError {
26786    parseBackboneElementProperties(json, res);
26787    if (json.has("operation"))
26788      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
26789  }
26790
26791  protected ValueSet parseValueSet(JsonObject json) throws IOException, FHIRFormatError {
26792    ValueSet res = new ValueSet();
26793    parseValueSetProperties(json, res);
26794    return res;
26795  }
26796
26797  protected void parseValueSetProperties(JsonObject json, ValueSet res) throws IOException, FHIRFormatError {
26798    parseDomainResourceProperties(json, res);
26799    if (json.has("url"))
26800      res.setUrlElement(parseUri(json.get("url").getAsString()));
26801    if (json.has("_url"))
26802      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
26803    if (json.has("identifier")) {
26804      JsonArray array = json.getAsJsonArray("identifier");
26805      for (int i = 0; i < array.size(); i++) {
26806        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26807      }
26808    };
26809    if (json.has("version"))
26810      res.setVersionElement(parseString(json.get("version").getAsString()));
26811    if (json.has("_version"))
26812      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
26813    if (json.has("name"))
26814      res.setNameElement(parseString(json.get("name").getAsString()));
26815    if (json.has("_name"))
26816      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
26817    if (json.has("title"))
26818      res.setTitleElement(parseString(json.get("title").getAsString()));
26819    if (json.has("_title"))
26820      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
26821    if (json.has("status"))
26822      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
26823    if (json.has("_status"))
26824      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
26825    if (json.has("experimental"))
26826      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
26827    if (json.has("_experimental"))
26828      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
26829    if (json.has("date"))
26830      res.setDateElement(parseDateTime(json.get("date").getAsString()));
26831    if (json.has("_date"))
26832      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
26833    if (json.has("publisher"))
26834      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
26835    if (json.has("_publisher"))
26836      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
26837    if (json.has("contact")) {
26838      JsonArray array = json.getAsJsonArray("contact");
26839      for (int i = 0; i < array.size(); i++) {
26840        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
26841      }
26842    };
26843    if (json.has("description"))
26844      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
26845    if (json.has("_description"))
26846      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
26847    if (json.has("useContext")) {
26848      JsonArray array = json.getAsJsonArray("useContext");
26849      for (int i = 0; i < array.size(); i++) {
26850        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
26851      }
26852    };
26853    if (json.has("jurisdiction")) {
26854      JsonArray array = json.getAsJsonArray("jurisdiction");
26855      for (int i = 0; i < array.size(); i++) {
26856        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26857      }
26858    };
26859    if (json.has("immutable"))
26860      res.setImmutableElement(parseBoolean(json.get("immutable").getAsBoolean()));
26861    if (json.has("_immutable"))
26862      parseElementProperties(json.getAsJsonObject("_immutable"), res.getImmutableElement());
26863    if (json.has("purpose"))
26864      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
26865    if (json.has("_purpose"))
26866      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
26867    if (json.has("copyright"))
26868      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
26869    if (json.has("_copyright"))
26870      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
26871    if (json.has("compose"))
26872      res.setCompose(parseValueSetValueSetComposeComponent(json.getAsJsonObject("compose"), res));
26873    if (json.has("expansion"))
26874      res.setExpansion(parseValueSetValueSetExpansionComponent(json.getAsJsonObject("expansion"), res));
26875  }
26876
26877  protected ValueSet.ValueSetComposeComponent parseValueSetValueSetComposeComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
26878    ValueSet.ValueSetComposeComponent res = new ValueSet.ValueSetComposeComponent();
26879    parseValueSetValueSetComposeComponentProperties(json, owner, res);
26880    return res;
26881  }
26882
26883  protected void parseValueSetValueSetComposeComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetComposeComponent res) throws IOException, FHIRFormatError {
26884    parseBackboneElementProperties(json, res);
26885    if (json.has("lockedDate"))
26886      res.setLockedDateElement(parseDate(json.get("lockedDate").getAsString()));
26887    if (json.has("_lockedDate"))
26888      parseElementProperties(json.getAsJsonObject("_lockedDate"), res.getLockedDateElement());
26889    if (json.has("inactive"))
26890      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
26891    if (json.has("_inactive"))
26892      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
26893    if (json.has("include")) {
26894      JsonArray array = json.getAsJsonArray("include");
26895      for (int i = 0; i < array.size(); i++) {
26896        res.getInclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
26897      }
26898    };
26899    if (json.has("exclude")) {
26900      JsonArray array = json.getAsJsonArray("exclude");
26901      for (int i = 0; i < array.size(); i++) {
26902        res.getExclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
26903      }
26904    };
26905  }
26906
26907  protected ValueSet.ConceptSetComponent parseValueSetConceptSetComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
26908    ValueSet.ConceptSetComponent res = new ValueSet.ConceptSetComponent();
26909    parseValueSetConceptSetComponentProperties(json, owner, res);
26910    return res;
26911  }
26912
26913  protected void parseValueSetConceptSetComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptSetComponent res) throws IOException, FHIRFormatError {
26914    parseBackboneElementProperties(json, res);
26915    if (json.has("system"))
26916      res.setSystemElement(parseUri(json.get("system").getAsString()));
26917    if (json.has("_system"))
26918      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
26919    if (json.has("version"))
26920      res.setVersionElement(parseString(json.get("version").getAsString()));
26921    if (json.has("_version"))
26922      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
26923    if (json.has("concept")) {
26924      JsonArray array = json.getAsJsonArray("concept");
26925      for (int i = 0; i < array.size(); i++) {
26926        res.getConcept().add(parseValueSetConceptReferenceComponent(array.get(i).getAsJsonObject(), owner));
26927      }
26928    };
26929    if (json.has("filter")) {
26930      JsonArray array = json.getAsJsonArray("filter");
26931      for (int i = 0; i < array.size(); i++) {
26932        res.getFilter().add(parseValueSetConceptSetFilterComponent(array.get(i).getAsJsonObject(), owner));
26933      }
26934    };
26935    if (json.has("valueSet")) {
26936      JsonArray array = json.getAsJsonArray("valueSet");
26937      for (int i = 0; i < array.size(); i++) {
26938        res.getValueSet().add(parseCanonical(array.get(i).getAsString()));
26939      }
26940    };
26941    if (json.has("_valueSet")) {
26942      JsonArray array = json.getAsJsonArray("_valueSet");
26943      for (int i = 0; i < array.size(); i++) {
26944        if (i == res.getValueSet().size())
26945          res.getValueSet().add(parseCanonical(null));
26946        if (array.get(i) instanceof JsonObject) 
26947          parseElementProperties(array.get(i).getAsJsonObject(), res.getValueSet().get(i));
26948      }
26949    };
26950  }
26951
26952  protected ValueSet.ConceptReferenceComponent parseValueSetConceptReferenceComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
26953    ValueSet.ConceptReferenceComponent res = new ValueSet.ConceptReferenceComponent();
26954    parseValueSetConceptReferenceComponentProperties(json, owner, res);
26955    return res;
26956  }
26957
26958  protected void parseValueSetConceptReferenceComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptReferenceComponent res) throws IOException, FHIRFormatError {
26959    parseBackboneElementProperties(json, res);
26960    if (json.has("code"))
26961      res.setCodeElement(parseCode(json.get("code").getAsString()));
26962    if (json.has("_code"))
26963      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
26964    if (json.has("display"))
26965      res.setDisplayElement(parseString(json.get("display").getAsString()));
26966    if (json.has("_display"))
26967      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
26968    if (json.has("designation")) {
26969      JsonArray array = json.getAsJsonArray("designation");
26970      for (int i = 0; i < array.size(); i++) {
26971        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject(), owner));
26972      }
26973    };
26974  }
26975
26976  protected ValueSet.ConceptReferenceDesignationComponent parseValueSetConceptReferenceDesignationComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
26977    ValueSet.ConceptReferenceDesignationComponent res = new ValueSet.ConceptReferenceDesignationComponent();
26978    parseValueSetConceptReferenceDesignationComponentProperties(json, owner, res);
26979    return res;
26980  }
26981
26982  protected void parseValueSetConceptReferenceDesignationComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptReferenceDesignationComponent res) throws IOException, FHIRFormatError {
26983    parseBackboneElementProperties(json, res);
26984    if (json.has("language"))
26985      res.setLanguageElement(parseCode(json.get("language").getAsString()));
26986    if (json.has("_language"))
26987      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
26988    if (json.has("use"))
26989      res.setUse(parseCoding(json.getAsJsonObject("use")));
26990    if (json.has("value"))
26991      res.setValueElement(parseString(json.get("value").getAsString()));
26992    if (json.has("_value"))
26993      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
26994  }
26995
26996  protected ValueSet.ConceptSetFilterComponent parseValueSetConceptSetFilterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
26997    ValueSet.ConceptSetFilterComponent res = new ValueSet.ConceptSetFilterComponent();
26998    parseValueSetConceptSetFilterComponentProperties(json, owner, res);
26999    return res;
27000  }
27001
27002  protected void parseValueSetConceptSetFilterComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptSetFilterComponent res) throws IOException, FHIRFormatError {
27003    parseBackboneElementProperties(json, res);
27004    if (json.has("property"))
27005      res.setPropertyElement(parseCode(json.get("property").getAsString()));
27006    if (json.has("_property"))
27007      parseElementProperties(json.getAsJsonObject("_property"), res.getPropertyElement());
27008    if (json.has("op"))
27009      res.setOpElement(parseEnumeration(json.get("op").getAsString(), ValueSet.FilterOperator.NULL, new ValueSet.FilterOperatorEnumFactory()));
27010    if (json.has("_op"))
27011      parseElementProperties(json.getAsJsonObject("_op"), res.getOpElement());
27012    if (json.has("value"))
27013      res.setValueElement(parseString(json.get("value").getAsString()));
27014    if (json.has("_value"))
27015      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
27016  }
27017
27018  protected ValueSet.ValueSetExpansionComponent parseValueSetValueSetExpansionComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27019    ValueSet.ValueSetExpansionComponent res = new ValueSet.ValueSetExpansionComponent();
27020    parseValueSetValueSetExpansionComponentProperties(json, owner, res);
27021    return res;
27022  }
27023
27024  protected void parseValueSetValueSetExpansionComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionComponent res) throws IOException, FHIRFormatError {
27025    parseBackboneElementProperties(json, res);
27026    if (json.has("identifier"))
27027      res.setIdentifierElement(parseUri(json.get("identifier").getAsString()));
27028    if (json.has("_identifier"))
27029      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
27030    if (json.has("timestamp"))
27031      res.setTimestampElement(parseDateTime(json.get("timestamp").getAsString()));
27032    if (json.has("_timestamp"))
27033      parseElementProperties(json.getAsJsonObject("_timestamp"), res.getTimestampElement());
27034    if (json.has("total"))
27035      res.setTotalElement(parseInteger(json.get("total").getAsLong()));
27036    if (json.has("_total"))
27037      parseElementProperties(json.getAsJsonObject("_total"), res.getTotalElement());
27038    if (json.has("offset"))
27039      res.setOffsetElement(parseInteger(json.get("offset").getAsLong()));
27040    if (json.has("_offset"))
27041      parseElementProperties(json.getAsJsonObject("_offset"), res.getOffsetElement());
27042    if (json.has("parameter")) {
27043      JsonArray array = json.getAsJsonArray("parameter");
27044      for (int i = 0; i < array.size(); i++) {
27045        res.getParameter().add(parseValueSetValueSetExpansionParameterComponent(array.get(i).getAsJsonObject(), owner));
27046      }
27047    };
27048    if (json.has("contains")) {
27049      JsonArray array = json.getAsJsonArray("contains");
27050      for (int i = 0; i < array.size(); i++) {
27051        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
27052      }
27053    };
27054  }
27055
27056  protected ValueSet.ValueSetExpansionParameterComponent parseValueSetValueSetExpansionParameterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27057    ValueSet.ValueSetExpansionParameterComponent res = new ValueSet.ValueSetExpansionParameterComponent();
27058    parseValueSetValueSetExpansionParameterComponentProperties(json, owner, res);
27059    return res;
27060  }
27061
27062  protected void parseValueSetValueSetExpansionParameterComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionParameterComponent res) throws IOException, FHIRFormatError {
27063    parseBackboneElementProperties(json, res);
27064    if (json.has("name"))
27065      res.setNameElement(parseString(json.get("name").getAsString()));
27066    if (json.has("_name"))
27067      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
27068    Type value = parseType("value", json);
27069    if (value != null)
27070      res.setValue(value);
27071  }
27072
27073  protected ValueSet.ValueSetExpansionContainsComponent parseValueSetValueSetExpansionContainsComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
27074    ValueSet.ValueSetExpansionContainsComponent res = new ValueSet.ValueSetExpansionContainsComponent();
27075    parseValueSetValueSetExpansionContainsComponentProperties(json, owner, res);
27076    return res;
27077  }
27078
27079  protected void parseValueSetValueSetExpansionContainsComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionContainsComponent res) throws IOException, FHIRFormatError {
27080    parseBackboneElementProperties(json, res);
27081    if (json.has("system"))
27082      res.setSystemElement(parseUri(json.get("system").getAsString()));
27083    if (json.has("_system"))
27084      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
27085    if (json.has("abstract"))
27086      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
27087    if (json.has("_abstract"))
27088      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
27089    if (json.has("inactive"))
27090      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
27091    if (json.has("_inactive"))
27092      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
27093    if (json.has("version"))
27094      res.setVersionElement(parseString(json.get("version").getAsString()));
27095    if (json.has("_version"))
27096      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
27097    if (json.has("code"))
27098      res.setCodeElement(parseCode(json.get("code").getAsString()));
27099    if (json.has("_code"))
27100      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
27101    if (json.has("display"))
27102      res.setDisplayElement(parseString(json.get("display").getAsString()));
27103    if (json.has("_display"))
27104      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
27105    if (json.has("designation")) {
27106      JsonArray array = json.getAsJsonArray("designation");
27107      for (int i = 0; i < array.size(); i++) {
27108        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject(), owner));
27109      }
27110    };
27111    if (json.has("contains")) {
27112      JsonArray array = json.getAsJsonArray("contains");
27113      for (int i = 0; i < array.size(); i++) {
27114        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
27115      }
27116    };
27117  }
27118
27119  protected VerificationResult parseVerificationResult(JsonObject json) throws IOException, FHIRFormatError {
27120    VerificationResult res = new VerificationResult();
27121    parseVerificationResultProperties(json, res);
27122    return res;
27123  }
27124
27125  protected void parseVerificationResultProperties(JsonObject json, VerificationResult res) throws IOException, FHIRFormatError {
27126    parseDomainResourceProperties(json, res);
27127    if (json.has("target")) {
27128      JsonArray array = json.getAsJsonArray("target");
27129      for (int i = 0; i < array.size(); i++) {
27130        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
27131      }
27132    };
27133    if (json.has("targetLocation")) {
27134      JsonArray array = json.getAsJsonArray("targetLocation");
27135      for (int i = 0; i < array.size(); i++) {
27136        res.getTargetLocation().add(parseString(array.get(i).getAsString()));
27137      }
27138    };
27139    if (json.has("_targetLocation")) {
27140      JsonArray array = json.getAsJsonArray("_targetLocation");
27141      for (int i = 0; i < array.size(); i++) {
27142        if (i == res.getTargetLocation().size())
27143          res.getTargetLocation().add(parseString(null));
27144        if (array.get(i) instanceof JsonObject) 
27145          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetLocation().get(i));
27146      }
27147    };
27148    if (json.has("need"))
27149      res.setNeed(parseCodeableConcept(json.getAsJsonObject("need")));
27150    if (json.has("status"))
27151      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), VerificationResult.Status.NULL, new VerificationResult.StatusEnumFactory()));
27152    if (json.has("_status"))
27153      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
27154    if (json.has("statusDate"))
27155      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
27156    if (json.has("_statusDate"))
27157      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
27158    if (json.has("validationType"))
27159      res.setValidationType(parseCodeableConcept(json.getAsJsonObject("validationType")));
27160    if (json.has("validationProcess")) {
27161      JsonArray array = json.getAsJsonArray("validationProcess");
27162      for (int i = 0; i < array.size(); i++) {
27163        res.getValidationProcess().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27164      }
27165    };
27166    if (json.has("frequency"))
27167      res.setFrequency(parseTiming(json.getAsJsonObject("frequency")));
27168    if (json.has("lastPerformed"))
27169      res.setLastPerformedElement(parseDateTime(json.get("lastPerformed").getAsString()));
27170    if (json.has("_lastPerformed"))
27171      parseElementProperties(json.getAsJsonObject("_lastPerformed"), res.getLastPerformedElement());
27172    if (json.has("nextScheduled"))
27173      res.setNextScheduledElement(parseDate(json.get("nextScheduled").getAsString()));
27174    if (json.has("_nextScheduled"))
27175      parseElementProperties(json.getAsJsonObject("_nextScheduled"), res.getNextScheduledElement());
27176    if (json.has("failureAction"))
27177      res.setFailureAction(parseCodeableConcept(json.getAsJsonObject("failureAction")));
27178    if (json.has("primarySource")) {
27179      JsonArray array = json.getAsJsonArray("primarySource");
27180      for (int i = 0; i < array.size(); i++) {
27181        res.getPrimarySource().add(parseVerificationResultVerificationResultPrimarySourceComponent(array.get(i).getAsJsonObject(), res));
27182      }
27183    };
27184    if (json.has("attestation"))
27185      res.setAttestation(parseVerificationResultVerificationResultAttestationComponent(json.getAsJsonObject("attestation"), res));
27186    if (json.has("validator")) {
27187      JsonArray array = json.getAsJsonArray("validator");
27188      for (int i = 0; i < array.size(); i++) {
27189        res.getValidator().add(parseVerificationResultVerificationResultValidatorComponent(array.get(i).getAsJsonObject(), res));
27190      }
27191    };
27192  }
27193
27194  protected VerificationResult.VerificationResultPrimarySourceComponent parseVerificationResultVerificationResultPrimarySourceComponent(JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
27195    VerificationResult.VerificationResultPrimarySourceComponent res = new VerificationResult.VerificationResultPrimarySourceComponent();
27196    parseVerificationResultVerificationResultPrimarySourceComponentProperties(json, owner, res);
27197    return res;
27198  }
27199
27200  protected void parseVerificationResultVerificationResultPrimarySourceComponentProperties(JsonObject json, VerificationResult owner, VerificationResult.VerificationResultPrimarySourceComponent res) throws IOException, FHIRFormatError {
27201    parseBackboneElementProperties(json, res);
27202    if (json.has("who"))
27203      res.setWho(parseReference(json.getAsJsonObject("who")));
27204    if (json.has("type")) {
27205      JsonArray array = json.getAsJsonArray("type");
27206      for (int i = 0; i < array.size(); i++) {
27207        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27208      }
27209    };
27210    if (json.has("communicationMethod")) {
27211      JsonArray array = json.getAsJsonArray("communicationMethod");
27212      for (int i = 0; i < array.size(); i++) {
27213        res.getCommunicationMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27214      }
27215    };
27216    if (json.has("validationStatus"))
27217      res.setValidationStatus(parseCodeableConcept(json.getAsJsonObject("validationStatus")));
27218    if (json.has("validationDate"))
27219      res.setValidationDateElement(parseDateTime(json.get("validationDate").getAsString()));
27220    if (json.has("_validationDate"))
27221      parseElementProperties(json.getAsJsonObject("_validationDate"), res.getValidationDateElement());
27222    if (json.has("canPushUpdates"))
27223      res.setCanPushUpdates(parseCodeableConcept(json.getAsJsonObject("canPushUpdates")));
27224    if (json.has("pushTypeAvailable")) {
27225      JsonArray array = json.getAsJsonArray("pushTypeAvailable");
27226      for (int i = 0; i < array.size(); i++) {
27227        res.getPushTypeAvailable().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
27228      }
27229    };
27230  }
27231
27232  protected VerificationResult.VerificationResultAttestationComponent parseVerificationResultVerificationResultAttestationComponent(JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
27233    VerificationResult.VerificationResultAttestationComponent res = new VerificationResult.VerificationResultAttestationComponent();
27234    parseVerificationResultVerificationResultAttestationComponentProperties(json, owner, res);
27235    return res;
27236  }
27237
27238  protected void parseVerificationResultVerificationResultAttestationComponentProperties(JsonObject json, VerificationResult owner, VerificationResult.VerificationResultAttestationComponent res) throws IOException, FHIRFormatError {
27239    parseBackboneElementProperties(json, res);
27240    if (json.has("who"))
27241      res.setWho(parseReference(json.getAsJsonObject("who")));
27242    if (json.has("onBehalfOf"))
27243      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
27244    if (json.has("communicationMethod"))
27245      res.setCommunicationMethod(parseCodeableConcept(json.getAsJsonObject("communicationMethod")));
27246    if (json.has("date"))
27247      res.setDateElement(parseDate(json.get("date").getAsString()));
27248    if (json.has("_date"))
27249      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
27250    if (json.has("sourceIdentityCertificate"))
27251      res.setSourceIdentityCertificateElement(parseString(json.get("sourceIdentityCertificate").getAsString()));
27252    if (json.has("_sourceIdentityCertificate"))
27253      parseElementProperties(json.getAsJsonObject("_sourceIdentityCertificate"), res.getSourceIdentityCertificateElement());
27254    if (json.has("proxyIdentityCertificate"))
27255      res.setProxyIdentityCertificateElement(parseString(json.get("proxyIdentityCertificate").getAsString()));
27256    if (json.has("_proxyIdentityCertificate"))
27257      parseElementProperties(json.getAsJsonObject("_proxyIdentityCertificate"), res.getProxyIdentityCertificateElement());
27258    if (json.has("proxySignature"))
27259      res.setProxySignature(parseSignature(json.getAsJsonObject("proxySignature")));
27260    if (json.has("sourceSignature"))
27261      res.setSourceSignature(parseSignature(json.getAsJsonObject("sourceSignature")));
27262  }
27263
27264  protected VerificationResult.VerificationResultValidatorComponent parseVerificationResultVerificationResultValidatorComponent(JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
27265    VerificationResult.VerificationResultValidatorComponent res = new VerificationResult.VerificationResultValidatorComponent();
27266    parseVerificationResultVerificationResultValidatorComponentProperties(json, owner, res);
27267    return res;
27268  }
27269
27270  protected void parseVerificationResultVerificationResultValidatorComponentProperties(JsonObject json, VerificationResult owner, VerificationResult.VerificationResultValidatorComponent res) throws IOException, FHIRFormatError {
27271    parseBackboneElementProperties(json, res);
27272    if (json.has("organization"))
27273      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
27274    if (json.has("identityCertificate"))
27275      res.setIdentityCertificateElement(parseString(json.get("identityCertificate").getAsString()));
27276    if (json.has("_identityCertificate"))
27277      parseElementProperties(json.getAsJsonObject("_identityCertificate"), res.getIdentityCertificateElement());
27278    if (json.has("attestationSignature"))
27279      res.setAttestationSignature(parseSignature(json.getAsJsonObject("attestationSignature")));
27280  }
27281
27282  protected VisionPrescription parseVisionPrescription(JsonObject json) throws IOException, FHIRFormatError {
27283    VisionPrescription res = new VisionPrescription();
27284    parseVisionPrescriptionProperties(json, res);
27285    return res;
27286  }
27287
27288  protected void parseVisionPrescriptionProperties(JsonObject json, VisionPrescription res) throws IOException, FHIRFormatError {
27289    parseDomainResourceProperties(json, res);
27290    if (json.has("identifier")) {
27291      JsonArray array = json.getAsJsonArray("identifier");
27292      for (int i = 0; i < array.size(); i++) {
27293        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
27294      }
27295    };
27296    if (json.has("status"))
27297      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), VisionPrescription.VisionStatus.NULL, new VisionPrescription.VisionStatusEnumFactory()));
27298    if (json.has("_status"))
27299      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
27300    if (json.has("created"))
27301      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
27302    if (json.has("_created"))
27303      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
27304    if (json.has("patient"))
27305      res.setPatient(parseReference(json.getAsJsonObject("patient")));
27306    if (json.has("encounter"))
27307      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
27308    if (json.has("dateWritten"))
27309      res.setDateWrittenElement(parseDateTime(json.get("dateWritten").getAsString()));
27310    if (json.has("_dateWritten"))
27311      parseElementProperties(json.getAsJsonObject("_dateWritten"), res.getDateWrittenElement());
27312    if (json.has("prescriber"))
27313      res.setPrescriber(parseReference(json.getAsJsonObject("prescriber")));
27314    if (json.has("lensSpecification")) {
27315      JsonArray array = json.getAsJsonArray("lensSpecification");
27316      for (int i = 0; i < array.size(); i++) {
27317        res.getLensSpecification().add(parseVisionPrescriptionVisionPrescriptionLensSpecificationComponent(array.get(i).getAsJsonObject(), res));
27318      }
27319    };
27320  }
27321
27322  protected VisionPrescription.VisionPrescriptionLensSpecificationComponent parseVisionPrescriptionVisionPrescriptionLensSpecificationComponent(JsonObject json, VisionPrescription owner) throws IOException, FHIRFormatError {
27323    VisionPrescription.VisionPrescriptionLensSpecificationComponent res = new VisionPrescription.VisionPrescriptionLensSpecificationComponent();
27324    parseVisionPrescriptionVisionPrescriptionLensSpecificationComponentProperties(json, owner, res);
27325    return res;
27326  }
27327
27328  protected void parseVisionPrescriptionVisionPrescriptionLensSpecificationComponentProperties(JsonObject json, VisionPrescription owner, VisionPrescription.VisionPrescriptionLensSpecificationComponent res) throws IOException, FHIRFormatError {
27329    parseBackboneElementProperties(json, res);
27330    if (json.has("product"))
27331      res.setProduct(parseCodeableConcept(json.getAsJsonObject("product")));
27332    if (json.has("eye"))
27333      res.setEyeElement(parseEnumeration(json.get("eye").getAsString(), VisionPrescription.VisionEyes.NULL, new VisionPrescription.VisionEyesEnumFactory()));
27334    if (json.has("_eye"))
27335      parseElementProperties(json.getAsJsonObject("_eye"), res.getEyeElement());
27336    if (json.has("sphere"))
27337      res.setSphereElement(parseDecimal(json.get("sphere").getAsBigDecimal()));
27338    if (json.has("_sphere"))
27339      parseElementProperties(json.getAsJsonObject("_sphere"), res.getSphereElement());
27340    if (json.has("cylinder"))
27341      res.setCylinderElement(parseDecimal(json.get("cylinder").getAsBigDecimal()));
27342    if (json.has("_cylinder"))
27343      parseElementProperties(json.getAsJsonObject("_cylinder"), res.getCylinderElement());
27344    if (json.has("axis"))
27345      res.setAxisElement(parseInteger(json.get("axis").getAsLong()));
27346    if (json.has("_axis"))
27347      parseElementProperties(json.getAsJsonObject("_axis"), res.getAxisElement());
27348    if (json.has("prism")) {
27349      JsonArray array = json.getAsJsonArray("prism");
27350      for (int i = 0; i < array.size(); i++) {
27351        res.getPrism().add(parseVisionPrescriptionPrismComponent(array.get(i).getAsJsonObject(), owner));
27352      }
27353    };
27354    if (json.has("add"))
27355      res.setAddElement(parseDecimal(json.get("add").getAsBigDecimal()));
27356    if (json.has("_add"))
27357      parseElementProperties(json.getAsJsonObject("_add"), res.getAddElement());
27358    if (json.has("power"))
27359      res.setPowerElement(parseDecimal(json.get("power").getAsBigDecimal()));
27360    if (json.has("_power"))
27361      parseElementProperties(json.getAsJsonObject("_power"), res.getPowerElement());
27362    if (json.has("backCurve"))
27363      res.setBackCurveElement(parseDecimal(json.get("backCurve").getAsBigDecimal()));
27364    if (json.has("_backCurve"))
27365      parseElementProperties(json.getAsJsonObject("_backCurve"), res.getBackCurveElement());
27366    if (json.has("diameter"))
27367      res.setDiameterElement(parseDecimal(json.get("diameter").getAsBigDecimal()));
27368    if (json.has("_diameter"))
27369      parseElementProperties(json.getAsJsonObject("_diameter"), res.getDiameterElement());
27370    if (json.has("duration"))
27371      res.setDuration(parseQuantity(json.getAsJsonObject("duration")));
27372    if (json.has("color"))
27373      res.setColorElement(parseString(json.get("color").getAsString()));
27374    if (json.has("_color"))
27375      parseElementProperties(json.getAsJsonObject("_color"), res.getColorElement());
27376    if (json.has("brand"))
27377      res.setBrandElement(parseString(json.get("brand").getAsString()));
27378    if (json.has("_brand"))
27379      parseElementProperties(json.getAsJsonObject("_brand"), res.getBrandElement());
27380    if (json.has("note")) {
27381      JsonArray array = json.getAsJsonArray("note");
27382      for (int i = 0; i < array.size(); i++) {
27383        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
27384      }
27385    };
27386  }
27387
27388  protected VisionPrescription.PrismComponent parseVisionPrescriptionPrismComponent(JsonObject json, VisionPrescription owner) throws IOException, FHIRFormatError {
27389    VisionPrescription.PrismComponent res = new VisionPrescription.PrismComponent();
27390    parseVisionPrescriptionPrismComponentProperties(json, owner, res);
27391    return res;
27392  }
27393
27394  protected void parseVisionPrescriptionPrismComponentProperties(JsonObject json, VisionPrescription owner, VisionPrescription.PrismComponent res) throws IOException, FHIRFormatError {
27395    parseBackboneElementProperties(json, res);
27396    if (json.has("amount"))
27397      res.setAmountElement(parseDecimal(json.get("amount").getAsBigDecimal()));
27398    if (json.has("_amount"))
27399      parseElementProperties(json.getAsJsonObject("_amount"), res.getAmountElement());
27400    if (json.has("base"))
27401      res.setBaseElement(parseEnumeration(json.get("base").getAsString(), VisionPrescription.VisionBase.NULL, new VisionPrescription.VisionBaseEnumFactory()));
27402    if (json.has("_base"))
27403      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
27404  }
27405
27406  @Override
27407  protected Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
27408    if (!json.has("resourceType")) {
27409      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
27410    }
27411    String t = json.get("resourceType").getAsString();
27412    if (Utilities.noString(t))
27413      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
27414    if (t.equals("Parameters"))
27415      return parseParameters(json);
27416    else if (t.equals("Account"))
27417      return parseAccount(json);
27418    else if (t.equals("ActivityDefinition"))
27419      return parseActivityDefinition(json);
27420    else if (t.equals("AdverseEvent"))
27421      return parseAdverseEvent(json);
27422    else if (t.equals("AllergyIntolerance"))
27423      return parseAllergyIntolerance(json);
27424    else if (t.equals("Appointment"))
27425      return parseAppointment(json);
27426    else if (t.equals("AppointmentResponse"))
27427      return parseAppointmentResponse(json);
27428    else if (t.equals("AuditEvent"))
27429      return parseAuditEvent(json);
27430    else if (t.equals("Basic"))
27431      return parseBasic(json);
27432    else if (t.equals("Binary"))
27433      return parseBinary(json);
27434    else if (t.equals("BiologicallyDerivedProduct"))
27435      return parseBiologicallyDerivedProduct(json);
27436    else if (t.equals("BodyStructure"))
27437      return parseBodyStructure(json);
27438    else if (t.equals("Bundle"))
27439      return parseBundle(json);
27440    else if (t.equals("CapabilityStatement"))
27441      return parseCapabilityStatement(json);
27442    else if (t.equals("CarePlan"))
27443      return parseCarePlan(json);
27444    else if (t.equals("CareTeam"))
27445      return parseCareTeam(json);
27446    else if (t.equals("CatalogEntry"))
27447      return parseCatalogEntry(json);
27448    else if (t.equals("ChargeItem"))
27449      return parseChargeItem(json);
27450    else if (t.equals("ChargeItemDefinition"))
27451      return parseChargeItemDefinition(json);
27452    else if (t.equals("Claim"))
27453      return parseClaim(json);
27454    else if (t.equals("ClaimResponse"))
27455      return parseClaimResponse(json);
27456    else if (t.equals("ClinicalImpression"))
27457      return parseClinicalImpression(json);
27458    else if (t.equals("CodeSystem"))
27459      return parseCodeSystem(json);
27460    else if (t.equals("Communication"))
27461      return parseCommunication(json);
27462    else if (t.equals("CommunicationRequest"))
27463      return parseCommunicationRequest(json);
27464    else if (t.equals("CompartmentDefinition"))
27465      return parseCompartmentDefinition(json);
27466    else if (t.equals("Composition"))
27467      return parseComposition(json);
27468    else if (t.equals("ConceptMap"))
27469      return parseConceptMap(json);
27470    else if (t.equals("Condition"))
27471      return parseCondition(json);
27472    else if (t.equals("Consent"))
27473      return parseConsent(json);
27474    else if (t.equals("Contract"))
27475      return parseContract(json);
27476    else if (t.equals("Coverage"))
27477      return parseCoverage(json);
27478    else if (t.equals("CoverageEligibilityRequest"))
27479      return parseCoverageEligibilityRequest(json);
27480    else if (t.equals("CoverageEligibilityResponse"))
27481      return parseCoverageEligibilityResponse(json);
27482    else if (t.equals("DetectedIssue"))
27483      return parseDetectedIssue(json);
27484    else if (t.equals("Device"))
27485      return parseDevice(json);
27486    else if (t.equals("DeviceDefinition"))
27487      return parseDeviceDefinition(json);
27488    else if (t.equals("DeviceMetric"))
27489      return parseDeviceMetric(json);
27490    else if (t.equals("DeviceRequest"))
27491      return parseDeviceRequest(json);
27492    else if (t.equals("DeviceUseStatement"))
27493      return parseDeviceUseStatement(json);
27494    else if (t.equals("DiagnosticReport"))
27495      return parseDiagnosticReport(json);
27496    else if (t.equals("DocumentManifest"))
27497      return parseDocumentManifest(json);
27498    else if (t.equals("DocumentReference"))
27499      return parseDocumentReference(json);
27500    else if (t.equals("EffectEvidenceSynthesis"))
27501      return parseEffectEvidenceSynthesis(json);
27502    else if (t.equals("Encounter"))
27503      return parseEncounter(json);
27504    else if (t.equals("Endpoint"))
27505      return parseEndpoint(json);
27506    else if (t.equals("EnrollmentRequest"))
27507      return parseEnrollmentRequest(json);
27508    else if (t.equals("EnrollmentResponse"))
27509      return parseEnrollmentResponse(json);
27510    else if (t.equals("EpisodeOfCare"))
27511      return parseEpisodeOfCare(json);
27512    else if (t.equals("EventDefinition"))
27513      return parseEventDefinition(json);
27514    else if (t.equals("Evidence"))
27515      return parseEvidence(json);
27516    else if (t.equals("EvidenceVariable"))
27517      return parseEvidenceVariable(json);
27518    else if (t.equals("ExampleScenario"))
27519      return parseExampleScenario(json);
27520    else if (t.equals("ExplanationOfBenefit"))
27521      return parseExplanationOfBenefit(json);
27522    else if (t.equals("FamilyMemberHistory"))
27523      return parseFamilyMemberHistory(json);
27524    else if (t.equals("Flag"))
27525      return parseFlag(json);
27526    else if (t.equals("Goal"))
27527      return parseGoal(json);
27528    else if (t.equals("GraphDefinition"))
27529      return parseGraphDefinition(json);
27530    else if (t.equals("Group"))
27531      return parseGroup(json);
27532    else if (t.equals("GuidanceResponse"))
27533      return parseGuidanceResponse(json);
27534    else if (t.equals("HealthcareService"))
27535      return parseHealthcareService(json);
27536    else if (t.equals("ImagingStudy"))
27537      return parseImagingStudy(json);
27538    else if (t.equals("Immunization"))
27539      return parseImmunization(json);
27540    else if (t.equals("ImmunizationEvaluation"))
27541      return parseImmunizationEvaluation(json);
27542    else if (t.equals("ImmunizationRecommendation"))
27543      return parseImmunizationRecommendation(json);
27544    else if (t.equals("ImplementationGuide"))
27545      return parseImplementationGuide(json);
27546    else if (t.equals("InsurancePlan"))
27547      return parseInsurancePlan(json);
27548    else if (t.equals("Invoice"))
27549      return parseInvoice(json);
27550    else if (t.equals("Library"))
27551      return parseLibrary(json);
27552    else if (t.equals("Linkage"))
27553      return parseLinkage(json);
27554    else if (t.equals("List"))
27555      return parseListResource(json);
27556    else if (t.equals("Location"))
27557      return parseLocation(json);
27558    else if (t.equals("Measure"))
27559      return parseMeasure(json);
27560    else if (t.equals("MeasureReport"))
27561      return parseMeasureReport(json);
27562    else if (t.equals("Media"))
27563      return parseMedia(json);
27564    else if (t.equals("Medication"))
27565      return parseMedication(json);
27566    else if (t.equals("MedicationAdministration"))
27567      return parseMedicationAdministration(json);
27568    else if (t.equals("MedicationDispense"))
27569      return parseMedicationDispense(json);
27570    else if (t.equals("MedicationKnowledge"))
27571      return parseMedicationKnowledge(json);
27572    else if (t.equals("MedicationRequest"))
27573      return parseMedicationRequest(json);
27574    else if (t.equals("MedicationStatement"))
27575      return parseMedicationStatement(json);
27576    else if (t.equals("MedicinalProduct"))
27577      return parseMedicinalProduct(json);
27578    else if (t.equals("MedicinalProductAuthorization"))
27579      return parseMedicinalProductAuthorization(json);
27580    else if (t.equals("MedicinalProductContraindication"))
27581      return parseMedicinalProductContraindication(json);
27582    else if (t.equals("MedicinalProductIndication"))
27583      return parseMedicinalProductIndication(json);
27584    else if (t.equals("MedicinalProductIngredient"))
27585      return parseMedicinalProductIngredient(json);
27586    else if (t.equals("MedicinalProductInteraction"))
27587      return parseMedicinalProductInteraction(json);
27588    else if (t.equals("MedicinalProductManufactured"))
27589      return parseMedicinalProductManufactured(json);
27590    else if (t.equals("MedicinalProductPackaged"))
27591      return parseMedicinalProductPackaged(json);
27592    else if (t.equals("MedicinalProductPharmaceutical"))
27593      return parseMedicinalProductPharmaceutical(json);
27594    else if (t.equals("MedicinalProductUndesirableEffect"))
27595      return parseMedicinalProductUndesirableEffect(json);
27596    else if (t.equals("MessageDefinition"))
27597      return parseMessageDefinition(json);
27598    else if (t.equals("MessageHeader"))
27599      return parseMessageHeader(json);
27600    else if (t.equals("MolecularSequence"))
27601      return parseMolecularSequence(json);
27602    else if (t.equals("NamingSystem"))
27603      return parseNamingSystem(json);
27604    else if (t.equals("NutritionOrder"))
27605      return parseNutritionOrder(json);
27606    else if (t.equals("Observation"))
27607      return parseObservation(json);
27608    else if (t.equals("ObservationDefinition"))
27609      return parseObservationDefinition(json);
27610    else if (t.equals("OperationDefinition"))
27611      return parseOperationDefinition(json);
27612    else if (t.equals("OperationOutcome"))
27613      return parseOperationOutcome(json);
27614    else if (t.equals("Organization"))
27615      return parseOrganization(json);
27616    else if (t.equals("OrganizationAffiliation"))
27617      return parseOrganizationAffiliation(json);
27618    else if (t.equals("Patient"))
27619      return parsePatient(json);
27620    else if (t.equals("PaymentNotice"))
27621      return parsePaymentNotice(json);
27622    else if (t.equals("PaymentReconciliation"))
27623      return parsePaymentReconciliation(json);
27624    else if (t.equals("Person"))
27625      return parsePerson(json);
27626    else if (t.equals("PlanDefinition"))
27627      return parsePlanDefinition(json);
27628    else if (t.equals("Practitioner"))
27629      return parsePractitioner(json);
27630    else if (t.equals("PractitionerRole"))
27631      return parsePractitionerRole(json);
27632    else if (t.equals("Procedure"))
27633      return parseProcedure(json);
27634    else if (t.equals("Provenance"))
27635      return parseProvenance(json);
27636    else if (t.equals("Questionnaire"))
27637      return parseQuestionnaire(json);
27638    else if (t.equals("QuestionnaireResponse"))
27639      return parseQuestionnaireResponse(json);
27640    else if (t.equals("RelatedPerson"))
27641      return parseRelatedPerson(json);
27642    else if (t.equals("RequestGroup"))
27643      return parseRequestGroup(json);
27644    else if (t.equals("ResearchDefinition"))
27645      return parseResearchDefinition(json);
27646    else if (t.equals("ResearchElementDefinition"))
27647      return parseResearchElementDefinition(json);
27648    else if (t.equals("ResearchStudy"))
27649      return parseResearchStudy(json);
27650    else if (t.equals("ResearchSubject"))
27651      return parseResearchSubject(json);
27652    else if (t.equals("RiskAssessment"))
27653      return parseRiskAssessment(json);
27654    else if (t.equals("RiskEvidenceSynthesis"))
27655      return parseRiskEvidenceSynthesis(json);
27656    else if (t.equals("Schedule"))
27657      return parseSchedule(json);
27658    else if (t.equals("SearchParameter"))
27659      return parseSearchParameter(json);
27660    else if (t.equals("ServiceRequest"))
27661      return parseServiceRequest(json);
27662    else if (t.equals("Slot"))
27663      return parseSlot(json);
27664    else if (t.equals("Specimen"))
27665      return parseSpecimen(json);
27666    else if (t.equals("SpecimenDefinition"))
27667      return parseSpecimenDefinition(json);
27668    else if (t.equals("StructureDefinition"))
27669      return parseStructureDefinition(json);
27670    else if (t.equals("StructureMap"))
27671      return parseStructureMap(json);
27672    else if (t.equals("Subscription"))
27673      return parseSubscription(json);
27674    else if (t.equals("Substance"))
27675      return parseSubstance(json);
27676    else if (t.equals("SubstanceNucleicAcid"))
27677      return parseSubstanceNucleicAcid(json);
27678    else if (t.equals("SubstancePolymer"))
27679      return parseSubstancePolymer(json);
27680    else if (t.equals("SubstanceProtein"))
27681      return parseSubstanceProtein(json);
27682    else if (t.equals("SubstanceReferenceInformation"))
27683      return parseSubstanceReferenceInformation(json);
27684    else if (t.equals("SubstanceSourceMaterial"))
27685      return parseSubstanceSourceMaterial(json);
27686    else if (t.equals("SubstanceSpecification"))
27687      return parseSubstanceSpecification(json);
27688    else if (t.equals("SupplyDelivery"))
27689      return parseSupplyDelivery(json);
27690    else if (t.equals("SupplyRequest"))
27691      return parseSupplyRequest(json);
27692    else if (t.equals("Task"))
27693      return parseTask(json);
27694    else if (t.equals("TerminologyCapabilities"))
27695      return parseTerminologyCapabilities(json);
27696    else if (t.equals("TestReport"))
27697      return parseTestReport(json);
27698    else if (t.equals("TestScript"))
27699      return parseTestScript(json);
27700    else if (t.equals("ValueSet"))
27701      return parseValueSet(json);
27702    else if (t.equals("VerificationResult"))
27703      return parseVerificationResult(json);
27704    else if (t.equals("VisionPrescription"))
27705      return parseVisionPrescription(json);
27706    else if (t.equals("Binary"))
27707      return parseBinary(json);
27708    throw new FHIRFormatError("Unknown.Unrecognised resource type '"+t+"' (in property 'resourceType')");
27709  }
27710
27711  protected Type parseType(String prefix, JsonObject json) throws IOException, FHIRFormatError {
27712    if (json.has(prefix+"Extension"))
27713      return parseExtension(json.getAsJsonObject(prefix+"Extension"));
27714    else if (json.has(prefix+"Narrative"))
27715      return parseNarrative(json.getAsJsonObject(prefix+"Narrative"));
27716    else if (json.has(prefix+"Meta"))
27717      return parseMeta(json.getAsJsonObject(prefix+"Meta"));
27718    else if (json.has(prefix+"Address"))
27719      return parseAddress(json.getAsJsonObject(prefix+"Address"));
27720    else if (json.has(prefix+"Contributor"))
27721      return parseContributor(json.getAsJsonObject(prefix+"Contributor"));
27722    else if (json.has(prefix+"Attachment"))
27723      return parseAttachment(json.getAsJsonObject(prefix+"Attachment"));
27724    else if (json.has(prefix+"Count"))
27725      return parseCount(json.getAsJsonObject(prefix+"Count"));
27726    else if (json.has(prefix+"DataRequirement"))
27727      return parseDataRequirement(json.getAsJsonObject(prefix+"DataRequirement"));
27728    else if (json.has(prefix+"Dosage"))
27729      return parseDosage(json.getAsJsonObject(prefix+"Dosage"));
27730    else if (json.has(prefix+"Money"))
27731      return parseMoney(json.getAsJsonObject(prefix+"Money"));
27732    else if (json.has(prefix+"HumanName"))
27733      return parseHumanName(json.getAsJsonObject(prefix+"HumanName"));
27734    else if (json.has(prefix+"ContactPoint"))
27735      return parseContactPoint(json.getAsJsonObject(prefix+"ContactPoint"));
27736    else if (json.has(prefix+"MarketingStatus"))
27737      return parseMarketingStatus(json.getAsJsonObject(prefix+"MarketingStatus"));
27738    else if (json.has(prefix+"Identifier"))
27739      return parseIdentifier(json.getAsJsonObject(prefix+"Identifier"));
27740    else if (json.has(prefix+"SubstanceAmount"))
27741      return parseSubstanceAmount(json.getAsJsonObject(prefix+"SubstanceAmount"));
27742    else if (json.has(prefix+"Coding"))
27743      return parseCoding(json.getAsJsonObject(prefix+"Coding"));
27744    else if (json.has(prefix+"SampledData"))
27745      return parseSampledData(json.getAsJsonObject(prefix+"SampledData"));
27746    else if (json.has(prefix+"Population"))
27747      return parsePopulation(json.getAsJsonObject(prefix+"Population"));
27748    else if (json.has(prefix+"Ratio"))
27749      return parseRatio(json.getAsJsonObject(prefix+"Ratio"));
27750    else if (json.has(prefix+"Distance"))
27751      return parseDistance(json.getAsJsonObject(prefix+"Distance"));
27752    else if (json.has(prefix+"Age"))
27753      return parseAge(json.getAsJsonObject(prefix+"Age"));
27754    else if (json.has(prefix+"Reference"))
27755      return parseReference(json.getAsJsonObject(prefix+"Reference"));
27756    else if (json.has(prefix+"TriggerDefinition"))
27757      return parseTriggerDefinition(json.getAsJsonObject(prefix+"TriggerDefinition"));
27758    else if (json.has(prefix+"Quantity"))
27759      return parseQuantity(json.getAsJsonObject(prefix+"Quantity"));
27760    else if (json.has(prefix+"Period"))
27761      return parsePeriod(json.getAsJsonObject(prefix+"Period"));
27762    else if (json.has(prefix+"Duration"))
27763      return parseDuration(json.getAsJsonObject(prefix+"Duration"));
27764    else if (json.has(prefix+"Range"))
27765      return parseRange(json.getAsJsonObject(prefix+"Range"));
27766    else if (json.has(prefix+"RelatedArtifact"))
27767      return parseRelatedArtifact(json.getAsJsonObject(prefix+"RelatedArtifact"));
27768    else if (json.has(prefix+"Annotation"))
27769      return parseAnnotation(json.getAsJsonObject(prefix+"Annotation"));
27770    else if (json.has(prefix+"ProductShelfLife"))
27771      return parseProductShelfLife(json.getAsJsonObject(prefix+"ProductShelfLife"));
27772    else if (json.has(prefix+"ContactDetail"))
27773      return parseContactDetail(json.getAsJsonObject(prefix+"ContactDetail"));
27774    else if (json.has(prefix+"UsageContext"))
27775      return parseUsageContext(json.getAsJsonObject(prefix+"UsageContext"));
27776    else if (json.has(prefix+"Expression"))
27777      return parseExpression(json.getAsJsonObject(prefix+"Expression"));
27778    else if (json.has(prefix+"Signature"))
27779      return parseSignature(json.getAsJsonObject(prefix+"Signature"));
27780    else if (json.has(prefix+"Timing"))
27781      return parseTiming(json.getAsJsonObject(prefix+"Timing"));
27782    else if (json.has(prefix+"ProdCharacteristic"))
27783      return parseProdCharacteristic(json.getAsJsonObject(prefix+"ProdCharacteristic"));
27784    else if (json.has(prefix+"CodeableConcept"))
27785      return parseCodeableConcept(json.getAsJsonObject(prefix+"CodeableConcept"));
27786    else if (json.has(prefix+"ParameterDefinition"))
27787      return parseParameterDefinition(json.getAsJsonObject(prefix+"ParameterDefinition"));
27788    else if (json.has(prefix+"Date") || json.has("_"+prefix+"Date")) {
27789      Type t = json.has(prefix+"Date") ? parseDate(json.get(prefix+"Date").getAsString()) : new DateType();
27790      if (json.has("_"+prefix+"Date"))
27791        parseElementProperties(json.getAsJsonObject("_"+prefix+"Date"), t);
27792      return t;
27793    }
27794    else if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime")) {
27795      Type t = json.has(prefix+"DateTime") ? parseDateTime(json.get(prefix+"DateTime").getAsString()) : new DateTimeType();
27796      if (json.has("_"+prefix+"DateTime"))
27797        parseElementProperties(json.getAsJsonObject("_"+prefix+"DateTime"), t);
27798      return t;
27799    }
27800    else if (json.has(prefix+"Code") || json.has("_"+prefix+"Code")) {
27801      Type t = json.has(prefix+"Code") ? parseCode(json.get(prefix+"Code").getAsString()) : new CodeType();
27802      if (json.has("_"+prefix+"Code"))
27803        parseElementProperties(json.getAsJsonObject("_"+prefix+"Code"), t);
27804      return t;
27805    }
27806    else if (json.has(prefix+"String") || json.has("_"+prefix+"String")) {
27807      Type t = json.has(prefix+"String") ? parseString(json.get(prefix+"String").getAsString()) : new StringType();
27808      if (json.has("_"+prefix+"String"))
27809        parseElementProperties(json.getAsJsonObject("_"+prefix+"String"), t);
27810      return t;
27811    }
27812    else if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer")) {
27813      Type t = json.has(prefix+"Integer") ? parseInteger(json.get(prefix+"Integer").getAsLong()) : new IntegerType();
27814      if (json.has("_"+prefix+"Integer"))
27815        parseElementProperties(json.getAsJsonObject("_"+prefix+"Integer"), t);
27816      return t;
27817    }
27818    else if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid")) {
27819      Type t = json.has(prefix+"Oid") ? parseOid(json.get(prefix+"Oid").getAsString()) : new OidType();
27820      if (json.has("_"+prefix+"Oid"))
27821        parseElementProperties(json.getAsJsonObject("_"+prefix+"Oid"), t);
27822      return t;
27823    }
27824    else if (json.has(prefix+"Canonical") || json.has("_"+prefix+"Canonical")) {
27825      Type t = json.has(prefix+"Canonical") ? parseCanonical(json.get(prefix+"Canonical").getAsString()) : new CanonicalType();
27826      if (json.has("_"+prefix+"Canonical"))
27827        parseElementProperties(json.getAsJsonObject("_"+prefix+"Canonical"), t);
27828      return t;
27829    }
27830    else if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri")) {
27831      Type t = json.has(prefix+"Uri") ? parseUri(json.get(prefix+"Uri").getAsString()) : new UriType();
27832      if (json.has("_"+prefix+"Uri"))
27833        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uri"), t);
27834      return t;
27835    }
27836    else if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid")) {
27837      Type t = json.has(prefix+"Uuid") ? parseUuid(json.get(prefix+"Uuid").getAsString()) : new UuidType();
27838      if (json.has("_"+prefix+"Uuid"))
27839        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uuid"), t);
27840      return t;
27841    }
27842    else if (json.has(prefix+"Url") || json.has("_"+prefix+"Url")) {
27843      Type t = json.has(prefix+"Url") ? parseUrl(json.get(prefix+"Url").getAsString()) : new UrlType();
27844      if (json.has("_"+prefix+"Url"))
27845        parseElementProperties(json.getAsJsonObject("_"+prefix+"Url"), t);
27846      return t;
27847    }
27848    else if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant")) {
27849      Type t = json.has(prefix+"Instant") ? parseInstant(json.get(prefix+"Instant").getAsString()) : new InstantType();
27850      if (json.has("_"+prefix+"Instant"))
27851        parseElementProperties(json.getAsJsonObject("_"+prefix+"Instant"), t);
27852      return t;
27853    }
27854    else if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean")) {
27855      Type t = json.has(prefix+"Boolean") ? parseBoolean(json.get(prefix+"Boolean").getAsBoolean()) : new BooleanType();
27856      if (json.has("_"+prefix+"Boolean"))
27857        parseElementProperties(json.getAsJsonObject("_"+prefix+"Boolean"), t);
27858      return t;
27859    }
27860    else if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary")) {
27861      Type t = json.has(prefix+"Base64Binary") ? parseBase64Binary(json.get(prefix+"Base64Binary").getAsString()) : new Base64BinaryType();
27862      if (json.has("_"+prefix+"Base64Binary"))
27863        parseElementProperties(json.getAsJsonObject("_"+prefix+"Base64Binary"), t);
27864      return t;
27865    }
27866    else if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt")) {
27867      Type t = json.has(prefix+"UnsignedInt") ? parseUnsignedInt(json.get(prefix+"UnsignedInt").getAsString()) : new UnsignedIntType();
27868      if (json.has("_"+prefix+"UnsignedInt"))
27869        parseElementProperties(json.getAsJsonObject("_"+prefix+"UnsignedInt"), t);
27870      return t;
27871    }
27872    else if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown")) {
27873      Type t = json.has(prefix+"Markdown") ? parseMarkdown(json.get(prefix+"Markdown").getAsString()) : new MarkdownType();
27874      if (json.has("_"+prefix+"Markdown"))
27875        parseElementProperties(json.getAsJsonObject("_"+prefix+"Markdown"), t);
27876      return t;
27877    }
27878    else if (json.has(prefix+"Time") || json.has("_"+prefix+"Time")) {
27879      Type t = json.has(prefix+"Time") ? parseTime(json.get(prefix+"Time").getAsString()) : new TimeType();
27880      if (json.has("_"+prefix+"Time"))
27881        parseElementProperties(json.getAsJsonObject("_"+prefix+"Time"), t);
27882      return t;
27883    }
27884    else if (json.has(prefix+"Id") || json.has("_"+prefix+"Id")) {
27885      Type t = json.has(prefix+"Id") ? parseId(json.get(prefix+"Id").getAsString()) : new IdType();
27886      if (json.has("_"+prefix+"Id"))
27887        parseElementProperties(json.getAsJsonObject("_"+prefix+"Id"), t);
27888      return t;
27889    }
27890    else if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt")) {
27891      Type t = json.has(prefix+"PositiveInt") ? parsePositiveInt(json.get(prefix+"PositiveInt").getAsString()) : new PositiveIntType();
27892      if (json.has("_"+prefix+"PositiveInt"))
27893        parseElementProperties(json.getAsJsonObject("_"+prefix+"PositiveInt"), t);
27894      return t;
27895    }
27896    else if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal")) {
27897      Type t = json.has(prefix+"Decimal") ? parseDecimal(json.get(prefix+"Decimal").getAsBigDecimal()) : new DecimalType();
27898      if (json.has("_"+prefix+"Decimal"))
27899        parseElementProperties(json.getAsJsonObject("_"+prefix+"Decimal"), t);
27900      return t;
27901    }
27902    return null;
27903  }
27904
27905  protected Type parseType(JsonObject json, String type) throws IOException, FHIRFormatError {
27906    if (type.equals("Extension"))
27907      return parseExtension(json);
27908    else if (type.equals("Narrative"))
27909      return parseNarrative(json);
27910    else if (type.equals("Meta"))
27911      return parseMeta(json);
27912    else if (type.equals("Address"))
27913      return parseAddress(json);
27914    else if (type.equals("Contributor"))
27915      return parseContributor(json);
27916    else if (type.equals("Attachment"))
27917      return parseAttachment(json);
27918    else if (type.equals("Count"))
27919      return parseCount(json);
27920    else if (type.equals("DataRequirement"))
27921      return parseDataRequirement(json);
27922    else if (type.equals("Dosage"))
27923      return parseDosage(json);
27924    else if (type.equals("Money"))
27925      return parseMoney(json);
27926    else if (type.equals("HumanName"))
27927      return parseHumanName(json);
27928    else if (type.equals("ContactPoint"))
27929      return parseContactPoint(json);
27930    else if (type.equals("MarketingStatus"))
27931      return parseMarketingStatus(json);
27932    else if (type.equals("Identifier"))
27933      return parseIdentifier(json);
27934    else if (type.equals("SubstanceAmount"))
27935      return parseSubstanceAmount(json);
27936    else if (type.equals("Coding"))
27937      return parseCoding(json);
27938    else if (type.equals("SampledData"))
27939      return parseSampledData(json);
27940    else if (type.equals("Population"))
27941      return parsePopulation(json);
27942    else if (type.equals("Ratio"))
27943      return parseRatio(json);
27944    else if (type.equals("Distance"))
27945      return parseDistance(json);
27946    else if (type.equals("Age"))
27947      return parseAge(json);
27948    else if (type.equals("Reference"))
27949      return parseReference(json);
27950    else if (type.equals("TriggerDefinition"))
27951      return parseTriggerDefinition(json);
27952    else if (type.equals("Quantity"))
27953      return parseQuantity(json);
27954    else if (type.equals("Period"))
27955      return parsePeriod(json);
27956    else if (type.equals("Duration"))
27957      return parseDuration(json);
27958    else if (type.equals("Range"))
27959      return parseRange(json);
27960    else if (type.equals("RelatedArtifact"))
27961      return parseRelatedArtifact(json);
27962    else if (type.equals("Annotation"))
27963      return parseAnnotation(json);
27964    else if (type.equals("ProductShelfLife"))
27965      return parseProductShelfLife(json);
27966    else if (type.equals("ContactDetail"))
27967      return parseContactDetail(json);
27968    else if (type.equals("UsageContext"))
27969      return parseUsageContext(json);
27970    else if (type.equals("Expression"))
27971      return parseExpression(json);
27972    else if (type.equals("Signature"))
27973      return parseSignature(json);
27974    else if (type.equals("Timing"))
27975      return parseTiming(json);
27976    else if (type.equals("ProdCharacteristic"))
27977      return parseProdCharacteristic(json);
27978    else if (type.equals("CodeableConcept"))
27979      return parseCodeableConcept(json);
27980    else if (type.equals("ParameterDefinition"))
27981      return parseParameterDefinition(json);
27982    throw new FHIRFormatError("Unknown Type "+type);
27983  }
27984
27985  protected boolean hasTypeName(JsonObject json, String prefix) {
27986        if (json.has(prefix+"Extension"))
27987      return true;
27988    if (json.has(prefix+"Narrative"))
27989      return true;
27990    if (json.has(prefix+"Meta"))
27991      return true;
27992    if (json.has(prefix+"Address"))
27993      return true;
27994    if (json.has(prefix+"Contributor"))
27995      return true;
27996    if (json.has(prefix+"Attachment"))
27997      return true;
27998    if (json.has(prefix+"Count"))
27999      return true;
28000    if (json.has(prefix+"DataRequirement"))
28001      return true;
28002    if (json.has(prefix+"Dosage"))
28003      return true;
28004    if (json.has(prefix+"Money"))
28005      return true;
28006    if (json.has(prefix+"HumanName"))
28007      return true;
28008    if (json.has(prefix+"ContactPoint"))
28009      return true;
28010    if (json.has(prefix+"MarketingStatus"))
28011      return true;
28012    if (json.has(prefix+"Identifier"))
28013      return true;
28014    if (json.has(prefix+"SubstanceAmount"))
28015      return true;
28016    if (json.has(prefix+"Coding"))
28017      return true;
28018    if (json.has(prefix+"SampledData"))
28019      return true;
28020    if (json.has(prefix+"Population"))
28021      return true;
28022    if (json.has(prefix+"Ratio"))
28023      return true;
28024    if (json.has(prefix+"Distance"))
28025      return true;
28026    if (json.has(prefix+"Age"))
28027      return true;
28028    if (json.has(prefix+"Reference"))
28029      return true;
28030    if (json.has(prefix+"TriggerDefinition"))
28031      return true;
28032    if (json.has(prefix+"Quantity"))
28033      return true;
28034    if (json.has(prefix+"Period"))
28035      return true;
28036    if (json.has(prefix+"Duration"))
28037      return true;
28038    if (json.has(prefix+"Range"))
28039      return true;
28040    if (json.has(prefix+"RelatedArtifact"))
28041      return true;
28042    if (json.has(prefix+"Annotation"))
28043      return true;
28044    if (json.has(prefix+"ProductShelfLife"))
28045      return true;
28046    if (json.has(prefix+"ContactDetail"))
28047      return true;
28048    if (json.has(prefix+"UsageContext"))
28049      return true;
28050    if (json.has(prefix+"Expression"))
28051      return true;
28052    if (json.has(prefix+"Signature"))
28053      return true;
28054    if (json.has(prefix+"Timing"))
28055      return true;
28056    if (json.has(prefix+"ProdCharacteristic"))
28057      return true;
28058    if (json.has(prefix+"CodeableConcept"))
28059      return true;
28060    if (json.has(prefix+"ParameterDefinition"))
28061      return true;
28062    if (json.has(prefix+"Parameters"))
28063      return true;
28064    if (json.has(prefix+"Account"))
28065      return true;
28066    if (json.has(prefix+"ActivityDefinition"))
28067      return true;
28068    if (json.has(prefix+"AdverseEvent"))
28069      return true;
28070    if (json.has(prefix+"AllergyIntolerance"))
28071      return true;
28072    if (json.has(prefix+"Appointment"))
28073      return true;
28074    if (json.has(prefix+"AppointmentResponse"))
28075      return true;
28076    if (json.has(prefix+"AuditEvent"))
28077      return true;
28078    if (json.has(prefix+"Basic"))
28079      return true;
28080    if (json.has(prefix+"Binary"))
28081      return true;
28082    if (json.has(prefix+"BiologicallyDerivedProduct"))
28083      return true;
28084    if (json.has(prefix+"BodyStructure"))
28085      return true;
28086    if (json.has(prefix+"Bundle"))
28087      return true;
28088    if (json.has(prefix+"CapabilityStatement"))
28089      return true;
28090    if (json.has(prefix+"CarePlan"))
28091      return true;
28092    if (json.has(prefix+"CareTeam"))
28093      return true;
28094    if (json.has(prefix+"CatalogEntry"))
28095      return true;
28096    if (json.has(prefix+"ChargeItem"))
28097      return true;
28098    if (json.has(prefix+"ChargeItemDefinition"))
28099      return true;
28100    if (json.has(prefix+"Claim"))
28101      return true;
28102    if (json.has(prefix+"ClaimResponse"))
28103      return true;
28104    if (json.has(prefix+"ClinicalImpression"))
28105      return true;
28106    if (json.has(prefix+"CodeSystem"))
28107      return true;
28108    if (json.has(prefix+"Communication"))
28109      return true;
28110    if (json.has(prefix+"CommunicationRequest"))
28111      return true;
28112    if (json.has(prefix+"CompartmentDefinition"))
28113      return true;
28114    if (json.has(prefix+"Composition"))
28115      return true;
28116    if (json.has(prefix+"ConceptMap"))
28117      return true;
28118    if (json.has(prefix+"Condition"))
28119      return true;
28120    if (json.has(prefix+"Consent"))
28121      return true;
28122    if (json.has(prefix+"Contract"))
28123      return true;
28124    if (json.has(prefix+"Coverage"))
28125      return true;
28126    if (json.has(prefix+"CoverageEligibilityRequest"))
28127      return true;
28128    if (json.has(prefix+"CoverageEligibilityResponse"))
28129      return true;
28130    if (json.has(prefix+"DetectedIssue"))
28131      return true;
28132    if (json.has(prefix+"Device"))
28133      return true;
28134    if (json.has(prefix+"DeviceDefinition"))
28135      return true;
28136    if (json.has(prefix+"DeviceMetric"))
28137      return true;
28138    if (json.has(prefix+"DeviceRequest"))
28139      return true;
28140    if (json.has(prefix+"DeviceUseStatement"))
28141      return true;
28142    if (json.has(prefix+"DiagnosticReport"))
28143      return true;
28144    if (json.has(prefix+"DocumentManifest"))
28145      return true;
28146    if (json.has(prefix+"DocumentReference"))
28147      return true;
28148    if (json.has(prefix+"EffectEvidenceSynthesis"))
28149      return true;
28150    if (json.has(prefix+"Encounter"))
28151      return true;
28152    if (json.has(prefix+"Endpoint"))
28153      return true;
28154    if (json.has(prefix+"EnrollmentRequest"))
28155      return true;
28156    if (json.has(prefix+"EnrollmentResponse"))
28157      return true;
28158    if (json.has(prefix+"EpisodeOfCare"))
28159      return true;
28160    if (json.has(prefix+"EventDefinition"))
28161      return true;
28162    if (json.has(prefix+"Evidence"))
28163      return true;
28164    if (json.has(prefix+"EvidenceVariable"))
28165      return true;
28166    if (json.has(prefix+"ExampleScenario"))
28167      return true;
28168    if (json.has(prefix+"ExplanationOfBenefit"))
28169      return true;
28170    if (json.has(prefix+"FamilyMemberHistory"))
28171      return true;
28172    if (json.has(prefix+"Flag"))
28173      return true;
28174    if (json.has(prefix+"Goal"))
28175      return true;
28176    if (json.has(prefix+"GraphDefinition"))
28177      return true;
28178    if (json.has(prefix+"Group"))
28179      return true;
28180    if (json.has(prefix+"GuidanceResponse"))
28181      return true;
28182    if (json.has(prefix+"HealthcareService"))
28183      return true;
28184    if (json.has(prefix+"ImagingStudy"))
28185      return true;
28186    if (json.has(prefix+"Immunization"))
28187      return true;
28188    if (json.has(prefix+"ImmunizationEvaluation"))
28189      return true;
28190    if (json.has(prefix+"ImmunizationRecommendation"))
28191      return true;
28192    if (json.has(prefix+"ImplementationGuide"))
28193      return true;
28194    if (json.has(prefix+"InsurancePlan"))
28195      return true;
28196    if (json.has(prefix+"Invoice"))
28197      return true;
28198    if (json.has(prefix+"Library"))
28199      return true;
28200    if (json.has(prefix+"Linkage"))
28201      return true;
28202    if (json.has(prefix+"List"))
28203      return true;
28204    if (json.has(prefix+"Location"))
28205      return true;
28206    if (json.has(prefix+"Measure"))
28207      return true;
28208    if (json.has(prefix+"MeasureReport"))
28209      return true;
28210    if (json.has(prefix+"Media"))
28211      return true;
28212    if (json.has(prefix+"Medication"))
28213      return true;
28214    if (json.has(prefix+"MedicationAdministration"))
28215      return true;
28216    if (json.has(prefix+"MedicationDispense"))
28217      return true;
28218    if (json.has(prefix+"MedicationKnowledge"))
28219      return true;
28220    if (json.has(prefix+"MedicationRequest"))
28221      return true;
28222    if (json.has(prefix+"MedicationStatement"))
28223      return true;
28224    if (json.has(prefix+"MedicinalProduct"))
28225      return true;
28226    if (json.has(prefix+"MedicinalProductAuthorization"))
28227      return true;
28228    if (json.has(prefix+"MedicinalProductContraindication"))
28229      return true;
28230    if (json.has(prefix+"MedicinalProductIndication"))
28231      return true;
28232    if (json.has(prefix+"MedicinalProductIngredient"))
28233      return true;
28234    if (json.has(prefix+"MedicinalProductInteraction"))
28235      return true;
28236    if (json.has(prefix+"MedicinalProductManufactured"))
28237      return true;
28238    if (json.has(prefix+"MedicinalProductPackaged"))
28239      return true;
28240    if (json.has(prefix+"MedicinalProductPharmaceutical"))
28241      return true;
28242    if (json.has(prefix+"MedicinalProductUndesirableEffect"))
28243      return true;
28244    if (json.has(prefix+"MessageDefinition"))
28245      return true;
28246    if (json.has(prefix+"MessageHeader"))
28247      return true;
28248    if (json.has(prefix+"MolecularSequence"))
28249      return true;
28250    if (json.has(prefix+"NamingSystem"))
28251      return true;
28252    if (json.has(prefix+"NutritionOrder"))
28253      return true;
28254    if (json.has(prefix+"Observation"))
28255      return true;
28256    if (json.has(prefix+"ObservationDefinition"))
28257      return true;
28258    if (json.has(prefix+"OperationDefinition"))
28259      return true;
28260    if (json.has(prefix+"OperationOutcome"))
28261      return true;
28262    if (json.has(prefix+"Organization"))
28263      return true;
28264    if (json.has(prefix+"OrganizationAffiliation"))
28265      return true;
28266    if (json.has(prefix+"Patient"))
28267      return true;
28268    if (json.has(prefix+"PaymentNotice"))
28269      return true;
28270    if (json.has(prefix+"PaymentReconciliation"))
28271      return true;
28272    if (json.has(prefix+"Person"))
28273      return true;
28274    if (json.has(prefix+"PlanDefinition"))
28275      return true;
28276    if (json.has(prefix+"Practitioner"))
28277      return true;
28278    if (json.has(prefix+"PractitionerRole"))
28279      return true;
28280    if (json.has(prefix+"Procedure"))
28281      return true;
28282    if (json.has(prefix+"Provenance"))
28283      return true;
28284    if (json.has(prefix+"Questionnaire"))
28285      return true;
28286    if (json.has(prefix+"QuestionnaireResponse"))
28287      return true;
28288    if (json.has(prefix+"RelatedPerson"))
28289      return true;
28290    if (json.has(prefix+"RequestGroup"))
28291      return true;
28292    if (json.has(prefix+"ResearchDefinition"))
28293      return true;
28294    if (json.has(prefix+"ResearchElementDefinition"))
28295      return true;
28296    if (json.has(prefix+"ResearchStudy"))
28297      return true;
28298    if (json.has(prefix+"ResearchSubject"))
28299      return true;
28300    if (json.has(prefix+"RiskAssessment"))
28301      return true;
28302    if (json.has(prefix+"RiskEvidenceSynthesis"))
28303      return true;
28304    if (json.has(prefix+"Schedule"))
28305      return true;
28306    if (json.has(prefix+"SearchParameter"))
28307      return true;
28308    if (json.has(prefix+"ServiceRequest"))
28309      return true;
28310    if (json.has(prefix+"Slot"))
28311      return true;
28312    if (json.has(prefix+"Specimen"))
28313      return true;
28314    if (json.has(prefix+"SpecimenDefinition"))
28315      return true;
28316    if (json.has(prefix+"StructureDefinition"))
28317      return true;
28318    if (json.has(prefix+"StructureMap"))
28319      return true;
28320    if (json.has(prefix+"Subscription"))
28321      return true;
28322    if (json.has(prefix+"Substance"))
28323      return true;
28324    if (json.has(prefix+"SubstanceNucleicAcid"))
28325      return true;
28326    if (json.has(prefix+"SubstancePolymer"))
28327      return true;
28328    if (json.has(prefix+"SubstanceProtein"))
28329      return true;
28330    if (json.has(prefix+"SubstanceReferenceInformation"))
28331      return true;
28332    if (json.has(prefix+"SubstanceSourceMaterial"))
28333      return true;
28334    if (json.has(prefix+"SubstanceSpecification"))
28335      return true;
28336    if (json.has(prefix+"SupplyDelivery"))
28337      return true;
28338    if (json.has(prefix+"SupplyRequest"))
28339      return true;
28340    if (json.has(prefix+"Task"))
28341      return true;
28342    if (json.has(prefix+"TerminologyCapabilities"))
28343      return true;
28344    if (json.has(prefix+"TestReport"))
28345      return true;
28346    if (json.has(prefix+"TestScript"))
28347      return true;
28348    if (json.has(prefix+"ValueSet"))
28349      return true;
28350    if (json.has(prefix+"VerificationResult"))
28351      return true;
28352    if (json.has(prefix+"VisionPrescription"))
28353      return true;
28354    if (json.has(prefix+"Date") || json.has("_"+prefix+"Date"))
28355      return true;
28356    if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime"))
28357      return true;
28358    if (json.has(prefix+"Code") || json.has("_"+prefix+"Code"))
28359      return true;
28360    if (json.has(prefix+"String") || json.has("_"+prefix+"String"))
28361      return true;
28362    if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer"))
28363      return true;
28364    if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid"))
28365      return true;
28366    if (json.has(prefix+"Canonical") || json.has("_"+prefix+"Canonical"))
28367      return true;
28368    if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri"))
28369      return true;
28370    if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid"))
28371      return true;
28372    if (json.has(prefix+"Url") || json.has("_"+prefix+"Url"))
28373      return true;
28374    if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant"))
28375      return true;
28376    if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean"))
28377      return true;
28378    if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary"))
28379      return true;
28380    if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt"))
28381      return true;
28382    if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown"))
28383      return true;
28384    if (json.has(prefix+"Time") || json.has("_"+prefix+"Time"))
28385      return true;
28386    if (json.has(prefix+"Id") || json.has("_"+prefix+"Id"))
28387      return true;
28388    if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt"))
28389      return true;
28390    if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal"))
28391      return true;
28392    return false;
28393  }
28394
28395  protected Type parseAnyType(JsonObject json, String type) throws IOException, FHIRFormatError {
28396    if (type.equals("ElementDefinition"))
28397      return parseElementDefinition(json);
28398    else if (type.equals("DataRequirement"))
28399      return parseDataRequirement(json);
28400    else
28401      return parseType(json, type);
28402  }
28403
28404  protected void composeElement(Element element) throws IOException {
28405    if (element.hasId())
28406      prop("id", element.getId());
28407      if (makeComments(element)) {
28408        openArray("fhir_comments");
28409        for (String s : element.getFormatCommentsPre())
28410          prop(null,  s);
28411        for (String s : element.getFormatCommentsPost())
28412          prop(null,  s);
28413         closeArray();
28414      }
28415    if (element.hasExtension()) {
28416      openArray("extension");
28417      for (Extension e : element.getExtension())
28418        composeExtension(null, e);
28419      closeArray();
28420    }
28421  }
28422
28423  protected void composeBackboneElementInner(BackboneElement element) throws IOException {
28424    composeBackbone(element);
28425  }
28426
28427  protected void composeBackbone(BackboneElement element) throws IOException {
28428    composeElement(element);
28429    if (element.hasModifierExtension()) {
28430      openArray("modifierExtension");
28431      for (Extension e : element.getModifierExtension())
28432        composeExtension(null, e);
28433      closeArray();
28434    }
28435  }
28436
28437  protected void composeBackbone(BackboneType element) throws IOException {
28438    composeElement(element);
28439    if (element.hasModifierExtension()) {
28440      openArray("modifierExtension");
28441      for (Extension e : element.getModifierExtension())
28442        composeExtension(null, e);
28443      closeArray();
28444    }
28445  }
28446
28447  protected <E extends Enum<E>> void composeEnumerationCore(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
28448    if (value != null && value.getValue() != null) {
28449      prop(name, e.toCode(value.getValue()));
28450    } else if (inArray)   
28451      writeNull(name);
28452  }    
28453
28454  protected <E extends Enum<E>> void composeEnumerationExtras(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
28455    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28456      open(inArray ? null : "_"+name);
28457      composeElement(value);
28458      close();
28459    } else if (inArray)   
28460      writeNull(name);
28461  }    
28462
28463  protected void composeDateCore(String name, DateType value, boolean inArray) throws IOException {
28464    if (value != null && value.hasValue()) {
28465        prop(name, value.asStringValue());
28466    }    
28467    else if (inArray) 
28468      writeNull(name); 
28469  }    
28470
28471  protected void composeDateExtras(String name, DateType value, boolean inArray) throws IOException {
28472    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28473      open(inArray ? null : "_"+name);
28474      composeElement(value);
28475      close();
28476    }
28477    else if (inArray) 
28478      writeNull(name); 
28479  }
28480
28481  protected void composeDateTimeCore(String name, DateTimeType value, boolean inArray) throws IOException {
28482    if (value != null && value.hasValue()) {
28483        prop(name, value.asStringValue());
28484    }    
28485    else if (inArray) 
28486      writeNull(name); 
28487  }    
28488
28489  protected void composeDateTimeExtras(String name, DateTimeType value, boolean inArray) throws IOException {
28490    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28491      open(inArray ? null : "_"+name);
28492      composeElement(value);
28493      close();
28494    }
28495    else if (inArray) 
28496      writeNull(name); 
28497  }
28498
28499  protected void composeCodeCore(String name, CodeType value, boolean inArray) throws IOException {
28500    if (value != null && value.hasValue()) {
28501        prop(name, toString(value.getValue()));
28502    }    
28503    else if (inArray) 
28504      writeNull(name); 
28505  }    
28506
28507  protected void composeCodeExtras(String name, CodeType value, boolean inArray) throws IOException {
28508    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28509      open(inArray ? null : "_"+name);
28510      composeElement(value);
28511      close();
28512    }
28513    else if (inArray) 
28514      writeNull(name); 
28515  }
28516
28517  protected void composeStringCore(String name, StringType value, boolean inArray) throws IOException {
28518    if (value != null && value.hasValue()) {
28519        prop(name, toString(value.getValue()));
28520    }    
28521    else if (inArray) 
28522      writeNull(name); 
28523  }    
28524
28525  protected void composeStringExtras(String name, StringType value, boolean inArray) throws IOException {
28526    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28527      open(inArray ? null : "_"+name);
28528      composeElement(value);
28529      close();
28530    }
28531    else if (inArray) 
28532      writeNull(name); 
28533  }
28534
28535  protected void composeIntegerCore(String name, IntegerType value, boolean inArray) throws IOException {
28536    if (value != null && value.hasValue()) {
28537        prop(name, Integer.valueOf(value.getValue()));
28538    }    
28539    else if (inArray) 
28540      writeNull(name); 
28541  }    
28542
28543  protected void composeIntegerExtras(String name, IntegerType value, boolean inArray) throws IOException {
28544    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28545      open(inArray ? null : "_"+name);
28546      composeElement(value);
28547      close();
28548    }
28549    else if (inArray) 
28550      writeNull(name); 
28551  }
28552
28553  protected void composeOidCore(String name, OidType value, boolean inArray) throws IOException {
28554    if (value != null && value.hasValue()) {
28555        prop(name, toString(value.getValue()));
28556    }    
28557    else if (inArray) 
28558      writeNull(name); 
28559  }    
28560
28561  protected void composeOidExtras(String name, OidType value, boolean inArray) throws IOException {
28562    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28563      open(inArray ? null : "_"+name);
28564      composeElement(value);
28565      close();
28566    }
28567    else if (inArray) 
28568      writeNull(name); 
28569  }
28570
28571  protected void composeCanonicalCore(String name, CanonicalType value, boolean inArray) throws IOException {
28572    if (value != null && value.hasValue()) {
28573        prop(name, toString(value.getValue()));
28574    }    
28575    else if (inArray) 
28576      writeNull(name); 
28577  }    
28578
28579  protected void composeCanonicalExtras(String name, CanonicalType value, boolean inArray) throws IOException {
28580    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28581      open(inArray ? null : "_"+name);
28582      composeElement(value);
28583      close();
28584    }
28585    else if (inArray) 
28586      writeNull(name); 
28587  }
28588
28589  protected void composeUriCore(String name, UriType value, boolean inArray) throws IOException {
28590    if (value != null && value.hasValue()) {
28591        prop(name, toString(value.getValue()));
28592    }    
28593    else if (inArray) 
28594      writeNull(name); 
28595  }    
28596
28597  protected void composeUriExtras(String name, UriType value, boolean inArray) throws IOException {
28598    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28599      open(inArray ? null : "_"+name);
28600      composeElement(value);
28601      close();
28602    }
28603    else if (inArray) 
28604      writeNull(name); 
28605  }
28606
28607  protected void composeUuidCore(String name, UuidType value, boolean inArray) throws IOException {
28608    if (value != null && value.hasValue()) {
28609        prop(name, toString(value.getValue()));
28610    }    
28611    else if (inArray) 
28612      writeNull(name); 
28613  }    
28614
28615  protected void composeUuidExtras(String name, UuidType value, boolean inArray) throws IOException {
28616    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28617      open(inArray ? null : "_"+name);
28618      composeElement(value);
28619      close();
28620    }
28621    else if (inArray) 
28622      writeNull(name); 
28623  }
28624
28625  protected void composeUrlCore(String name, UrlType value, boolean inArray) throws IOException {
28626    if (value != null && value.hasValue()) {
28627        prop(name, toString(value.getValue()));
28628    }    
28629    else if (inArray) 
28630      writeNull(name); 
28631  }    
28632
28633  protected void composeUrlExtras(String name, UrlType value, boolean inArray) throws IOException {
28634    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28635      open(inArray ? null : "_"+name);
28636      composeElement(value);
28637      close();
28638    }
28639    else if (inArray) 
28640      writeNull(name); 
28641  }
28642
28643  protected void composeInstantCore(String name, InstantType value, boolean inArray) throws IOException {
28644    if (value != null && value.hasValue()) {
28645        prop(name, value.asStringValue());
28646    }    
28647    else if (inArray) 
28648      writeNull(name); 
28649  }    
28650
28651  protected void composeInstantExtras(String name, InstantType value, boolean inArray) throws IOException {
28652    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28653      open(inArray ? null : "_"+name);
28654      composeElement(value);
28655      close();
28656    }
28657    else if (inArray) 
28658      writeNull(name); 
28659  }
28660
28661  protected void composeBooleanCore(String name, BooleanType value, boolean inArray) throws IOException {
28662    if (value != null && value.hasValue()) {
28663        prop(name, value.getValue());
28664    }    
28665    else if (inArray) 
28666      writeNull(name); 
28667  }    
28668
28669  protected void composeBooleanExtras(String name, BooleanType value, boolean inArray) throws IOException {
28670    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28671      open(inArray ? null : "_"+name);
28672      composeElement(value);
28673      close();
28674    }
28675    else if (inArray) 
28676      writeNull(name); 
28677  }
28678
28679  protected void composeBase64BinaryCore(String name, Base64BinaryType value, boolean inArray) throws IOException {
28680    if (value != null && value.hasValue()) {
28681        prop(name, toString(value.getValue()));
28682    }    
28683    else if (inArray) 
28684      writeNull(name); 
28685  }    
28686
28687  protected void composeBase64BinaryExtras(String name, Base64BinaryType value, boolean inArray) throws IOException {
28688    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28689      open(inArray ? null : "_"+name);
28690      composeElement(value);
28691      close();
28692    }
28693    else if (inArray) 
28694      writeNull(name); 
28695  }
28696
28697  protected void composeUnsignedIntCore(String name, UnsignedIntType value, boolean inArray) throws IOException {
28698    if (value != null && value.hasValue()) {
28699        prop(name, Integer.valueOf(value.getValue()));
28700    }    
28701    else if (inArray) 
28702      writeNull(name); 
28703  }    
28704
28705  protected void composeUnsignedIntExtras(String name, UnsignedIntType value, boolean inArray) throws IOException {
28706    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28707      open(inArray ? null : "_"+name);
28708      composeElement(value);
28709      close();
28710    }
28711    else if (inArray) 
28712      writeNull(name); 
28713  }
28714
28715  protected void composeMarkdownCore(String name, MarkdownType value, boolean inArray) throws IOException {
28716    if (value != null && value.hasValue()) {
28717        prop(name, toString(value.getValue()));
28718    }    
28719    else if (inArray) 
28720      writeNull(name); 
28721  }    
28722
28723  protected void composeMarkdownExtras(String name, MarkdownType value, boolean inArray) throws IOException {
28724    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28725      open(inArray ? null : "_"+name);
28726      composeElement(value);
28727      close();
28728    }
28729    else if (inArray) 
28730      writeNull(name); 
28731  }
28732
28733  protected void composeTimeCore(String name, TimeType value, boolean inArray) throws IOException {
28734    if (value != null && value.hasValue()) {
28735        prop(name, value.asStringValue());
28736    }    
28737    else if (inArray) 
28738      writeNull(name); 
28739  }    
28740
28741  protected void composeTimeExtras(String name, TimeType value, boolean inArray) throws IOException {
28742    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28743      open(inArray ? null : "_"+name);
28744      composeElement(value);
28745      close();
28746    }
28747    else if (inArray) 
28748      writeNull(name); 
28749  }
28750
28751  protected void composeIdCore(String name, IdType value, boolean inArray) throws IOException {
28752    if (value != null && value.hasValue()) {
28753        prop(name, toString(value.getValue()));
28754    }    
28755    else if (inArray) 
28756      writeNull(name); 
28757  }    
28758
28759  protected void composeIdExtras(String name, IdType value, boolean inArray) throws IOException {
28760    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28761      open(inArray ? null : "_"+name);
28762      composeElement(value);
28763      close();
28764    }
28765    else if (inArray) 
28766      writeNull(name); 
28767  }
28768
28769  protected void composePositiveIntCore(String name, PositiveIntType value, boolean inArray) throws IOException {
28770    if (value != null && value.hasValue()) {
28771        prop(name, Integer.valueOf(value.getValue()));
28772    }    
28773    else if (inArray) 
28774      writeNull(name); 
28775  }    
28776
28777  protected void composePositiveIntExtras(String name, PositiveIntType value, boolean inArray) throws IOException {
28778    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28779      open(inArray ? null : "_"+name);
28780      composeElement(value);
28781      close();
28782    }
28783    else if (inArray) 
28784      writeNull(name); 
28785  }
28786
28787  protected void composeDecimalCore(String name, DecimalType value, boolean inArray) throws IOException {
28788    if (value != null && value.hasValue()) {
28789        prop(name, value.getValue());
28790    }    
28791    else if (inArray) 
28792      writeNull(name); 
28793  }    
28794
28795  protected void composeDecimalExtras(String name, DecimalType value, boolean inArray) throws IOException {
28796    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
28797      open(inArray ? null : "_"+name);
28798      composeElement(value);
28799      close();
28800    }
28801    else if (inArray) 
28802      writeNull(name); 
28803  }
28804
28805  protected void composeExtension(String name, Extension element) throws IOException {
28806    if (element != null) {
28807      open(name);
28808      composeExtensionInner(element);
28809      close();
28810    }
28811  }
28812
28813  protected void composeExtensionInner(Extension element) throws IOException {
28814      composeElement(element);
28815      if (element.hasUrlElement()) {
28816        composeUriCore("url", element.getUrlElement(), false);
28817        composeUriExtras("url", element.getUrlElement(), false);
28818      }
28819      if (element.hasValue()) {
28820        composeType("value", element.getValue());
28821      }
28822  }
28823
28824  protected void composeNarrative(String name, Narrative element) throws IOException {
28825    if (element != null) {
28826      open(name);
28827      composeNarrativeInner(element);
28828      close();
28829    }
28830  }
28831
28832  protected void composeNarrativeInner(Narrative element) throws IOException {
28833      composeElement(element);
28834      if (element.hasStatusElement()) {
28835        composeEnumerationCore("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
28836        composeEnumerationExtras("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
28837      }
28838      if (element.hasDiv()) {
28839        XhtmlNode node = element.getDiv();
28840        if (node.getNsDecl() == null) {
28841          node.attribute("xmlns", XHTML_NS);
28842        }
28843        composeXhtml("div", node);
28844      }
28845  }
28846
28847  protected void composeCount(String name, Count element) throws IOException {
28848    if (element != null) {
28849      open(name);
28850      composeCountInner(element);
28851      close();
28852    }
28853  }
28854
28855  protected void composeCountInner(Count element) throws IOException {
28856      composeQuantityInner(element);
28857  }
28858
28859  protected void composeDosage(String name, Dosage element) throws IOException {
28860    if (element != null) {
28861      open(name);
28862      composeDosageInner(element);
28863      close();
28864    }
28865  }
28866
28867  protected void composeDosageInner(Dosage element) throws IOException {
28868      composeBackbone(element);
28869      if (element.hasSequenceElement()) {
28870        composeIntegerCore("sequence", element.getSequenceElement(), false);
28871        composeIntegerExtras("sequence", element.getSequenceElement(), false);
28872      }
28873      if (element.hasTextElement()) {
28874        composeStringCore("text", element.getTextElement(), false);
28875        composeStringExtras("text", element.getTextElement(), false);
28876      }
28877      if (element.hasAdditionalInstruction()) {
28878        openArray("additionalInstruction");
28879        for (CodeableConcept e : element.getAdditionalInstruction()) 
28880          composeCodeableConcept(null, e);
28881        closeArray();
28882      };
28883      if (element.hasPatientInstructionElement()) {
28884        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
28885        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
28886      }
28887      if (element.hasTiming()) {
28888        composeTiming("timing", element.getTiming());
28889      }
28890      if (element.hasAsNeeded()) {
28891        composeType("asNeeded", element.getAsNeeded());
28892      }
28893      if (element.hasSite()) {
28894        composeCodeableConcept("site", element.getSite());
28895      }
28896      if (element.hasRoute()) {
28897        composeCodeableConcept("route", element.getRoute());
28898      }
28899      if (element.hasMethod()) {
28900        composeCodeableConcept("method", element.getMethod());
28901      }
28902      if (element.hasDoseAndRate()) {
28903        openArray("doseAndRate");
28904        for (Dosage.DosageDoseAndRateComponent e : element.getDoseAndRate()) 
28905          composeDosageDosageDoseAndRateComponent(null, e);
28906        closeArray();
28907      };
28908      if (element.hasMaxDosePerPeriod()) {
28909        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
28910      }
28911      if (element.hasMaxDosePerAdministration()) {
28912        composeQuantity("maxDosePerAdministration", element.getMaxDosePerAdministration());
28913      }
28914      if (element.hasMaxDosePerLifetime()) {
28915        composeQuantity("maxDosePerLifetime", element.getMaxDosePerLifetime());
28916      }
28917  }
28918
28919  protected void composeDosageDosageDoseAndRateComponent(String name, Dosage.DosageDoseAndRateComponent element) throws IOException {
28920    if (element != null) {
28921      open(name);
28922      composeDosageDosageDoseAndRateComponentInner(element);
28923      close();
28924    }
28925  }
28926
28927  protected void composeDosageDosageDoseAndRateComponentInner(Dosage.DosageDoseAndRateComponent element) throws IOException {
28928      composeElement(element);
28929      if (element.hasType()) {
28930        composeCodeableConcept("type", element.getType());
28931      }
28932      if (element.hasDose()) {
28933        composeType("dose", element.getDose());
28934      }
28935      if (element.hasRate()) {
28936        composeType("rate", element.getRate());
28937      }
28938  }
28939
28940  protected void composeMarketingStatus(String name, MarketingStatus element) throws IOException {
28941    if (element != null) {
28942      open(name);
28943      composeMarketingStatusInner(element);
28944      close();
28945    }
28946  }
28947
28948  protected void composeMarketingStatusInner(MarketingStatus element) throws IOException {
28949      composeBackbone(element);
28950      if (element.hasCountry()) {
28951        composeCodeableConcept("country", element.getCountry());
28952      }
28953      if (element.hasJurisdiction()) {
28954        composeCodeableConcept("jurisdiction", element.getJurisdiction());
28955      }
28956      if (element.hasStatus()) {
28957        composeCodeableConcept("status", element.getStatus());
28958      }
28959      if (element.hasDateRange()) {
28960        composePeriod("dateRange", element.getDateRange());
28961      }
28962      if (element.hasRestoreDateElement()) {
28963        composeDateTimeCore("restoreDate", element.getRestoreDateElement(), false);
28964        composeDateTimeExtras("restoreDate", element.getRestoreDateElement(), false);
28965      }
28966  }
28967
28968  protected void composeSubstanceAmount(String name, SubstanceAmount element) throws IOException {
28969    if (element != null) {
28970      open(name);
28971      composeSubstanceAmountInner(element);
28972      close();
28973    }
28974  }
28975
28976  protected void composeSubstanceAmountInner(SubstanceAmount element) throws IOException {
28977      composeBackbone(element);
28978      if (element.hasAmount()) {
28979        composeType("amount", element.getAmount());
28980      }
28981      if (element.hasAmountType()) {
28982        composeCodeableConcept("amountType", element.getAmountType());
28983      }
28984      if (element.hasAmountTextElement()) {
28985        composeStringCore("amountText", element.getAmountTextElement(), false);
28986        composeStringExtras("amountText", element.getAmountTextElement(), false);
28987      }
28988      if (element.hasReferenceRange()) {
28989        composeSubstanceAmountSubstanceAmountReferenceRangeComponent("referenceRange", element.getReferenceRange());
28990      }
28991  }
28992
28993  protected void composeSubstanceAmountSubstanceAmountReferenceRangeComponent(String name, SubstanceAmount.SubstanceAmountReferenceRangeComponent element) throws IOException {
28994    if (element != null) {
28995      open(name);
28996      composeSubstanceAmountSubstanceAmountReferenceRangeComponentInner(element);
28997      close();
28998    }
28999  }
29000
29001  protected void composeSubstanceAmountSubstanceAmountReferenceRangeComponentInner(SubstanceAmount.SubstanceAmountReferenceRangeComponent element) throws IOException {
29002      composeElement(element);
29003      if (element.hasLowLimit()) {
29004        composeQuantity("lowLimit", element.getLowLimit());
29005      }
29006      if (element.hasHighLimit()) {
29007        composeQuantity("highLimit", element.getHighLimit());
29008      }
29009  }
29010
29011  protected void composePopulation(String name, Population element) throws IOException {
29012    if (element != null) {
29013      open(name);
29014      composePopulationInner(element);
29015      close();
29016    }
29017  }
29018
29019  protected void composePopulationInner(Population element) throws IOException {
29020      composeBackbone(element);
29021      if (element.hasAge()) {
29022        composeType("age", element.getAge());
29023      }
29024      if (element.hasGender()) {
29025        composeCodeableConcept("gender", element.getGender());
29026      }
29027      if (element.hasRace()) {
29028        composeCodeableConcept("race", element.getRace());
29029      }
29030      if (element.hasPhysiologicalCondition()) {
29031        composeCodeableConcept("physiologicalCondition", element.getPhysiologicalCondition());
29032      }
29033  }
29034
29035  protected void composeDistance(String name, Distance element) throws IOException {
29036    if (element != null) {
29037      open(name);
29038      composeDistanceInner(element);
29039      close();
29040    }
29041  }
29042
29043  protected void composeDistanceInner(Distance element) throws IOException {
29044      composeQuantityInner(element);
29045  }
29046
29047  protected void composeAge(String name, Age element) throws IOException {
29048    if (element != null) {
29049      open(name);
29050      composeAgeInner(element);
29051      close();
29052    }
29053  }
29054
29055  protected void composeAgeInner(Age element) throws IOException {
29056      composeQuantityInner(element);
29057  }
29058
29059  protected void composeDuration(String name, Duration element) throws IOException {
29060    if (element != null) {
29061      open(name);
29062      composeDurationInner(element);
29063      close();
29064    }
29065  }
29066
29067  protected void composeDurationInner(Duration element) throws IOException {
29068      composeQuantityInner(element);
29069  }
29070
29071  protected void composeProductShelfLife(String name, ProductShelfLife element) throws IOException {
29072    if (element != null) {
29073      open(name);
29074      composeProductShelfLifeInner(element);
29075      close();
29076    }
29077  }
29078
29079  protected void composeProductShelfLifeInner(ProductShelfLife element) throws IOException {
29080      composeBackbone(element);
29081      if (element.hasIdentifier()) {
29082        composeIdentifier("identifier", element.getIdentifier());
29083      }
29084      if (element.hasType()) {
29085        composeCodeableConcept("type", element.getType());
29086      }
29087      if (element.hasPeriod()) {
29088        composeQuantity("period", element.getPeriod());
29089      }
29090      if (element.hasSpecialPrecautionsForStorage()) {
29091        openArray("specialPrecautionsForStorage");
29092        for (CodeableConcept e : element.getSpecialPrecautionsForStorage()) 
29093          composeCodeableConcept(null, e);
29094        closeArray();
29095      };
29096  }
29097
29098  protected void composeTiming(String name, Timing element) throws IOException {
29099    if (element != null) {
29100      open(name);
29101      composeTimingInner(element);
29102      close();
29103    }
29104  }
29105
29106  protected void composeTimingInner(Timing element) throws IOException {
29107      composeBackbone(element);
29108      if (element.hasEvent()) {
29109        openArray("event");
29110        for (DateTimeType e : element.getEvent()) 
29111          composeDateTimeCore(null, e, true);
29112        closeArray();
29113        if (anyHasExtras(element.getEvent())) {
29114          openArray("_event");
29115          for (DateTimeType e : element.getEvent()) 
29116            composeDateTimeExtras(null, e, true);
29117          closeArray();
29118        }
29119      };
29120      if (element.hasRepeat()) {
29121        composeTimingTimingRepeatComponent("repeat", element.getRepeat());
29122      }
29123      if (element.hasCode()) {
29124        composeCodeableConcept("code", element.getCode());
29125      }
29126  }
29127
29128  protected void composeTimingTimingRepeatComponent(String name, Timing.TimingRepeatComponent element) throws IOException {
29129    if (element != null) {
29130      open(name);
29131      composeTimingTimingRepeatComponentInner(element);
29132      close();
29133    }
29134  }
29135
29136  protected void composeTimingTimingRepeatComponentInner(Timing.TimingRepeatComponent element) throws IOException {
29137      composeElement(element);
29138      if (element.hasBounds()) {
29139        composeType("bounds", element.getBounds());
29140      }
29141      if (element.hasCountElement()) {
29142        composePositiveIntCore("count", element.getCountElement(), false);
29143        composePositiveIntExtras("count", element.getCountElement(), false);
29144      }
29145      if (element.hasCountMaxElement()) {
29146        composePositiveIntCore("countMax", element.getCountMaxElement(), false);
29147        composePositiveIntExtras("countMax", element.getCountMaxElement(), false);
29148      }
29149      if (element.hasDurationElement()) {
29150        composeDecimalCore("duration", element.getDurationElement(), false);
29151        composeDecimalExtras("duration", element.getDurationElement(), false);
29152      }
29153      if (element.hasDurationMaxElement()) {
29154        composeDecimalCore("durationMax", element.getDurationMaxElement(), false);
29155        composeDecimalExtras("durationMax", element.getDurationMaxElement(), false);
29156      }
29157      if (element.hasDurationUnitElement()) {
29158        composeEnumerationCore("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
29159        composeEnumerationExtras("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
29160      }
29161      if (element.hasFrequencyElement()) {
29162        composePositiveIntCore("frequency", element.getFrequencyElement(), false);
29163        composePositiveIntExtras("frequency", element.getFrequencyElement(), false);
29164      }
29165      if (element.hasFrequencyMaxElement()) {
29166        composePositiveIntCore("frequencyMax", element.getFrequencyMaxElement(), false);
29167        composePositiveIntExtras("frequencyMax", element.getFrequencyMaxElement(), false);
29168      }
29169      if (element.hasPeriodElement()) {
29170        composeDecimalCore("period", element.getPeriodElement(), false);
29171        composeDecimalExtras("period", element.getPeriodElement(), false);
29172      }
29173      if (element.hasPeriodMaxElement()) {
29174        composeDecimalCore("periodMax", element.getPeriodMaxElement(), false);
29175        composeDecimalExtras("periodMax", element.getPeriodMaxElement(), false);
29176      }
29177      if (element.hasPeriodUnitElement()) {
29178        composeEnumerationCore("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
29179        composeEnumerationExtras("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
29180      }
29181      if (element.hasDayOfWeek()) {
29182        openArray("dayOfWeek");
29183        for (Enumeration<Timing.DayOfWeek> e : element.getDayOfWeek()) 
29184          composeEnumerationCore(null, e, new Timing.DayOfWeekEnumFactory(), true);
29185        closeArray();
29186        if (anyHasExtras(element.getDayOfWeek())) {
29187          openArray("_dayOfWeek");
29188          for (Enumeration<Timing.DayOfWeek> e : element.getDayOfWeek()) 
29189            composeEnumerationExtras(null, e, new Timing.DayOfWeekEnumFactory(), true);
29190          closeArray();
29191        }
29192      };
29193      if (element.hasTimeOfDay()) {
29194        openArray("timeOfDay");
29195        for (TimeType e : element.getTimeOfDay()) 
29196          composeTimeCore(null, e, true);
29197        closeArray();
29198        if (anyHasExtras(element.getTimeOfDay())) {
29199          openArray("_timeOfDay");
29200          for (TimeType e : element.getTimeOfDay()) 
29201            composeTimeExtras(null, e, true);
29202          closeArray();
29203        }
29204      };
29205      if (element.hasWhen()) {
29206        openArray("when");
29207        for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
29208          composeEnumerationCore(null, e, new Timing.EventTimingEnumFactory(), true);
29209        closeArray();
29210        if (anyHasExtras(element.getWhen())) {
29211          openArray("_when");
29212          for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
29213            composeEnumerationExtras(null, e, new Timing.EventTimingEnumFactory(), true);
29214          closeArray();
29215        }
29216      };
29217      if (element.hasOffsetElement()) {
29218        composeUnsignedIntCore("offset", element.getOffsetElement(), false);
29219        composeUnsignedIntExtras("offset", element.getOffsetElement(), false);
29220      }
29221  }
29222
29223  protected void composeProdCharacteristic(String name, ProdCharacteristic element) throws IOException {
29224    if (element != null) {
29225      open(name);
29226      composeProdCharacteristicInner(element);
29227      close();
29228    }
29229  }
29230
29231  protected void composeProdCharacteristicInner(ProdCharacteristic element) throws IOException {
29232      composeBackbone(element);
29233      if (element.hasHeight()) {
29234        composeQuantity("height", element.getHeight());
29235      }
29236      if (element.hasWidth()) {
29237        composeQuantity("width", element.getWidth());
29238      }
29239      if (element.hasDepth()) {
29240        composeQuantity("depth", element.getDepth());
29241      }
29242      if (element.hasWeight()) {
29243        composeQuantity("weight", element.getWeight());
29244      }
29245      if (element.hasNominalVolume()) {
29246        composeQuantity("nominalVolume", element.getNominalVolume());
29247      }
29248      if (element.hasExternalDiameter()) {
29249        composeQuantity("externalDiameter", element.getExternalDiameter());
29250      }
29251      if (element.hasShapeElement()) {
29252        composeStringCore("shape", element.getShapeElement(), false);
29253        composeStringExtras("shape", element.getShapeElement(), false);
29254      }
29255      if (element.hasColor()) {
29256        openArray("color");
29257        for (StringType e : element.getColor()) 
29258          composeStringCore(null, e, true);
29259        closeArray();
29260        if (anyHasExtras(element.getColor())) {
29261          openArray("_color");
29262          for (StringType e : element.getColor()) 
29263            composeStringExtras(null, e, true);
29264          closeArray();
29265        }
29266      };
29267      if (element.hasImprint()) {
29268        openArray("imprint");
29269        for (StringType e : element.getImprint()) 
29270          composeStringCore(null, e, true);
29271        closeArray();
29272        if (anyHasExtras(element.getImprint())) {
29273          openArray("_imprint");
29274          for (StringType e : element.getImprint()) 
29275            composeStringExtras(null, e, true);
29276          closeArray();
29277        }
29278      };
29279      if (element.hasImage()) {
29280        openArray("image");
29281        for (Attachment e : element.getImage()) 
29282          composeAttachment(null, e);
29283        closeArray();
29284      };
29285      if (element.hasScoring()) {
29286        composeCodeableConcept("scoring", element.getScoring());
29287      }
29288  }
29289
29290  protected void composeMeta(String name, Meta element) throws IOException {
29291    if (element != null) {
29292      open(name);
29293      composeMetaInner(element);
29294      close();
29295    }
29296  }
29297
29298  protected void composeMetaInner(Meta element) throws IOException {
29299      composeElement(element);
29300      if (element.hasVersionIdElement()) {
29301        composeIdCore("versionId", element.getVersionIdElement(), false);
29302        composeIdExtras("versionId", element.getVersionIdElement(), false);
29303      }
29304      if (element.hasLastUpdatedElement()) {
29305        composeInstantCore("lastUpdated", element.getLastUpdatedElement(), false);
29306        composeInstantExtras("lastUpdated", element.getLastUpdatedElement(), false);
29307      }
29308      if (element.hasSourceElement()) {
29309        composeUriCore("source", element.getSourceElement(), false);
29310        composeUriExtras("source", element.getSourceElement(), false);
29311      }
29312      if (element.hasProfile()) {
29313        openArray("profile");
29314        for (CanonicalType e : element.getProfile()) 
29315          composeCanonicalCore(null, e, true);
29316        closeArray();
29317        if (anyHasExtras(element.getProfile())) {
29318          openArray("_profile");
29319          for (CanonicalType e : element.getProfile()) 
29320            composeCanonicalExtras(null, e, true);
29321          closeArray();
29322        }
29323      };
29324      if (element.hasSecurity()) {
29325        openArray("security");
29326        for (Coding e : element.getSecurity()) 
29327          composeCoding(null, e);
29328        closeArray();
29329      };
29330      if (element.hasTag()) {
29331        openArray("tag");
29332        for (Coding e : element.getTag()) 
29333          composeCoding(null, e);
29334        closeArray();
29335      };
29336  }
29337
29338  protected void composeAddress(String name, Address element) throws IOException {
29339    if (element != null) {
29340      open(name);
29341      composeAddressInner(element);
29342      close();
29343    }
29344  }
29345
29346  protected void composeAddressInner(Address element) throws IOException {
29347      composeElement(element);
29348      if (element.hasUseElement()) {
29349        composeEnumerationCore("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
29350        composeEnumerationExtras("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
29351      }
29352      if (element.hasTypeElement()) {
29353        composeEnumerationCore("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
29354        composeEnumerationExtras("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
29355      }
29356      if (element.hasTextElement()) {
29357        composeStringCore("text", element.getTextElement(), false);
29358        composeStringExtras("text", element.getTextElement(), false);
29359      }
29360      if (element.hasLine()) {
29361        openArray("line");
29362        for (StringType e : element.getLine()) 
29363          composeStringCore(null, e, true);
29364        closeArray();
29365        if (anyHasExtras(element.getLine())) {
29366          openArray("_line");
29367          for (StringType e : element.getLine()) 
29368            composeStringExtras(null, e, true);
29369          closeArray();
29370        }
29371      };
29372      if (element.hasCityElement()) {
29373        composeStringCore("city", element.getCityElement(), false);
29374        composeStringExtras("city", element.getCityElement(), false);
29375      }
29376      if (element.hasDistrictElement()) {
29377        composeStringCore("district", element.getDistrictElement(), false);
29378        composeStringExtras("district", element.getDistrictElement(), false);
29379      }
29380      if (element.hasStateElement()) {
29381        composeStringCore("state", element.getStateElement(), false);
29382        composeStringExtras("state", element.getStateElement(), false);
29383      }
29384      if (element.hasPostalCodeElement()) {
29385        composeStringCore("postalCode", element.getPostalCodeElement(), false);
29386        composeStringExtras("postalCode", element.getPostalCodeElement(), false);
29387      }
29388      if (element.hasCountryElement()) {
29389        composeStringCore("country", element.getCountryElement(), false);
29390        composeStringExtras("country", element.getCountryElement(), false);
29391      }
29392      if (element.hasPeriod()) {
29393        composePeriod("period", element.getPeriod());
29394      }
29395  }
29396
29397  protected void composeContributor(String name, Contributor element) throws IOException {
29398    if (element != null) {
29399      open(name);
29400      composeContributorInner(element);
29401      close();
29402    }
29403  }
29404
29405  protected void composeContributorInner(Contributor element) throws IOException {
29406      composeElement(element);
29407      if (element.hasTypeElement()) {
29408        composeEnumerationCore("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
29409        composeEnumerationExtras("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
29410      }
29411      if (element.hasNameElement()) {
29412        composeStringCore("name", element.getNameElement(), false);
29413        composeStringExtras("name", element.getNameElement(), false);
29414      }
29415      if (element.hasContact()) {
29416        openArray("contact");
29417        for (ContactDetail e : element.getContact()) 
29418          composeContactDetail(null, e);
29419        closeArray();
29420      };
29421  }
29422
29423  protected void composeAttachment(String name, Attachment element) throws IOException {
29424    if (element != null) {
29425      open(name);
29426      composeAttachmentInner(element);
29427      close();
29428    }
29429  }
29430
29431  protected void composeAttachmentInner(Attachment element) throws IOException {
29432      composeElement(element);
29433      if (element.hasContentTypeElement()) {
29434        composeCodeCore("contentType", element.getContentTypeElement(), false);
29435        composeCodeExtras("contentType", element.getContentTypeElement(), false);
29436      }
29437      if (element.hasLanguageElement()) {
29438        composeCodeCore("language", element.getLanguageElement(), false);
29439        composeCodeExtras("language", element.getLanguageElement(), false);
29440      }
29441      if (element.hasDataElement()) {
29442        composeBase64BinaryCore("data", element.getDataElement(), false);
29443        composeBase64BinaryExtras("data", element.getDataElement(), false);
29444      }
29445      if (element.hasUrlElement()) {
29446        composeUrlCore("url", element.getUrlElement(), false);
29447        composeUrlExtras("url", element.getUrlElement(), false);
29448      }
29449      if (element.hasSizeElement()) {
29450        composeUnsignedIntCore("size", element.getSizeElement(), false);
29451        composeUnsignedIntExtras("size", element.getSizeElement(), false);
29452      }
29453      if (element.hasHashElement()) {
29454        composeBase64BinaryCore("hash", element.getHashElement(), false);
29455        composeBase64BinaryExtras("hash", element.getHashElement(), false);
29456      }
29457      if (element.hasTitleElement()) {
29458        composeStringCore("title", element.getTitleElement(), false);
29459        composeStringExtras("title", element.getTitleElement(), false);
29460      }
29461      if (element.hasCreationElement()) {
29462        composeDateTimeCore("creation", element.getCreationElement(), false);
29463        composeDateTimeExtras("creation", element.getCreationElement(), false);
29464      }
29465  }
29466
29467  protected void composeDataRequirement(String name, DataRequirement element) throws IOException {
29468    if (element != null) {
29469      open(name);
29470      composeDataRequirementInner(element);
29471      close();
29472    }
29473  }
29474
29475  protected void composeDataRequirementInner(DataRequirement element) throws IOException {
29476      composeElement(element);
29477      if (element.hasTypeElement()) {
29478        composeCodeCore("type", element.getTypeElement(), false);
29479        composeCodeExtras("type", element.getTypeElement(), false);
29480      }
29481      if (element.hasProfile()) {
29482        openArray("profile");
29483        for (CanonicalType e : element.getProfile()) 
29484          composeCanonicalCore(null, e, true);
29485        closeArray();
29486        if (anyHasExtras(element.getProfile())) {
29487          openArray("_profile");
29488          for (CanonicalType e : element.getProfile()) 
29489            composeCanonicalExtras(null, e, true);
29490          closeArray();
29491        }
29492      };
29493      if (element.hasSubject()) {
29494        composeType("subject", element.getSubject());
29495      }
29496      if (element.hasMustSupport()) {
29497        openArray("mustSupport");
29498        for (StringType e : element.getMustSupport()) 
29499          composeStringCore(null, e, true);
29500        closeArray();
29501        if (anyHasExtras(element.getMustSupport())) {
29502          openArray("_mustSupport");
29503          for (StringType e : element.getMustSupport()) 
29504            composeStringExtras(null, e, true);
29505          closeArray();
29506        }
29507      };
29508      if (element.hasCodeFilter()) {
29509        openArray("codeFilter");
29510        for (DataRequirement.DataRequirementCodeFilterComponent e : element.getCodeFilter()) 
29511          composeDataRequirementDataRequirementCodeFilterComponent(null, e);
29512        closeArray();
29513      };
29514      if (element.hasDateFilter()) {
29515        openArray("dateFilter");
29516        for (DataRequirement.DataRequirementDateFilterComponent e : element.getDateFilter()) 
29517          composeDataRequirementDataRequirementDateFilterComponent(null, e);
29518        closeArray();
29519      };
29520      if (element.hasLimitElement()) {
29521        composePositiveIntCore("limit", element.getLimitElement(), false);
29522        composePositiveIntExtras("limit", element.getLimitElement(), false);
29523      }
29524      if (element.hasSort()) {
29525        openArray("sort");
29526        for (DataRequirement.DataRequirementSortComponent e : element.getSort()) 
29527          composeDataRequirementDataRequirementSortComponent(null, e);
29528        closeArray();
29529      };
29530  }
29531
29532  protected void composeDataRequirementDataRequirementCodeFilterComponent(String name, DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
29533    if (element != null) {
29534      open(name);
29535      composeDataRequirementDataRequirementCodeFilterComponentInner(element);
29536      close();
29537    }
29538  }
29539
29540  protected void composeDataRequirementDataRequirementCodeFilterComponentInner(DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
29541      composeElement(element);
29542      if (element.hasPathElement()) {
29543        composeStringCore("path", element.getPathElement(), false);
29544        composeStringExtras("path", element.getPathElement(), false);
29545      }
29546      if (element.hasSearchParamElement()) {
29547        composeStringCore("searchParam", element.getSearchParamElement(), false);
29548        composeStringExtras("searchParam", element.getSearchParamElement(), false);
29549      }
29550      if (element.hasValueSetElement()) {
29551        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
29552        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
29553      }
29554      if (element.hasCode()) {
29555        openArray("code");
29556        for (Coding e : element.getCode()) 
29557          composeCoding(null, e);
29558        closeArray();
29559      };
29560  }
29561
29562  protected void composeDataRequirementDataRequirementDateFilterComponent(String name, DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
29563    if (element != null) {
29564      open(name);
29565      composeDataRequirementDataRequirementDateFilterComponentInner(element);
29566      close();
29567    }
29568  }
29569
29570  protected void composeDataRequirementDataRequirementDateFilterComponentInner(DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
29571      composeElement(element);
29572      if (element.hasPathElement()) {
29573        composeStringCore("path", element.getPathElement(), false);
29574        composeStringExtras("path", element.getPathElement(), false);
29575      }
29576      if (element.hasSearchParamElement()) {
29577        composeStringCore("searchParam", element.getSearchParamElement(), false);
29578        composeStringExtras("searchParam", element.getSearchParamElement(), false);
29579      }
29580      if (element.hasValue()) {
29581        composeType("value", element.getValue());
29582      }
29583  }
29584
29585  protected void composeDataRequirementDataRequirementSortComponent(String name, DataRequirement.DataRequirementSortComponent element) throws IOException {
29586    if (element != null) {
29587      open(name);
29588      composeDataRequirementDataRequirementSortComponentInner(element);
29589      close();
29590    }
29591  }
29592
29593  protected void composeDataRequirementDataRequirementSortComponentInner(DataRequirement.DataRequirementSortComponent element) throws IOException {
29594      composeElement(element);
29595      if (element.hasPathElement()) {
29596        composeStringCore("path", element.getPathElement(), false);
29597        composeStringExtras("path", element.getPathElement(), false);
29598      }
29599      if (element.hasDirectionElement()) {
29600        composeEnumerationCore("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory(), false);
29601        composeEnumerationExtras("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory(), false);
29602      }
29603  }
29604
29605  protected void composeMoney(String name, Money element) throws IOException {
29606    if (element != null) {
29607      open(name);
29608      composeMoneyInner(element);
29609      close();
29610    }
29611  }
29612
29613  protected void composeMoneyInner(Money element) throws IOException {
29614      composeElement(element);
29615      if (element.hasValueElement()) {
29616        composeDecimalCore("value", element.getValueElement(), false);
29617        composeDecimalExtras("value", element.getValueElement(), false);
29618      }
29619      if (element.hasCurrencyElement()) {
29620        composeCodeCore("currency", element.getCurrencyElement(), false);
29621        composeCodeExtras("currency", element.getCurrencyElement(), false);
29622      }
29623  }
29624
29625  protected void composeHumanName(String name, HumanName element) throws IOException {
29626    if (element != null) {
29627      open(name);
29628      composeHumanNameInner(element);
29629      close();
29630    }
29631  }
29632
29633  protected void composeHumanNameInner(HumanName element) throws IOException {
29634      composeElement(element);
29635      if (element.hasUseElement()) {
29636        composeEnumerationCore("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
29637        composeEnumerationExtras("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
29638      }
29639      if (element.hasTextElement()) {
29640        composeStringCore("text", element.getTextElement(), false);
29641        composeStringExtras("text", element.getTextElement(), false);
29642      }
29643      if (element.hasFamilyElement()) {
29644        composeStringCore("family", element.getFamilyElement(), false);
29645        composeStringExtras("family", element.getFamilyElement(), false);
29646      }
29647      if (element.hasGiven()) {
29648        openArray("given");
29649        for (StringType e : element.getGiven()) 
29650          composeStringCore(null, e, true);
29651        closeArray();
29652        if (anyHasExtras(element.getGiven())) {
29653          openArray("_given");
29654          for (StringType e : element.getGiven()) 
29655            composeStringExtras(null, e, true);
29656          closeArray();
29657        }
29658      };
29659      if (element.hasPrefix()) {
29660        openArray("prefix");
29661        for (StringType e : element.getPrefix()) 
29662          composeStringCore(null, e, true);
29663        closeArray();
29664        if (anyHasExtras(element.getPrefix())) {
29665          openArray("_prefix");
29666          for (StringType e : element.getPrefix()) 
29667            composeStringExtras(null, e, true);
29668          closeArray();
29669        }
29670      };
29671      if (element.hasSuffix()) {
29672        openArray("suffix");
29673        for (StringType e : element.getSuffix()) 
29674          composeStringCore(null, e, true);
29675        closeArray();
29676        if (anyHasExtras(element.getSuffix())) {
29677          openArray("_suffix");
29678          for (StringType e : element.getSuffix()) 
29679            composeStringExtras(null, e, true);
29680          closeArray();
29681        }
29682      };
29683      if (element.hasPeriod()) {
29684        composePeriod("period", element.getPeriod());
29685      }
29686  }
29687
29688  protected void composeContactPoint(String name, ContactPoint element) throws IOException {
29689    if (element != null) {
29690      open(name);
29691      composeContactPointInner(element);
29692      close();
29693    }
29694  }
29695
29696  protected void composeContactPointInner(ContactPoint element) throws IOException {
29697      composeElement(element);
29698      if (element.hasSystemElement()) {
29699        composeEnumerationCore("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
29700        composeEnumerationExtras("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
29701      }
29702      if (element.hasValueElement()) {
29703        composeStringCore("value", element.getValueElement(), false);
29704        composeStringExtras("value", element.getValueElement(), false);
29705      }
29706      if (element.hasUseElement()) {
29707        composeEnumerationCore("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
29708        composeEnumerationExtras("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
29709      }
29710      if (element.hasRankElement()) {
29711        composePositiveIntCore("rank", element.getRankElement(), false);
29712        composePositiveIntExtras("rank", element.getRankElement(), false);
29713      }
29714      if (element.hasPeriod()) {
29715        composePeriod("period", element.getPeriod());
29716      }
29717  }
29718
29719  protected void composeIdentifier(String name, Identifier element) throws IOException {
29720    if (element != null) {
29721      open(name);
29722      composeIdentifierInner(element);
29723      close();
29724    }
29725  }
29726
29727  protected void composeIdentifierInner(Identifier element) throws IOException {
29728      composeElement(element);
29729      if (element.hasUseElement()) {
29730        composeEnumerationCore("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
29731        composeEnumerationExtras("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
29732      }
29733      if (element.hasType()) {
29734        composeCodeableConcept("type", element.getType());
29735      }
29736      if (element.hasSystemElement()) {
29737        composeUriCore("system", element.getSystemElement(), false);
29738        composeUriExtras("system", element.getSystemElement(), false);
29739      }
29740      if (element.hasValueElement()) {
29741        composeStringCore("value", element.getValueElement(), false);
29742        composeStringExtras("value", element.getValueElement(), false);
29743      }
29744      if (element.hasPeriod()) {
29745        composePeriod("period", element.getPeriod());
29746      }
29747      if (element.hasAssigner()) {
29748        composeReference("assigner", element.getAssigner());
29749      }
29750  }
29751
29752  protected void composeCoding(String name, Coding element) throws IOException {
29753    if (element != null) {
29754      open(name);
29755      composeCodingInner(element);
29756      close();
29757    }
29758  }
29759
29760  protected void composeCodingInner(Coding element) throws IOException {
29761      composeElement(element);
29762      if (element.hasSystemElement()) {
29763        composeUriCore("system", element.getSystemElement(), false);
29764        composeUriExtras("system", element.getSystemElement(), false);
29765      }
29766      if (element.hasVersionElement()) {
29767        composeStringCore("version", element.getVersionElement(), false);
29768        composeStringExtras("version", element.getVersionElement(), false);
29769      }
29770      if (element.hasCodeElement()) {
29771        composeCodeCore("code", element.getCodeElement(), false);
29772        composeCodeExtras("code", element.getCodeElement(), false);
29773      }
29774      if (element.hasDisplayElement()) {
29775        composeStringCore("display", element.getDisplayElement(), false);
29776        composeStringExtras("display", element.getDisplayElement(), false);
29777      }
29778      if (element.hasUserSelectedElement()) {
29779        composeBooleanCore("userSelected", element.getUserSelectedElement(), false);
29780        composeBooleanExtras("userSelected", element.getUserSelectedElement(), false);
29781      }
29782  }
29783
29784  protected void composeSampledData(String name, SampledData element) throws IOException {
29785    if (element != null) {
29786      open(name);
29787      composeSampledDataInner(element);
29788      close();
29789    }
29790  }
29791
29792  protected void composeSampledDataInner(SampledData element) throws IOException {
29793      composeElement(element);
29794      if (element.hasOrigin()) {
29795        composeQuantity("origin", element.getOrigin());
29796      }
29797      if (element.hasPeriodElement()) {
29798        composeDecimalCore("period", element.getPeriodElement(), false);
29799        composeDecimalExtras("period", element.getPeriodElement(), false);
29800      }
29801      if (element.hasFactorElement()) {
29802        composeDecimalCore("factor", element.getFactorElement(), false);
29803        composeDecimalExtras("factor", element.getFactorElement(), false);
29804      }
29805      if (element.hasLowerLimitElement()) {
29806        composeDecimalCore("lowerLimit", element.getLowerLimitElement(), false);
29807        composeDecimalExtras("lowerLimit", element.getLowerLimitElement(), false);
29808      }
29809      if (element.hasUpperLimitElement()) {
29810        composeDecimalCore("upperLimit", element.getUpperLimitElement(), false);
29811        composeDecimalExtras("upperLimit", element.getUpperLimitElement(), false);
29812      }
29813      if (element.hasDimensionsElement()) {
29814        composePositiveIntCore("dimensions", element.getDimensionsElement(), false);
29815        composePositiveIntExtras("dimensions", element.getDimensionsElement(), false);
29816      }
29817      if (element.hasDataElement()) {
29818        composeStringCore("data", element.getDataElement(), false);
29819        composeStringExtras("data", element.getDataElement(), false);
29820      }
29821  }
29822
29823  protected void composeRatio(String name, Ratio element) throws IOException {
29824    if (element != null) {
29825      open(name);
29826      composeRatioInner(element);
29827      close();
29828    }
29829  }
29830
29831  protected void composeRatioInner(Ratio element) throws IOException {
29832      composeElement(element);
29833      if (element.hasNumerator()) {
29834        composeQuantity("numerator", element.getNumerator());
29835      }
29836      if (element.hasDenominator()) {
29837        composeQuantity("denominator", element.getDenominator());
29838      }
29839  }
29840
29841  protected void composeReference(String name, Reference element) throws IOException {
29842    if (element != null) {
29843      open(name);
29844      composeReferenceInner(element);
29845      close();
29846    }
29847  }
29848
29849  protected void composeReferenceInner(Reference element) throws IOException {
29850      composeElement(element);
29851      if (element.hasReferenceElement()) {
29852        composeStringCore("reference", element.getReferenceElement(), false);
29853        composeStringExtras("reference", element.getReferenceElement(), false);
29854      }
29855      if (element.hasTypeElement()) {
29856        composeUriCore("type", element.getTypeElement(), false);
29857        composeUriExtras("type", element.getTypeElement(), false);
29858      }
29859      if (element.hasIdentifier()) {
29860        composeIdentifier("identifier", element.getIdentifier());
29861      }
29862      if (element.hasDisplayElement()) {
29863        composeStringCore("display", element.getDisplayElement(), false);
29864        composeStringExtras("display", element.getDisplayElement(), false);
29865      }
29866  }
29867
29868  protected void composeTriggerDefinition(String name, TriggerDefinition element) throws IOException {
29869    if (element != null) {
29870      open(name);
29871      composeTriggerDefinitionInner(element);
29872      close();
29873    }
29874  }
29875
29876  protected void composeTriggerDefinitionInner(TriggerDefinition element) throws IOException {
29877      composeElement(element);
29878      if (element.hasTypeElement()) {
29879        composeEnumerationCore("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
29880        composeEnumerationExtras("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
29881      }
29882      if (element.hasNameElement()) {
29883        composeStringCore("name", element.getNameElement(), false);
29884        composeStringExtras("name", element.getNameElement(), false);
29885      }
29886      if (element.hasTiming()) {
29887        composeType("timing", element.getTiming());
29888      }
29889      if (element.hasData()) {
29890        openArray("data");
29891        for (DataRequirement e : element.getData()) 
29892          composeDataRequirement(null, e);
29893        closeArray();
29894      };
29895      if (element.hasCondition()) {
29896        composeExpression("condition", element.getCondition());
29897      }
29898  }
29899
29900  protected void composeQuantity(String name, Quantity element) throws IOException {
29901    if (element != null) {
29902      open(name);
29903      composeQuantityInner(element);
29904      close();
29905    }
29906  }
29907
29908  protected void composeQuantityInner(Quantity element) throws IOException {
29909      composeElement(element);
29910      if (element.hasValueElement()) {
29911        composeDecimalCore("value", element.getValueElement(), false);
29912        composeDecimalExtras("value", element.getValueElement(), false);
29913      }
29914      if (element.hasComparatorElement()) {
29915        composeEnumerationCore("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
29916        composeEnumerationExtras("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
29917      }
29918      if (element.hasUnitElement()) {
29919        composeStringCore("unit", element.getUnitElement(), false);
29920        composeStringExtras("unit", element.getUnitElement(), false);
29921      }
29922      if (element.hasSystemElement()) {
29923        composeUriCore("system", element.getSystemElement(), false);
29924        composeUriExtras("system", element.getSystemElement(), false);
29925      }
29926      if (element.hasCodeElement()) {
29927        composeCodeCore("code", element.getCodeElement(), false);
29928        composeCodeExtras("code", element.getCodeElement(), false);
29929      }
29930  }
29931
29932  protected void composePeriod(String name, Period element) throws IOException {
29933    if (element != null) {
29934      open(name);
29935      composePeriodInner(element);
29936      close();
29937    }
29938  }
29939
29940  protected void composePeriodInner(Period element) throws IOException {
29941      composeElement(element);
29942      if (element.hasStartElement()) {
29943        composeDateTimeCore("start", element.getStartElement(), false);
29944        composeDateTimeExtras("start", element.getStartElement(), false);
29945      }
29946      if (element.hasEndElement()) {
29947        composeDateTimeCore("end", element.getEndElement(), false);
29948        composeDateTimeExtras("end", element.getEndElement(), false);
29949      }
29950  }
29951
29952  protected void composeRange(String name, Range element) throws IOException {
29953    if (element != null) {
29954      open(name);
29955      composeRangeInner(element);
29956      close();
29957    }
29958  }
29959
29960  protected void composeRangeInner(Range element) throws IOException {
29961      composeElement(element);
29962      if (element.hasLow()) {
29963        composeQuantity("low", element.getLow());
29964      }
29965      if (element.hasHigh()) {
29966        composeQuantity("high", element.getHigh());
29967      }
29968  }
29969
29970  protected void composeRelatedArtifact(String name, RelatedArtifact element) throws IOException {
29971    if (element != null) {
29972      open(name);
29973      composeRelatedArtifactInner(element);
29974      close();
29975    }
29976  }
29977
29978  protected void composeRelatedArtifactInner(RelatedArtifact element) throws IOException {
29979      composeElement(element);
29980      if (element.hasTypeElement()) {
29981        composeEnumerationCore("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
29982        composeEnumerationExtras("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
29983      }
29984      if (element.hasLabelElement()) {
29985        composeStringCore("label", element.getLabelElement(), false);
29986        composeStringExtras("label", element.getLabelElement(), false);
29987      }
29988      if (element.hasDisplayElement()) {
29989        composeStringCore("display", element.getDisplayElement(), false);
29990        composeStringExtras("display", element.getDisplayElement(), false);
29991      }
29992      if (element.hasCitationElement()) {
29993        composeMarkdownCore("citation", element.getCitationElement(), false);
29994        composeMarkdownExtras("citation", element.getCitationElement(), false);
29995      }
29996      if (element.hasUrlElement()) {
29997        composeUrlCore("url", element.getUrlElement(), false);
29998        composeUrlExtras("url", element.getUrlElement(), false);
29999      }
30000      if (element.hasDocument()) {
30001        composeAttachment("document", element.getDocument());
30002      }
30003      if (element.hasResourceElement()) {
30004        composeCanonicalCore("resource", element.getResourceElement(), false);
30005        composeCanonicalExtras("resource", element.getResourceElement(), false);
30006      }
30007  }
30008
30009  protected void composeAnnotation(String name, Annotation element) throws IOException {
30010    if (element != null) {
30011      open(name);
30012      composeAnnotationInner(element);
30013      close();
30014    }
30015  }
30016
30017  protected void composeAnnotationInner(Annotation element) throws IOException {
30018      composeElement(element);
30019      if (element.hasAuthor()) {
30020        composeType("author", element.getAuthor());
30021      }
30022      if (element.hasTimeElement()) {
30023        composeDateTimeCore("time", element.getTimeElement(), false);
30024        composeDateTimeExtras("time", element.getTimeElement(), false);
30025      }
30026      if (element.hasTextElement()) {
30027        composeMarkdownCore("text", element.getTextElement(), false);
30028        composeMarkdownExtras("text", element.getTextElement(), false);
30029      }
30030  }
30031
30032  protected void composeContactDetail(String name, ContactDetail element) throws IOException {
30033    if (element != null) {
30034      open(name);
30035      composeContactDetailInner(element);
30036      close();
30037    }
30038  }
30039
30040  protected void composeContactDetailInner(ContactDetail element) throws IOException {
30041      composeElement(element);
30042      if (element.hasNameElement()) {
30043        composeStringCore("name", element.getNameElement(), false);
30044        composeStringExtras("name", element.getNameElement(), false);
30045      }
30046      if (element.hasTelecom()) {
30047        openArray("telecom");
30048        for (ContactPoint e : element.getTelecom()) 
30049          composeContactPoint(null, e);
30050        closeArray();
30051      };
30052  }
30053
30054  protected void composeUsageContext(String name, UsageContext element) throws IOException {
30055    if (element != null) {
30056      open(name);
30057      composeUsageContextInner(element);
30058      close();
30059    }
30060  }
30061
30062  protected void composeUsageContextInner(UsageContext element) throws IOException {
30063      composeElement(element);
30064      if (element.hasCode()) {
30065        composeCoding("code", element.getCode());
30066      }
30067      if (element.hasValue()) {
30068        composeType("value", element.getValue());
30069      }
30070  }
30071
30072  protected void composeExpression(String name, Expression element) throws IOException {
30073    if (element != null) {
30074      open(name);
30075      composeExpressionInner(element);
30076      close();
30077    }
30078  }
30079
30080  protected void composeExpressionInner(Expression element) throws IOException {
30081      composeElement(element);
30082      if (element.hasDescriptionElement()) {
30083        composeStringCore("description", element.getDescriptionElement(), false);
30084        composeStringExtras("description", element.getDescriptionElement(), false);
30085      }
30086      if (element.hasNameElement()) {
30087        composeIdCore("name", element.getNameElement(), false);
30088        composeIdExtras("name", element.getNameElement(), false);
30089      }
30090      if (element.hasLanguageElement()) {
30091        composeCodeCore("language", element.getLanguageElement(), false);
30092        composeCodeExtras("language", element.getLanguageElement(), false);
30093      }
30094      if (element.hasExpressionElement()) {
30095        composeStringCore("expression", element.getExpressionElement(), false);
30096        composeStringExtras("expression", element.getExpressionElement(), false);
30097      }
30098      if (element.hasReferenceElement()) {
30099        composeUriCore("reference", element.getReferenceElement(), false);
30100        composeUriExtras("reference", element.getReferenceElement(), false);
30101      }
30102  }
30103
30104  protected void composeSignature(String name, Signature element) throws IOException {
30105    if (element != null) {
30106      open(name);
30107      composeSignatureInner(element);
30108      close();
30109    }
30110  }
30111
30112  protected void composeSignatureInner(Signature element) throws IOException {
30113      composeElement(element);
30114      if (element.hasType()) {
30115        openArray("type");
30116        for (Coding e : element.getType()) 
30117          composeCoding(null, e);
30118        closeArray();
30119      };
30120      if (element.hasWhenElement()) {
30121        composeInstantCore("when", element.getWhenElement(), false);
30122        composeInstantExtras("when", element.getWhenElement(), false);
30123      }
30124      if (element.hasWho()) {
30125        composeReference("who", element.getWho());
30126      }
30127      if (element.hasOnBehalfOf()) {
30128        composeReference("onBehalfOf", element.getOnBehalfOf());
30129      }
30130      if (element.hasTargetFormatElement()) {
30131        composeCodeCore("targetFormat", element.getTargetFormatElement(), false);
30132        composeCodeExtras("targetFormat", element.getTargetFormatElement(), false);
30133      }
30134      if (element.hasSigFormatElement()) {
30135        composeCodeCore("sigFormat", element.getSigFormatElement(), false);
30136        composeCodeExtras("sigFormat", element.getSigFormatElement(), false);
30137      }
30138      if (element.hasDataElement()) {
30139        composeBase64BinaryCore("data", element.getDataElement(), false);
30140        composeBase64BinaryExtras("data", element.getDataElement(), false);
30141      }
30142  }
30143
30144  protected void composeCodeableConcept(String name, CodeableConcept element) throws IOException {
30145    if (element != null) {
30146      open(name);
30147      composeCodeableConceptInner(element);
30148      close();
30149    }
30150  }
30151
30152  protected void composeCodeableConceptInner(CodeableConcept element) throws IOException {
30153      composeElement(element);
30154      if (element.hasCoding()) {
30155        openArray("coding");
30156        for (Coding e : element.getCoding()) 
30157          composeCoding(null, e);
30158        closeArray();
30159      };
30160      if (element.hasTextElement()) {
30161        composeStringCore("text", element.getTextElement(), false);
30162        composeStringExtras("text", element.getTextElement(), false);
30163      }
30164  }
30165
30166  protected void composeParameterDefinition(String name, ParameterDefinition element) throws IOException {
30167    if (element != null) {
30168      open(name);
30169      composeParameterDefinitionInner(element);
30170      close();
30171    }
30172  }
30173
30174  protected void composeParameterDefinitionInner(ParameterDefinition element) throws IOException {
30175      composeElement(element);
30176      if (element.hasNameElement()) {
30177        composeCodeCore("name", element.getNameElement(), false);
30178        composeCodeExtras("name", element.getNameElement(), false);
30179      }
30180      if (element.hasUseElement()) {
30181        composeEnumerationCore("use", element.getUseElement(), new ParameterDefinition.ParameterUseEnumFactory(), false);
30182        composeEnumerationExtras("use", element.getUseElement(), new ParameterDefinition.ParameterUseEnumFactory(), false);
30183      }
30184      if (element.hasMinElement()) {
30185        composeIntegerCore("min", element.getMinElement(), false);
30186        composeIntegerExtras("min", element.getMinElement(), false);
30187      }
30188      if (element.hasMaxElement()) {
30189        composeStringCore("max", element.getMaxElement(), false);
30190        composeStringExtras("max", element.getMaxElement(), false);
30191      }
30192      if (element.hasDocumentationElement()) {
30193        composeStringCore("documentation", element.getDocumentationElement(), false);
30194        composeStringExtras("documentation", element.getDocumentationElement(), false);
30195      }
30196      if (element.hasTypeElement()) {
30197        composeCodeCore("type", element.getTypeElement(), false);
30198        composeCodeExtras("type", element.getTypeElement(), false);
30199      }
30200      if (element.hasProfileElement()) {
30201        composeCanonicalCore("profile", element.getProfileElement(), false);
30202        composeCanonicalExtras("profile", element.getProfileElement(), false);
30203      }
30204  }
30205
30206  protected void composeElementDefinition(String name, ElementDefinition element) throws IOException {
30207    if (element != null) {
30208      open(name);
30209      composeElementDefinitionInner(element);
30210      close();
30211    }
30212  }
30213
30214  protected void composeElementDefinitionInner(ElementDefinition element) throws IOException {
30215      composeBackbone(element);
30216      if (element.hasPathElement()) {
30217        composeStringCore("path", element.getPathElement(), false);
30218        composeStringExtras("path", element.getPathElement(), false);
30219      }
30220      if (element.hasRepresentation()) {
30221        openArray("representation");
30222        for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
30223          composeEnumerationCore(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
30224        closeArray();
30225        if (anyHasExtras(element.getRepresentation())) {
30226          openArray("_representation");
30227          for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
30228            composeEnumerationExtras(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
30229          closeArray();
30230        }
30231      };
30232      if (element.hasSliceNameElement()) {
30233        composeStringCore("sliceName", element.getSliceNameElement(), false);
30234        composeStringExtras("sliceName", element.getSliceNameElement(), false);
30235      }
30236      if (element.hasSliceIsConstrainingElement()) {
30237        composeBooleanCore("sliceIsConstraining", element.getSliceIsConstrainingElement(), false);
30238        composeBooleanExtras("sliceIsConstraining", element.getSliceIsConstrainingElement(), false);
30239      }
30240      if (element.hasLabelElement()) {
30241        composeStringCore("label", element.getLabelElement(), false);
30242        composeStringExtras("label", element.getLabelElement(), false);
30243      }
30244      if (element.hasCode()) {
30245        openArray("code");
30246        for (Coding e : element.getCode()) 
30247          composeCoding(null, e);
30248        closeArray();
30249      };
30250      if (element.hasSlicing()) {
30251        composeElementDefinitionElementDefinitionSlicingComponent("slicing", element.getSlicing());
30252      }
30253      if (element.hasShortElement()) {
30254        composeStringCore("short", element.getShortElement(), false);
30255        composeStringExtras("short", element.getShortElement(), false);
30256      }
30257      if (element.hasDefinitionElement()) {
30258        composeMarkdownCore("definition", element.getDefinitionElement(), false);
30259        composeMarkdownExtras("definition", element.getDefinitionElement(), false);
30260      }
30261      if (element.hasCommentElement()) {
30262        composeMarkdownCore("comment", element.getCommentElement(), false);
30263        composeMarkdownExtras("comment", element.getCommentElement(), false);
30264      }
30265      if (element.hasRequirementsElement()) {
30266        composeMarkdownCore("requirements", element.getRequirementsElement(), false);
30267        composeMarkdownExtras("requirements", element.getRequirementsElement(), false);
30268      }
30269      if (element.hasAlias()) {
30270        openArray("alias");
30271        for (StringType e : element.getAlias()) 
30272          composeStringCore(null, e, true);
30273        closeArray();
30274        if (anyHasExtras(element.getAlias())) {
30275          openArray("_alias");
30276          for (StringType e : element.getAlias()) 
30277            composeStringExtras(null, e, true);
30278          closeArray();
30279        }
30280      };
30281      if (element.hasMinElement()) {
30282        composeUnsignedIntCore("min", element.getMinElement(), false);
30283        composeUnsignedIntExtras("min", element.getMinElement(), false);
30284      }
30285      if (element.hasMaxElement()) {
30286        composeStringCore("max", element.getMaxElement(), false);
30287        composeStringExtras("max", element.getMaxElement(), false);
30288      }
30289      if (element.hasBase()) {
30290        composeElementDefinitionElementDefinitionBaseComponent("base", element.getBase());
30291      }
30292      if (element.hasContentReferenceElement()) {
30293        composeUriCore("contentReference", element.getContentReferenceElement(), false);
30294        composeUriExtras("contentReference", element.getContentReferenceElement(), false);
30295      }
30296      if (element.hasType()) {
30297        openArray("type");
30298        for (ElementDefinition.TypeRefComponent e : element.getType()) 
30299          composeElementDefinitionTypeRefComponent(null, e);
30300        closeArray();
30301      };
30302      if (element.hasDefaultValue()) {
30303        composeType("defaultValue", element.getDefaultValue());
30304      }
30305      if (element.hasMeaningWhenMissingElement()) {
30306        composeMarkdownCore("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
30307        composeMarkdownExtras("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
30308      }
30309      if (element.hasOrderMeaningElement()) {
30310        composeStringCore("orderMeaning", element.getOrderMeaningElement(), false);
30311        composeStringExtras("orderMeaning", element.getOrderMeaningElement(), false);
30312      }
30313      if (element.hasFixed()) {
30314        composeType("fixed", element.getFixed());
30315      }
30316      if (element.hasPattern()) {
30317        composeType("pattern", element.getPattern());
30318      }
30319      if (element.hasExample()) {
30320        openArray("example");
30321        for (ElementDefinition.ElementDefinitionExampleComponent e : element.getExample()) 
30322          composeElementDefinitionElementDefinitionExampleComponent(null, e);
30323        closeArray();
30324      };
30325      if (element.hasMinValue()) {
30326        composeType("minValue", element.getMinValue());
30327      }
30328      if (element.hasMaxValue()) {
30329        composeType("maxValue", element.getMaxValue());
30330      }
30331      if (element.hasMaxLengthElement()) {
30332        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
30333        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
30334      }
30335      if (element.hasCondition()) {
30336        openArray("condition");
30337        for (IdType e : element.getCondition()) 
30338          composeIdCore(null, e, true);
30339        closeArray();
30340        if (anyHasExtras(element.getCondition())) {
30341          openArray("_condition");
30342          for (IdType e : element.getCondition()) 
30343            composeIdExtras(null, e, true);
30344          closeArray();
30345        }
30346      };
30347      if (element.hasConstraint()) {
30348        openArray("constraint");
30349        for (ElementDefinition.ElementDefinitionConstraintComponent e : element.getConstraint()) 
30350          composeElementDefinitionElementDefinitionConstraintComponent(null, e);
30351        closeArray();
30352      };
30353      if (element.hasMustSupportElement()) {
30354        composeBooleanCore("mustSupport", element.getMustSupportElement(), false);
30355        composeBooleanExtras("mustSupport", element.getMustSupportElement(), false);
30356      }
30357      if (element.hasIsModifierElement()) {
30358        composeBooleanCore("isModifier", element.getIsModifierElement(), false);
30359        composeBooleanExtras("isModifier", element.getIsModifierElement(), false);
30360      }
30361      if (element.hasIsModifierReasonElement()) {
30362        composeStringCore("isModifierReason", element.getIsModifierReasonElement(), false);
30363        composeStringExtras("isModifierReason", element.getIsModifierReasonElement(), false);
30364      }
30365      if (element.hasIsSummaryElement()) {
30366        composeBooleanCore("isSummary", element.getIsSummaryElement(), false);
30367        composeBooleanExtras("isSummary", element.getIsSummaryElement(), false);
30368      }
30369      if (element.hasBinding()) {
30370        composeElementDefinitionElementDefinitionBindingComponent("binding", element.getBinding());
30371      }
30372      if (element.hasMapping()) {
30373        openArray("mapping");
30374        for (ElementDefinition.ElementDefinitionMappingComponent e : element.getMapping()) 
30375          composeElementDefinitionElementDefinitionMappingComponent(null, e);
30376        closeArray();
30377      };
30378  }
30379
30380  protected void composeElementDefinitionElementDefinitionSlicingComponent(String name, ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
30381    if (element != null) {
30382      open(name);
30383      composeElementDefinitionElementDefinitionSlicingComponentInner(element);
30384      close();
30385    }
30386  }
30387
30388  protected void composeElementDefinitionElementDefinitionSlicingComponentInner(ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
30389      composeElement(element);
30390      if (element.hasDiscriminator()) {
30391        openArray("discriminator");
30392        for (ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent e : element.getDiscriminator()) 
30393          composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent(null, e);
30394        closeArray();
30395      };
30396      if (element.hasDescriptionElement()) {
30397        composeStringCore("description", element.getDescriptionElement(), false);
30398        composeStringExtras("description", element.getDescriptionElement(), false);
30399      }
30400      if (element.hasOrderedElement()) {
30401        composeBooleanCore("ordered", element.getOrderedElement(), false);
30402        composeBooleanExtras("ordered", element.getOrderedElement(), false);
30403      }
30404      if (element.hasRulesElement()) {
30405        composeEnumerationCore("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
30406        composeEnumerationExtras("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
30407      }
30408  }
30409
30410  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent(String name, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
30411    if (element != null) {
30412      open(name);
30413      composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentInner(element);
30414      close();
30415    }
30416  }
30417
30418  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentInner(ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
30419      composeElement(element);
30420      if (element.hasTypeElement()) {
30421        composeEnumerationCore("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
30422        composeEnumerationExtras("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
30423      }
30424      if (element.hasPathElement()) {
30425        composeStringCore("path", element.getPathElement(), false);
30426        composeStringExtras("path", element.getPathElement(), false);
30427      }
30428  }
30429
30430  protected void composeElementDefinitionElementDefinitionBaseComponent(String name, ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
30431    if (element != null) {
30432      open(name);
30433      composeElementDefinitionElementDefinitionBaseComponentInner(element);
30434      close();
30435    }
30436  }
30437
30438  protected void composeElementDefinitionElementDefinitionBaseComponentInner(ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
30439      composeElement(element);
30440      if (element.hasPathElement()) {
30441        composeStringCore("path", element.getPathElement(), false);
30442        composeStringExtras("path", element.getPathElement(), false);
30443      }
30444      if (element.hasMinElement()) {
30445        composeUnsignedIntCore("min", element.getMinElement(), false);
30446        composeUnsignedIntExtras("min", element.getMinElement(), false);
30447      }
30448      if (element.hasMaxElement()) {
30449        composeStringCore("max", element.getMaxElement(), false);
30450        composeStringExtras("max", element.getMaxElement(), false);
30451      }
30452  }
30453
30454  protected void composeElementDefinitionTypeRefComponent(String name, ElementDefinition.TypeRefComponent element) throws IOException {
30455    if (element != null) {
30456      open(name);
30457      composeElementDefinitionTypeRefComponentInner(element);
30458      close();
30459    }
30460  }
30461
30462  protected void composeElementDefinitionTypeRefComponentInner(ElementDefinition.TypeRefComponent element) throws IOException {
30463      composeElement(element);
30464      if (element.hasCodeElement()) {
30465        composeUriCore("code", element.getCodeElement(), false);
30466        composeUriExtras("code", element.getCodeElement(), false);
30467      }
30468      if (element.hasProfile()) {
30469        openArray("profile");
30470        for (CanonicalType e : element.getProfile()) 
30471          composeCanonicalCore(null, e, true);
30472        closeArray();
30473        if (anyHasExtras(element.getProfile())) {
30474          openArray("_profile");
30475          for (CanonicalType e : element.getProfile()) 
30476            composeCanonicalExtras(null, e, true);
30477          closeArray();
30478        }
30479      };
30480      if (element.hasTargetProfile()) {
30481        openArray("targetProfile");
30482        for (CanonicalType e : element.getTargetProfile()) 
30483          composeCanonicalCore(null, e, true);
30484        closeArray();
30485        if (anyHasExtras(element.getTargetProfile())) {
30486          openArray("_targetProfile");
30487          for (CanonicalType e : element.getTargetProfile()) 
30488            composeCanonicalExtras(null, e, true);
30489          closeArray();
30490        }
30491      };
30492      if (element.hasAggregation()) {
30493        openArray("aggregation");
30494        for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
30495          composeEnumerationCore(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
30496        closeArray();
30497        if (anyHasExtras(element.getAggregation())) {
30498          openArray("_aggregation");
30499          for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
30500            composeEnumerationExtras(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
30501          closeArray();
30502        }
30503      };
30504      if (element.hasVersioningElement()) {
30505        composeEnumerationCore("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
30506        composeEnumerationExtras("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
30507      }
30508  }
30509
30510  protected void composeElementDefinitionElementDefinitionExampleComponent(String name, ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
30511    if (element != null) {
30512      open(name);
30513      composeElementDefinitionElementDefinitionExampleComponentInner(element);
30514      close();
30515    }
30516  }
30517
30518  protected void composeElementDefinitionElementDefinitionExampleComponentInner(ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
30519      composeElement(element);
30520      if (element.hasLabelElement()) {
30521        composeStringCore("label", element.getLabelElement(), false);
30522        composeStringExtras("label", element.getLabelElement(), false);
30523      }
30524      if (element.hasValue()) {
30525        composeType("value", element.getValue());
30526      }
30527  }
30528
30529  protected void composeElementDefinitionElementDefinitionConstraintComponent(String name, ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
30530    if (element != null) {
30531      open(name);
30532      composeElementDefinitionElementDefinitionConstraintComponentInner(element);
30533      close();
30534    }
30535  }
30536
30537  protected void composeElementDefinitionElementDefinitionConstraintComponentInner(ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
30538      composeElement(element);
30539      if (element.hasKeyElement()) {
30540        composeIdCore("key", element.getKeyElement(), false);
30541        composeIdExtras("key", element.getKeyElement(), false);
30542      }
30543      if (element.hasRequirementsElement()) {
30544        composeStringCore("requirements", element.getRequirementsElement(), false);
30545        composeStringExtras("requirements", element.getRequirementsElement(), false);
30546      }
30547      if (element.hasSeverityElement()) {
30548        composeEnumerationCore("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
30549        composeEnumerationExtras("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
30550      }
30551      if (element.hasHumanElement()) {
30552        composeStringCore("human", element.getHumanElement(), false);
30553        composeStringExtras("human", element.getHumanElement(), false);
30554      }
30555      if (element.hasExpressionElement()) {
30556        composeStringCore("expression", element.getExpressionElement(), false);
30557        composeStringExtras("expression", element.getExpressionElement(), false);
30558      }
30559      if (element.hasXpathElement()) {
30560        composeStringCore("xpath", element.getXpathElement(), false);
30561        composeStringExtras("xpath", element.getXpathElement(), false);
30562      }
30563      if (element.hasSourceElement()) {
30564        composeCanonicalCore("source", element.getSourceElement(), false);
30565        composeCanonicalExtras("source", element.getSourceElement(), false);
30566      }
30567  }
30568
30569  protected void composeElementDefinitionElementDefinitionBindingComponent(String name, ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
30570    if (element != null) {
30571      open(name);
30572      composeElementDefinitionElementDefinitionBindingComponentInner(element);
30573      close();
30574    }
30575  }
30576
30577  protected void composeElementDefinitionElementDefinitionBindingComponentInner(ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
30578      composeElement(element);
30579      if (element.hasStrengthElement()) {
30580        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
30581        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
30582      }
30583      if (element.hasDescriptionElement()) {
30584        composeStringCore("description", element.getDescriptionElement(), false);
30585        composeStringExtras("description", element.getDescriptionElement(), false);
30586      }
30587      if (element.hasValueSetElement()) {
30588        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
30589        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
30590      }
30591  }
30592
30593  protected void composeElementDefinitionElementDefinitionMappingComponent(String name, ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
30594    if (element != null) {
30595      open(name);
30596      composeElementDefinitionElementDefinitionMappingComponentInner(element);
30597      close();
30598    }
30599  }
30600
30601  protected void composeElementDefinitionElementDefinitionMappingComponentInner(ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
30602      composeElement(element);
30603      if (element.hasIdentityElement()) {
30604        composeIdCore("identity", element.getIdentityElement(), false);
30605        composeIdExtras("identity", element.getIdentityElement(), false);
30606      }
30607      if (element.hasLanguageElement()) {
30608        composeCodeCore("language", element.getLanguageElement(), false);
30609        composeCodeExtras("language", element.getLanguageElement(), false);
30610      }
30611      if (element.hasMapElement()) {
30612        composeStringCore("map", element.getMapElement(), false);
30613        composeStringExtras("map", element.getMapElement(), false);
30614      }
30615      if (element.hasCommentElement()) {
30616        composeStringCore("comment", element.getCommentElement(), false);
30617        composeStringExtras("comment", element.getCommentElement(), false);
30618      }
30619  }
30620
30621  protected void composeDomainResourceElements(DomainResource element) throws IOException {
30622      composeResourceElements(element);
30623      if (element.hasText()) {
30624        composeNarrative("text", element.getText());
30625      }
30626      if (element.hasContained()) {
30627        openArray("contained");
30628        for (Resource e : element.getContained()) {
30629          open(null);
30630          composeResource(e);
30631          close();
30632        }
30633        closeArray();
30634      };
30635      if (element.hasExtension()) {
30636        openArray("extension");
30637        for (Extension e : element.getExtension()) 
30638          composeExtension(null, e);
30639        closeArray();
30640      };
30641      if (element.hasModifierExtension()) {
30642        openArray("modifierExtension");
30643        for (Extension e : element.getModifierExtension()) 
30644          composeExtension(null, e);
30645        closeArray();
30646      };
30647  }
30648
30649  protected void composeParameters(String name, Parameters element) throws IOException {
30650    if (element != null) {
30651      prop("resourceType", name);
30652      composeParametersInner(element);
30653    }
30654  }
30655
30656  protected void composeParametersInner(Parameters element) throws IOException {
30657      composeResourceElements(element);
30658      if (element.hasParameter()) {
30659        openArray("parameter");
30660        for (Parameters.ParametersParameterComponent e : element.getParameter()) 
30661          composeParametersParametersParameterComponent(null, e);
30662        closeArray();
30663      };
30664  }
30665
30666  protected void composeParametersParametersParameterComponent(String name, Parameters.ParametersParameterComponent element) throws IOException {
30667    if (element != null) {
30668      open(name);
30669      composeParametersParametersParameterComponentInner(element);
30670      close();
30671    }
30672  }
30673
30674  protected void composeParametersParametersParameterComponentInner(Parameters.ParametersParameterComponent element) throws IOException {
30675      composeBackbone(element);
30676      if (element.hasNameElement()) {
30677        composeStringCore("name", element.getNameElement(), false);
30678        composeStringExtras("name", element.getNameElement(), false);
30679      }
30680      if (element.hasValue()) {
30681        composeType("value", element.getValue());
30682      }
30683        if (element.hasResource()) {
30684          open("resource");
30685          composeResource(element.getResource());
30686          close();
30687        }
30688      if (element.hasPart()) {
30689        openArray("part");
30690        for (Parameters.ParametersParameterComponent e : element.getPart()) 
30691          composeParametersParametersParameterComponent(null, e);
30692        closeArray();
30693      };
30694  }
30695
30696  protected void composeResourceElements(Resource element) throws IOException {
30697      if (element.hasIdElement()) {
30698        composeIdCore("id", element.getIdElement(), false);
30699        composeIdExtras("id", element.getIdElement(), false);
30700      }
30701      if (element.hasMeta()) {
30702        composeMeta("meta", element.getMeta());
30703      }
30704      if (element.hasImplicitRulesElement()) {
30705        composeUriCore("implicitRules", element.getImplicitRulesElement(), false);
30706        composeUriExtras("implicitRules", element.getImplicitRulesElement(), false);
30707      }
30708      if (element.hasLanguageElement()) {
30709        composeCodeCore("language", element.getLanguageElement(), false);
30710        composeCodeExtras("language", element.getLanguageElement(), false);
30711      }
30712  }
30713
30714  protected void composeAccount(String name, Account element) throws IOException {
30715    if (element != null) {
30716      prop("resourceType", name);
30717      composeAccountInner(element);
30718    }
30719  }
30720
30721  protected void composeAccountInner(Account element) throws IOException {
30722      composeDomainResourceElements(element);
30723      if (element.hasIdentifier()) {
30724        openArray("identifier");
30725        for (Identifier e : element.getIdentifier()) 
30726          composeIdentifier(null, e);
30727        closeArray();
30728      };
30729      if (element.hasStatusElement()) {
30730        composeEnumerationCore("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
30731        composeEnumerationExtras("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
30732      }
30733      if (element.hasType()) {
30734        composeCodeableConcept("type", element.getType());
30735      }
30736      if (element.hasNameElement()) {
30737        composeStringCore("name", element.getNameElement(), false);
30738        composeStringExtras("name", element.getNameElement(), false);
30739      }
30740      if (element.hasSubject()) {
30741        openArray("subject");
30742        for (Reference e : element.getSubject()) 
30743          composeReference(null, e);
30744        closeArray();
30745      };
30746      if (element.hasServicePeriod()) {
30747        composePeriod("servicePeriod", element.getServicePeriod());
30748      }
30749      if (element.hasCoverage()) {
30750        openArray("coverage");
30751        for (Account.CoverageComponent e : element.getCoverage()) 
30752          composeAccountCoverageComponent(null, e);
30753        closeArray();
30754      };
30755      if (element.hasOwner()) {
30756        composeReference("owner", element.getOwner());
30757      }
30758      if (element.hasDescriptionElement()) {
30759        composeStringCore("description", element.getDescriptionElement(), false);
30760        composeStringExtras("description", element.getDescriptionElement(), false);
30761      }
30762      if (element.hasGuarantor()) {
30763        openArray("guarantor");
30764        for (Account.GuarantorComponent e : element.getGuarantor()) 
30765          composeAccountGuarantorComponent(null, e);
30766        closeArray();
30767      };
30768      if (element.hasPartOf()) {
30769        composeReference("partOf", element.getPartOf());
30770      }
30771  }
30772
30773  protected void composeAccountCoverageComponent(String name, Account.CoverageComponent element) throws IOException {
30774    if (element != null) {
30775      open(name);
30776      composeAccountCoverageComponentInner(element);
30777      close();
30778    }
30779  }
30780
30781  protected void composeAccountCoverageComponentInner(Account.CoverageComponent element) throws IOException {
30782      composeBackbone(element);
30783      if (element.hasCoverage()) {
30784        composeReference("coverage", element.getCoverage());
30785      }
30786      if (element.hasPriorityElement()) {
30787        composePositiveIntCore("priority", element.getPriorityElement(), false);
30788        composePositiveIntExtras("priority", element.getPriorityElement(), false);
30789      }
30790  }
30791
30792  protected void composeAccountGuarantorComponent(String name, Account.GuarantorComponent element) throws IOException {
30793    if (element != null) {
30794      open(name);
30795      composeAccountGuarantorComponentInner(element);
30796      close();
30797    }
30798  }
30799
30800  protected void composeAccountGuarantorComponentInner(Account.GuarantorComponent element) throws IOException {
30801      composeBackbone(element);
30802      if (element.hasParty()) {
30803        composeReference("party", element.getParty());
30804      }
30805      if (element.hasOnHoldElement()) {
30806        composeBooleanCore("onHold", element.getOnHoldElement(), false);
30807        composeBooleanExtras("onHold", element.getOnHoldElement(), false);
30808      }
30809      if (element.hasPeriod()) {
30810        composePeriod("period", element.getPeriod());
30811      }
30812  }
30813
30814  protected void composeActivityDefinition(String name, ActivityDefinition element) throws IOException {
30815    if (element != null) {
30816      prop("resourceType", name);
30817      composeActivityDefinitionInner(element);
30818    }
30819  }
30820
30821  protected void composeActivityDefinitionInner(ActivityDefinition element) throws IOException {
30822      composeDomainResourceElements(element);
30823      if (element.hasUrlElement()) {
30824        composeUriCore("url", element.getUrlElement(), false);
30825        composeUriExtras("url", element.getUrlElement(), false);
30826      }
30827      if (element.hasIdentifier()) {
30828        openArray("identifier");
30829        for (Identifier e : element.getIdentifier()) 
30830          composeIdentifier(null, e);
30831        closeArray();
30832      };
30833      if (element.hasVersionElement()) {
30834        composeStringCore("version", element.getVersionElement(), false);
30835        composeStringExtras("version", element.getVersionElement(), false);
30836      }
30837      if (element.hasNameElement()) {
30838        composeStringCore("name", element.getNameElement(), false);
30839        composeStringExtras("name", element.getNameElement(), false);
30840      }
30841      if (element.hasTitleElement()) {
30842        composeStringCore("title", element.getTitleElement(), false);
30843        composeStringExtras("title", element.getTitleElement(), false);
30844      }
30845      if (element.hasSubtitleElement()) {
30846        composeStringCore("subtitle", element.getSubtitleElement(), false);
30847        composeStringExtras("subtitle", element.getSubtitleElement(), false);
30848      }
30849      if (element.hasStatusElement()) {
30850        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
30851        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
30852      }
30853      if (element.hasExperimentalElement()) {
30854        composeBooleanCore("experimental", element.getExperimentalElement(), false);
30855        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
30856      }
30857      if (element.hasSubject()) {
30858        composeType("subject", element.getSubject());
30859      }
30860      if (element.hasDateElement()) {
30861        composeDateTimeCore("date", element.getDateElement(), false);
30862        composeDateTimeExtras("date", element.getDateElement(), false);
30863      }
30864      if (element.hasPublisherElement()) {
30865        composeStringCore("publisher", element.getPublisherElement(), false);
30866        composeStringExtras("publisher", element.getPublisherElement(), false);
30867      }
30868      if (element.hasContact()) {
30869        openArray("contact");
30870        for (ContactDetail e : element.getContact()) 
30871          composeContactDetail(null, e);
30872        closeArray();
30873      };
30874      if (element.hasDescriptionElement()) {
30875        composeMarkdownCore("description", element.getDescriptionElement(), false);
30876        composeMarkdownExtras("description", element.getDescriptionElement(), false);
30877      }
30878      if (element.hasUseContext()) {
30879        openArray("useContext");
30880        for (UsageContext e : element.getUseContext()) 
30881          composeUsageContext(null, e);
30882        closeArray();
30883      };
30884      if (element.hasJurisdiction()) {
30885        openArray("jurisdiction");
30886        for (CodeableConcept e : element.getJurisdiction()) 
30887          composeCodeableConcept(null, e);
30888        closeArray();
30889      };
30890      if (element.hasPurposeElement()) {
30891        composeMarkdownCore("purpose", element.getPurposeElement(), false);
30892        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
30893      }
30894      if (element.hasUsageElement()) {
30895        composeStringCore("usage", element.getUsageElement(), false);
30896        composeStringExtras("usage", element.getUsageElement(), false);
30897      }
30898      if (element.hasCopyrightElement()) {
30899        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
30900        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
30901      }
30902      if (element.hasApprovalDateElement()) {
30903        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
30904        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
30905      }
30906      if (element.hasLastReviewDateElement()) {
30907        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
30908        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
30909      }
30910      if (element.hasEffectivePeriod()) {
30911        composePeriod("effectivePeriod", element.getEffectivePeriod());
30912      }
30913      if (element.hasTopic()) {
30914        openArray("topic");
30915        for (CodeableConcept e : element.getTopic()) 
30916          composeCodeableConcept(null, e);
30917        closeArray();
30918      };
30919      if (element.hasAuthor()) {
30920        openArray("author");
30921        for (ContactDetail e : element.getAuthor()) 
30922          composeContactDetail(null, e);
30923        closeArray();
30924      };
30925      if (element.hasEditor()) {
30926        openArray("editor");
30927        for (ContactDetail e : element.getEditor()) 
30928          composeContactDetail(null, e);
30929        closeArray();
30930      };
30931      if (element.hasReviewer()) {
30932        openArray("reviewer");
30933        for (ContactDetail e : element.getReviewer()) 
30934          composeContactDetail(null, e);
30935        closeArray();
30936      };
30937      if (element.hasEndorser()) {
30938        openArray("endorser");
30939        for (ContactDetail e : element.getEndorser()) 
30940          composeContactDetail(null, e);
30941        closeArray();
30942      };
30943      if (element.hasRelatedArtifact()) {
30944        openArray("relatedArtifact");
30945        for (RelatedArtifact e : element.getRelatedArtifact()) 
30946          composeRelatedArtifact(null, e);
30947        closeArray();
30948      };
30949      if (element.hasLibrary()) {
30950        openArray("library");
30951        for (CanonicalType e : element.getLibrary()) 
30952          composeCanonicalCore(null, e, true);
30953        closeArray();
30954        if (anyHasExtras(element.getLibrary())) {
30955          openArray("_library");
30956          for (CanonicalType e : element.getLibrary()) 
30957            composeCanonicalExtras(null, e, true);
30958          closeArray();
30959        }
30960      };
30961      if (element.hasKindElement()) {
30962        composeEnumerationCore("kind", element.getKindElement(), new ActivityDefinition.ActivityDefinitionKindEnumFactory(), false);
30963        composeEnumerationExtras("kind", element.getKindElement(), new ActivityDefinition.ActivityDefinitionKindEnumFactory(), false);
30964      }
30965      if (element.hasProfileElement()) {
30966        composeCanonicalCore("profile", element.getProfileElement(), false);
30967        composeCanonicalExtras("profile", element.getProfileElement(), false);
30968      }
30969      if (element.hasCode()) {
30970        composeCodeableConcept("code", element.getCode());
30971      }
30972      if (element.hasIntentElement()) {
30973        composeEnumerationCore("intent", element.getIntentElement(), new ActivityDefinition.RequestIntentEnumFactory(), false);
30974        composeEnumerationExtras("intent", element.getIntentElement(), new ActivityDefinition.RequestIntentEnumFactory(), false);
30975      }
30976      if (element.hasPriorityElement()) {
30977        composeEnumerationCore("priority", element.getPriorityElement(), new ActivityDefinition.RequestPriorityEnumFactory(), false);
30978        composeEnumerationExtras("priority", element.getPriorityElement(), new ActivityDefinition.RequestPriorityEnumFactory(), false);
30979      }
30980      if (element.hasDoNotPerformElement()) {
30981        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
30982        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
30983      }
30984      if (element.hasTiming()) {
30985        composeType("timing", element.getTiming());
30986      }
30987      if (element.hasLocation()) {
30988        composeReference("location", element.getLocation());
30989      }
30990      if (element.hasParticipant()) {
30991        openArray("participant");
30992        for (ActivityDefinition.ActivityDefinitionParticipantComponent e : element.getParticipant()) 
30993          composeActivityDefinitionActivityDefinitionParticipantComponent(null, e);
30994        closeArray();
30995      };
30996      if (element.hasProduct()) {
30997        composeType("product", element.getProduct());
30998      }
30999      if (element.hasQuantity()) {
31000        composeQuantity("quantity", element.getQuantity());
31001      }
31002      if (element.hasDosage()) {
31003        openArray("dosage");
31004        for (Dosage e : element.getDosage()) 
31005          composeDosage(null, e);
31006        closeArray();
31007      };
31008      if (element.hasBodySite()) {
31009        openArray("bodySite");
31010        for (CodeableConcept e : element.getBodySite()) 
31011          composeCodeableConcept(null, e);
31012        closeArray();
31013      };
31014      if (element.hasSpecimenRequirement()) {
31015        openArray("specimenRequirement");
31016        for (Reference e : element.getSpecimenRequirement()) 
31017          composeReference(null, e);
31018        closeArray();
31019      };
31020      if (element.hasObservationRequirement()) {
31021        openArray("observationRequirement");
31022        for (Reference e : element.getObservationRequirement()) 
31023          composeReference(null, e);
31024        closeArray();
31025      };
31026      if (element.hasObservationResultRequirement()) {
31027        openArray("observationResultRequirement");
31028        for (Reference e : element.getObservationResultRequirement()) 
31029          composeReference(null, e);
31030        closeArray();
31031      };
31032      if (element.hasTransformElement()) {
31033        composeCanonicalCore("transform", element.getTransformElement(), false);
31034        composeCanonicalExtras("transform", element.getTransformElement(), false);
31035      }
31036      if (element.hasDynamicValue()) {
31037        openArray("dynamicValue");
31038        for (ActivityDefinition.ActivityDefinitionDynamicValueComponent e : element.getDynamicValue()) 
31039          composeActivityDefinitionActivityDefinitionDynamicValueComponent(null, e);
31040        closeArray();
31041      };
31042  }
31043
31044  protected void composeActivityDefinitionActivityDefinitionParticipantComponent(String name, ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
31045    if (element != null) {
31046      open(name);
31047      composeActivityDefinitionActivityDefinitionParticipantComponentInner(element);
31048      close();
31049    }
31050  }
31051
31052  protected void composeActivityDefinitionActivityDefinitionParticipantComponentInner(ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
31053      composeBackbone(element);
31054      if (element.hasTypeElement()) {
31055        composeEnumerationCore("type", element.getTypeElement(), new ActivityDefinition.ActivityParticipantTypeEnumFactory(), false);
31056        composeEnumerationExtras("type", element.getTypeElement(), new ActivityDefinition.ActivityParticipantTypeEnumFactory(), false);
31057      }
31058      if (element.hasRole()) {
31059        composeCodeableConcept("role", element.getRole());
31060      }
31061  }
31062
31063  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponent(String name, ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
31064    if (element != null) {
31065      open(name);
31066      composeActivityDefinitionActivityDefinitionDynamicValueComponentInner(element);
31067      close();
31068    }
31069  }
31070
31071  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponentInner(ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
31072      composeBackbone(element);
31073      if (element.hasPathElement()) {
31074        composeStringCore("path", element.getPathElement(), false);
31075        composeStringExtras("path", element.getPathElement(), false);
31076      }
31077      if (element.hasExpression()) {
31078        composeExpression("expression", element.getExpression());
31079      }
31080  }
31081
31082  protected void composeAdverseEvent(String name, AdverseEvent element) throws IOException {
31083    if (element != null) {
31084      prop("resourceType", name);
31085      composeAdverseEventInner(element);
31086    }
31087  }
31088
31089  protected void composeAdverseEventInner(AdverseEvent element) throws IOException {
31090      composeDomainResourceElements(element);
31091      if (element.hasIdentifier()) {
31092        composeIdentifier("identifier", element.getIdentifier());
31093      }
31094      if (element.hasActualityElement()) {
31095        composeEnumerationCore("actuality", element.getActualityElement(), new AdverseEvent.AdverseEventActualityEnumFactory(), false);
31096        composeEnumerationExtras("actuality", element.getActualityElement(), new AdverseEvent.AdverseEventActualityEnumFactory(), false);
31097      }
31098      if (element.hasCategory()) {
31099        openArray("category");
31100        for (CodeableConcept e : element.getCategory()) 
31101          composeCodeableConcept(null, e);
31102        closeArray();
31103      };
31104      if (element.hasEvent()) {
31105        composeCodeableConcept("event", element.getEvent());
31106      }
31107      if (element.hasSubject()) {
31108        composeReference("subject", element.getSubject());
31109      }
31110      if (element.hasEncounter()) {
31111        composeReference("encounter", element.getEncounter());
31112      }
31113      if (element.hasDateElement()) {
31114        composeDateTimeCore("date", element.getDateElement(), false);
31115        composeDateTimeExtras("date", element.getDateElement(), false);
31116      }
31117      if (element.hasDetectedElement()) {
31118        composeDateTimeCore("detected", element.getDetectedElement(), false);
31119        composeDateTimeExtras("detected", element.getDetectedElement(), false);
31120      }
31121      if (element.hasRecordedDateElement()) {
31122        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
31123        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
31124      }
31125      if (element.hasResultingCondition()) {
31126        openArray("resultingCondition");
31127        for (Reference e : element.getResultingCondition()) 
31128          composeReference(null, e);
31129        closeArray();
31130      };
31131      if (element.hasLocation()) {
31132        composeReference("location", element.getLocation());
31133      }
31134      if (element.hasSeriousness()) {
31135        composeCodeableConcept("seriousness", element.getSeriousness());
31136      }
31137      if (element.hasSeverity()) {
31138        composeCodeableConcept("severity", element.getSeverity());
31139      }
31140      if (element.hasOutcome()) {
31141        composeCodeableConcept("outcome", element.getOutcome());
31142      }
31143      if (element.hasRecorder()) {
31144        composeReference("recorder", element.getRecorder());
31145      }
31146      if (element.hasContributor()) {
31147        openArray("contributor");
31148        for (Reference e : element.getContributor()) 
31149          composeReference(null, e);
31150        closeArray();
31151      };
31152      if (element.hasSuspectEntity()) {
31153        openArray("suspectEntity");
31154        for (AdverseEvent.AdverseEventSuspectEntityComponent e : element.getSuspectEntity()) 
31155          composeAdverseEventAdverseEventSuspectEntityComponent(null, e);
31156        closeArray();
31157      };
31158      if (element.hasSubjectMedicalHistory()) {
31159        openArray("subjectMedicalHistory");
31160        for (Reference e : element.getSubjectMedicalHistory()) 
31161          composeReference(null, e);
31162        closeArray();
31163      };
31164      if (element.hasReferenceDocument()) {
31165        openArray("referenceDocument");
31166        for (Reference e : element.getReferenceDocument()) 
31167          composeReference(null, e);
31168        closeArray();
31169      };
31170      if (element.hasStudy()) {
31171        openArray("study");
31172        for (Reference e : element.getStudy()) 
31173          composeReference(null, e);
31174        closeArray();
31175      };
31176  }
31177
31178  protected void composeAdverseEventAdverseEventSuspectEntityComponent(String name, AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
31179    if (element != null) {
31180      open(name);
31181      composeAdverseEventAdverseEventSuspectEntityComponentInner(element);
31182      close();
31183    }
31184  }
31185
31186  protected void composeAdverseEventAdverseEventSuspectEntityComponentInner(AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
31187      composeBackbone(element);
31188      if (element.hasInstance()) {
31189        composeReference("instance", element.getInstance());
31190      }
31191      if (element.hasCausality()) {
31192        openArray("causality");
31193        for (AdverseEvent.AdverseEventSuspectEntityCausalityComponent e : element.getCausality()) 
31194          composeAdverseEventAdverseEventSuspectEntityCausalityComponent(null, e);
31195        closeArray();
31196      };
31197  }
31198
31199  protected void composeAdverseEventAdverseEventSuspectEntityCausalityComponent(String name, AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
31200    if (element != null) {
31201      open(name);
31202      composeAdverseEventAdverseEventSuspectEntityCausalityComponentInner(element);
31203      close();
31204    }
31205  }
31206
31207  protected void composeAdverseEventAdverseEventSuspectEntityCausalityComponentInner(AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
31208      composeBackbone(element);
31209      if (element.hasAssessment()) {
31210        composeCodeableConcept("assessment", element.getAssessment());
31211      }
31212      if (element.hasProductRelatednessElement()) {
31213        composeStringCore("productRelatedness", element.getProductRelatednessElement(), false);
31214        composeStringExtras("productRelatedness", element.getProductRelatednessElement(), false);
31215      }
31216      if (element.hasAuthor()) {
31217        composeReference("author", element.getAuthor());
31218      }
31219      if (element.hasMethod()) {
31220        composeCodeableConcept("method", element.getMethod());
31221      }
31222  }
31223
31224  protected void composeAllergyIntolerance(String name, AllergyIntolerance element) throws IOException {
31225    if (element != null) {
31226      prop("resourceType", name);
31227      composeAllergyIntoleranceInner(element);
31228    }
31229  }
31230
31231  protected void composeAllergyIntoleranceInner(AllergyIntolerance element) throws IOException {
31232      composeDomainResourceElements(element);
31233      if (element.hasIdentifier()) {
31234        openArray("identifier");
31235        for (Identifier e : element.getIdentifier()) 
31236          composeIdentifier(null, e);
31237        closeArray();
31238      };
31239      if (element.hasClinicalStatus()) {
31240        composeCodeableConcept("clinicalStatus", element.getClinicalStatus());
31241      }
31242      if (element.hasVerificationStatus()) {
31243        composeCodeableConcept("verificationStatus", element.getVerificationStatus());
31244      }
31245      if (element.hasTypeElement()) {
31246        composeEnumerationCore("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
31247        composeEnumerationExtras("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
31248      }
31249      if (element.hasCategory()) {
31250        openArray("category");
31251        for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
31252          composeEnumerationCore(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
31253        closeArray();
31254        if (anyHasExtras(element.getCategory())) {
31255          openArray("_category");
31256          for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
31257            composeEnumerationExtras(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
31258          closeArray();
31259        }
31260      };
31261      if (element.hasCriticalityElement()) {
31262        composeEnumerationCore("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
31263        composeEnumerationExtras("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
31264      }
31265      if (element.hasCode()) {
31266        composeCodeableConcept("code", element.getCode());
31267      }
31268      if (element.hasPatient()) {
31269        composeReference("patient", element.getPatient());
31270      }
31271      if (element.hasEncounter()) {
31272        composeReference("encounter", element.getEncounter());
31273      }
31274      if (element.hasOnset()) {
31275        composeType("onset", element.getOnset());
31276      }
31277      if (element.hasRecordedDateElement()) {
31278        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
31279        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
31280      }
31281      if (element.hasRecorder()) {
31282        composeReference("recorder", element.getRecorder());
31283      }
31284      if (element.hasAsserter()) {
31285        composeReference("asserter", element.getAsserter());
31286      }
31287      if (element.hasLastOccurrenceElement()) {
31288        composeDateTimeCore("lastOccurrence", element.getLastOccurrenceElement(), false);
31289        composeDateTimeExtras("lastOccurrence", element.getLastOccurrenceElement(), false);
31290      }
31291      if (element.hasNote()) {
31292        openArray("note");
31293        for (Annotation e : element.getNote()) 
31294          composeAnnotation(null, e);
31295        closeArray();
31296      };
31297      if (element.hasReaction()) {
31298        openArray("reaction");
31299        for (AllergyIntolerance.AllergyIntoleranceReactionComponent e : element.getReaction()) 
31300          composeAllergyIntoleranceAllergyIntoleranceReactionComponent(null, e);
31301        closeArray();
31302      };
31303  }
31304
31305  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponent(String name, AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
31306    if (element != null) {
31307      open(name);
31308      composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(element);
31309      close();
31310    }
31311  }
31312
31313  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
31314      composeBackbone(element);
31315      if (element.hasSubstance()) {
31316        composeCodeableConcept("substance", element.getSubstance());
31317      }
31318      if (element.hasManifestation()) {
31319        openArray("manifestation");
31320        for (CodeableConcept e : element.getManifestation()) 
31321          composeCodeableConcept(null, e);
31322        closeArray();
31323      };
31324      if (element.hasDescriptionElement()) {
31325        composeStringCore("description", element.getDescriptionElement(), false);
31326        composeStringExtras("description", element.getDescriptionElement(), false);
31327      }
31328      if (element.hasOnsetElement()) {
31329        composeDateTimeCore("onset", element.getOnsetElement(), false);
31330        composeDateTimeExtras("onset", element.getOnsetElement(), false);
31331      }
31332      if (element.hasSeverityElement()) {
31333        composeEnumerationCore("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
31334        composeEnumerationExtras("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
31335      }
31336      if (element.hasExposureRoute()) {
31337        composeCodeableConcept("exposureRoute", element.getExposureRoute());
31338      }
31339      if (element.hasNote()) {
31340        openArray("note");
31341        for (Annotation e : element.getNote()) 
31342          composeAnnotation(null, e);
31343        closeArray();
31344      };
31345  }
31346
31347  protected void composeAppointment(String name, Appointment element) throws IOException {
31348    if (element != null) {
31349      prop("resourceType", name);
31350      composeAppointmentInner(element);
31351    }
31352  }
31353
31354  protected void composeAppointmentInner(Appointment element) throws IOException {
31355      composeDomainResourceElements(element);
31356      if (element.hasIdentifier()) {
31357        openArray("identifier");
31358        for (Identifier e : element.getIdentifier()) 
31359          composeIdentifier(null, e);
31360        closeArray();
31361      };
31362      if (element.hasStatusElement()) {
31363        composeEnumerationCore("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
31364        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
31365      }
31366      if (element.hasCancelationReason()) {
31367        composeCodeableConcept("cancelationReason", element.getCancelationReason());
31368      }
31369      if (element.hasServiceCategory()) {
31370        openArray("serviceCategory");
31371        for (CodeableConcept e : element.getServiceCategory()) 
31372          composeCodeableConcept(null, e);
31373        closeArray();
31374      };
31375      if (element.hasServiceType()) {
31376        openArray("serviceType");
31377        for (CodeableConcept e : element.getServiceType()) 
31378          composeCodeableConcept(null, e);
31379        closeArray();
31380      };
31381      if (element.hasSpecialty()) {
31382        openArray("specialty");
31383        for (CodeableConcept e : element.getSpecialty()) 
31384          composeCodeableConcept(null, e);
31385        closeArray();
31386      };
31387      if (element.hasAppointmentType()) {
31388        composeCodeableConcept("appointmentType", element.getAppointmentType());
31389      }
31390      if (element.hasReasonCode()) {
31391        openArray("reasonCode");
31392        for (CodeableConcept e : element.getReasonCode()) 
31393          composeCodeableConcept(null, e);
31394        closeArray();
31395      };
31396      if (element.hasReasonReference()) {
31397        openArray("reasonReference");
31398        for (Reference e : element.getReasonReference()) 
31399          composeReference(null, e);
31400        closeArray();
31401      };
31402      if (element.hasPriorityElement()) {
31403        composeUnsignedIntCore("priority", element.getPriorityElement(), false);
31404        composeUnsignedIntExtras("priority", element.getPriorityElement(), false);
31405      }
31406      if (element.hasDescriptionElement()) {
31407        composeStringCore("description", element.getDescriptionElement(), false);
31408        composeStringExtras("description", element.getDescriptionElement(), false);
31409      }
31410      if (element.hasSupportingInformation()) {
31411        openArray("supportingInformation");
31412        for (Reference e : element.getSupportingInformation()) 
31413          composeReference(null, e);
31414        closeArray();
31415      };
31416      if (element.hasStartElement()) {
31417        composeInstantCore("start", element.getStartElement(), false);
31418        composeInstantExtras("start", element.getStartElement(), false);
31419      }
31420      if (element.hasEndElement()) {
31421        composeInstantCore("end", element.getEndElement(), false);
31422        composeInstantExtras("end", element.getEndElement(), false);
31423      }
31424      if (element.hasMinutesDurationElement()) {
31425        composePositiveIntCore("minutesDuration", element.getMinutesDurationElement(), false);
31426        composePositiveIntExtras("minutesDuration", element.getMinutesDurationElement(), false);
31427      }
31428      if (element.hasSlot()) {
31429        openArray("slot");
31430        for (Reference e : element.getSlot()) 
31431          composeReference(null, e);
31432        closeArray();
31433      };
31434      if (element.hasCreatedElement()) {
31435        composeDateTimeCore("created", element.getCreatedElement(), false);
31436        composeDateTimeExtras("created", element.getCreatedElement(), false);
31437      }
31438      if (element.hasCommentElement()) {
31439        composeStringCore("comment", element.getCommentElement(), false);
31440        composeStringExtras("comment", element.getCommentElement(), false);
31441      }
31442      if (element.hasPatientInstructionElement()) {
31443        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
31444        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
31445      }
31446      if (element.hasBasedOn()) {
31447        openArray("basedOn");
31448        for (Reference e : element.getBasedOn()) 
31449          composeReference(null, e);
31450        closeArray();
31451      };
31452      if (element.hasParticipant()) {
31453        openArray("participant");
31454        for (Appointment.AppointmentParticipantComponent e : element.getParticipant()) 
31455          composeAppointmentAppointmentParticipantComponent(null, e);
31456        closeArray();
31457      };
31458      if (element.hasRequestedPeriod()) {
31459        openArray("requestedPeriod");
31460        for (Period e : element.getRequestedPeriod()) 
31461          composePeriod(null, e);
31462        closeArray();
31463      };
31464  }
31465
31466  protected void composeAppointmentAppointmentParticipantComponent(String name, Appointment.AppointmentParticipantComponent element) throws IOException {
31467    if (element != null) {
31468      open(name);
31469      composeAppointmentAppointmentParticipantComponentInner(element);
31470      close();
31471    }
31472  }
31473
31474  protected void composeAppointmentAppointmentParticipantComponentInner(Appointment.AppointmentParticipantComponent element) throws IOException {
31475      composeBackbone(element);
31476      if (element.hasType()) {
31477        openArray("type");
31478        for (CodeableConcept e : element.getType()) 
31479          composeCodeableConcept(null, e);
31480        closeArray();
31481      };
31482      if (element.hasActor()) {
31483        composeReference("actor", element.getActor());
31484      }
31485      if (element.hasRequiredElement()) {
31486        composeEnumerationCore("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
31487        composeEnumerationExtras("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
31488      }
31489      if (element.hasStatusElement()) {
31490        composeEnumerationCore("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
31491        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
31492      }
31493      if (element.hasPeriod()) {
31494        composePeriod("period", element.getPeriod());
31495      }
31496  }
31497
31498  protected void composeAppointmentResponse(String name, AppointmentResponse element) throws IOException {
31499    if (element != null) {
31500      prop("resourceType", name);
31501      composeAppointmentResponseInner(element);
31502    }
31503  }
31504
31505  protected void composeAppointmentResponseInner(AppointmentResponse element) throws IOException {
31506      composeDomainResourceElements(element);
31507      if (element.hasIdentifier()) {
31508        openArray("identifier");
31509        for (Identifier e : element.getIdentifier()) 
31510          composeIdentifier(null, e);
31511        closeArray();
31512      };
31513      if (element.hasAppointment()) {
31514        composeReference("appointment", element.getAppointment());
31515      }
31516      if (element.hasStartElement()) {
31517        composeInstantCore("start", element.getStartElement(), false);
31518        composeInstantExtras("start", element.getStartElement(), false);
31519      }
31520      if (element.hasEndElement()) {
31521        composeInstantCore("end", element.getEndElement(), false);
31522        composeInstantExtras("end", element.getEndElement(), false);
31523      }
31524      if (element.hasParticipantType()) {
31525        openArray("participantType");
31526        for (CodeableConcept e : element.getParticipantType()) 
31527          composeCodeableConcept(null, e);
31528        closeArray();
31529      };
31530      if (element.hasActor()) {
31531        composeReference("actor", element.getActor());
31532      }
31533      if (element.hasParticipantStatusElement()) {
31534        composeEnumerationCore("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
31535        composeEnumerationExtras("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
31536      }
31537      if (element.hasCommentElement()) {
31538        composeStringCore("comment", element.getCommentElement(), false);
31539        composeStringExtras("comment", element.getCommentElement(), false);
31540      }
31541  }
31542
31543  protected void composeAuditEvent(String name, AuditEvent element) throws IOException {
31544    if (element != null) {
31545      prop("resourceType", name);
31546      composeAuditEventInner(element);
31547    }
31548  }
31549
31550  protected void composeAuditEventInner(AuditEvent element) throws IOException {
31551      composeDomainResourceElements(element);
31552      if (element.hasType()) {
31553        composeCoding("type", element.getType());
31554      }
31555      if (element.hasSubtype()) {
31556        openArray("subtype");
31557        for (Coding e : element.getSubtype()) 
31558          composeCoding(null, e);
31559        closeArray();
31560      };
31561      if (element.hasActionElement()) {
31562        composeEnumerationCore("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
31563        composeEnumerationExtras("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
31564      }
31565      if (element.hasPeriod()) {
31566        composePeriod("period", element.getPeriod());
31567      }
31568      if (element.hasRecordedElement()) {
31569        composeInstantCore("recorded", element.getRecordedElement(), false);
31570        composeInstantExtras("recorded", element.getRecordedElement(), false);
31571      }
31572      if (element.hasOutcomeElement()) {
31573        composeEnumerationCore("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
31574        composeEnumerationExtras("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
31575      }
31576      if (element.hasOutcomeDescElement()) {
31577        composeStringCore("outcomeDesc", element.getOutcomeDescElement(), false);
31578        composeStringExtras("outcomeDesc", element.getOutcomeDescElement(), false);
31579      }
31580      if (element.hasPurposeOfEvent()) {
31581        openArray("purposeOfEvent");
31582        for (CodeableConcept e : element.getPurposeOfEvent()) 
31583          composeCodeableConcept(null, e);
31584        closeArray();
31585      };
31586      if (element.hasAgent()) {
31587        openArray("agent");
31588        for (AuditEvent.AuditEventAgentComponent e : element.getAgent()) 
31589          composeAuditEventAuditEventAgentComponent(null, e);
31590        closeArray();
31591      };
31592      if (element.hasSource()) {
31593        composeAuditEventAuditEventSourceComponent("source", element.getSource());
31594      }
31595      if (element.hasEntity()) {
31596        openArray("entity");
31597        for (AuditEvent.AuditEventEntityComponent e : element.getEntity()) 
31598          composeAuditEventAuditEventEntityComponent(null, e);
31599        closeArray();
31600      };
31601  }
31602
31603  protected void composeAuditEventAuditEventAgentComponent(String name, AuditEvent.AuditEventAgentComponent element) throws IOException {
31604    if (element != null) {
31605      open(name);
31606      composeAuditEventAuditEventAgentComponentInner(element);
31607      close();
31608    }
31609  }
31610
31611  protected void composeAuditEventAuditEventAgentComponentInner(AuditEvent.AuditEventAgentComponent element) throws IOException {
31612      composeBackbone(element);
31613      if (element.hasType()) {
31614        composeCodeableConcept("type", element.getType());
31615      }
31616      if (element.hasRole()) {
31617        openArray("role");
31618        for (CodeableConcept e : element.getRole()) 
31619          composeCodeableConcept(null, e);
31620        closeArray();
31621      };
31622      if (element.hasWho()) {
31623        composeReference("who", element.getWho());
31624      }
31625      if (element.hasAltIdElement()) {
31626        composeStringCore("altId", element.getAltIdElement(), false);
31627        composeStringExtras("altId", element.getAltIdElement(), false);
31628      }
31629      if (element.hasNameElement()) {
31630        composeStringCore("name", element.getNameElement(), false);
31631        composeStringExtras("name", element.getNameElement(), false);
31632      }
31633      if (element.hasRequestorElement()) {
31634        composeBooleanCore("requestor", element.getRequestorElement(), false);
31635        composeBooleanExtras("requestor", element.getRequestorElement(), false);
31636      }
31637      if (element.hasLocation()) {
31638        composeReference("location", element.getLocation());
31639      }
31640      if (element.hasPolicy()) {
31641        openArray("policy");
31642        for (UriType e : element.getPolicy()) 
31643          composeUriCore(null, e, true);
31644        closeArray();
31645        if (anyHasExtras(element.getPolicy())) {
31646          openArray("_policy");
31647          for (UriType e : element.getPolicy()) 
31648            composeUriExtras(null, e, true);
31649          closeArray();
31650        }
31651      };
31652      if (element.hasMedia()) {
31653        composeCoding("media", element.getMedia());
31654      }
31655      if (element.hasNetwork()) {
31656        composeAuditEventAuditEventAgentNetworkComponent("network", element.getNetwork());
31657      }
31658      if (element.hasPurposeOfUse()) {
31659        openArray("purposeOfUse");
31660        for (CodeableConcept e : element.getPurposeOfUse()) 
31661          composeCodeableConcept(null, e);
31662        closeArray();
31663      };
31664  }
31665
31666  protected void composeAuditEventAuditEventAgentNetworkComponent(String name, AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
31667    if (element != null) {
31668      open(name);
31669      composeAuditEventAuditEventAgentNetworkComponentInner(element);
31670      close();
31671    }
31672  }
31673
31674  protected void composeAuditEventAuditEventAgentNetworkComponentInner(AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
31675      composeBackbone(element);
31676      if (element.hasAddressElement()) {
31677        composeStringCore("address", element.getAddressElement(), false);
31678        composeStringExtras("address", element.getAddressElement(), false);
31679      }
31680      if (element.hasTypeElement()) {
31681        composeEnumerationCore("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
31682        composeEnumerationExtras("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
31683      }
31684  }
31685
31686  protected void composeAuditEventAuditEventSourceComponent(String name, AuditEvent.AuditEventSourceComponent element) throws IOException {
31687    if (element != null) {
31688      open(name);
31689      composeAuditEventAuditEventSourceComponentInner(element);
31690      close();
31691    }
31692  }
31693
31694  protected void composeAuditEventAuditEventSourceComponentInner(AuditEvent.AuditEventSourceComponent element) throws IOException {
31695      composeBackbone(element);
31696      if (element.hasSiteElement()) {
31697        composeStringCore("site", element.getSiteElement(), false);
31698        composeStringExtras("site", element.getSiteElement(), false);
31699      }
31700      if (element.hasObserver()) {
31701        composeReference("observer", element.getObserver());
31702      }
31703      if (element.hasType()) {
31704        openArray("type");
31705        for (Coding e : element.getType()) 
31706          composeCoding(null, e);
31707        closeArray();
31708      };
31709  }
31710
31711  protected void composeAuditEventAuditEventEntityComponent(String name, AuditEvent.AuditEventEntityComponent element) throws IOException {
31712    if (element != null) {
31713      open(name);
31714      composeAuditEventAuditEventEntityComponentInner(element);
31715      close();
31716    }
31717  }
31718
31719  protected void composeAuditEventAuditEventEntityComponentInner(AuditEvent.AuditEventEntityComponent element) throws IOException {
31720      composeBackbone(element);
31721      if (element.hasWhat()) {
31722        composeReference("what", element.getWhat());
31723      }
31724      if (element.hasType()) {
31725        composeCoding("type", element.getType());
31726      }
31727      if (element.hasRole()) {
31728        composeCoding("role", element.getRole());
31729      }
31730      if (element.hasLifecycle()) {
31731        composeCoding("lifecycle", element.getLifecycle());
31732      }
31733      if (element.hasSecurityLabel()) {
31734        openArray("securityLabel");
31735        for (Coding e : element.getSecurityLabel()) 
31736          composeCoding(null, e);
31737        closeArray();
31738      };
31739      if (element.hasNameElement()) {
31740        composeStringCore("name", element.getNameElement(), false);
31741        composeStringExtras("name", element.getNameElement(), false);
31742      }
31743      if (element.hasDescriptionElement()) {
31744        composeStringCore("description", element.getDescriptionElement(), false);
31745        composeStringExtras("description", element.getDescriptionElement(), false);
31746      }
31747      if (element.hasQueryElement()) {
31748        composeBase64BinaryCore("query", element.getQueryElement(), false);
31749        composeBase64BinaryExtras("query", element.getQueryElement(), false);
31750      }
31751      if (element.hasDetail()) {
31752        openArray("detail");
31753        for (AuditEvent.AuditEventEntityDetailComponent e : element.getDetail()) 
31754          composeAuditEventAuditEventEntityDetailComponent(null, e);
31755        closeArray();
31756      };
31757  }
31758
31759  protected void composeAuditEventAuditEventEntityDetailComponent(String name, AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
31760    if (element != null) {
31761      open(name);
31762      composeAuditEventAuditEventEntityDetailComponentInner(element);
31763      close();
31764    }
31765  }
31766
31767  protected void composeAuditEventAuditEventEntityDetailComponentInner(AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
31768      composeBackbone(element);
31769      if (element.hasTypeElement()) {
31770        composeStringCore("type", element.getTypeElement(), false);
31771        composeStringExtras("type", element.getTypeElement(), false);
31772      }
31773      if (element.hasValue()) {
31774        composeType("value", element.getValue());
31775      }
31776  }
31777
31778  protected void composeBasic(String name, Basic element) throws IOException {
31779    if (element != null) {
31780      prop("resourceType", name);
31781      composeBasicInner(element);
31782    }
31783  }
31784
31785  protected void composeBasicInner(Basic element) throws IOException {
31786      composeDomainResourceElements(element);
31787      if (element.hasIdentifier()) {
31788        openArray("identifier");
31789        for (Identifier e : element.getIdentifier()) 
31790          composeIdentifier(null, e);
31791        closeArray();
31792      };
31793      if (element.hasCode()) {
31794        composeCodeableConcept("code", element.getCode());
31795      }
31796      if (element.hasSubject()) {
31797        composeReference("subject", element.getSubject());
31798      }
31799      if (element.hasCreatedElement()) {
31800        composeDateCore("created", element.getCreatedElement(), false);
31801        composeDateExtras("created", element.getCreatedElement(), false);
31802      }
31803      if (element.hasAuthor()) {
31804        composeReference("author", element.getAuthor());
31805      }
31806  }
31807
31808  protected void composeBinary(String name, Binary element) throws IOException {
31809    if (element != null) {
31810      prop("resourceType", name);
31811      composeBinaryInner(element);
31812    }
31813  }
31814
31815  protected void composeBinaryInner(Binary element) throws IOException {
31816      composeResourceElements(element);
31817      if (element.hasContentTypeElement()) {
31818        composeCodeCore("contentType", element.getContentTypeElement(), false);
31819        composeCodeExtras("contentType", element.getContentTypeElement(), false);
31820      }
31821      if (element.hasSecurityContext()) {
31822        composeReference("securityContext", element.getSecurityContext());
31823      }
31824      if (element.hasDataElement()) {
31825        composeBase64BinaryCore("data", element.getDataElement(), false);
31826        composeBase64BinaryExtras("data", element.getDataElement(), false);
31827      }
31828  }
31829
31830  protected void composeBiologicallyDerivedProduct(String name, BiologicallyDerivedProduct element) throws IOException {
31831    if (element != null) {
31832      prop("resourceType", name);
31833      composeBiologicallyDerivedProductInner(element);
31834    }
31835  }
31836
31837  protected void composeBiologicallyDerivedProductInner(BiologicallyDerivedProduct element) throws IOException {
31838      composeDomainResourceElements(element);
31839      if (element.hasIdentifier()) {
31840        openArray("identifier");
31841        for (Identifier e : element.getIdentifier()) 
31842          composeIdentifier(null, e);
31843        closeArray();
31844      };
31845      if (element.hasProductCategoryElement()) {
31846        composeEnumerationCore("productCategory", element.getProductCategoryElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory(), false);
31847        composeEnumerationExtras("productCategory", element.getProductCategoryElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory(), false);
31848      }
31849      if (element.hasProductCode()) {
31850        composeCodeableConcept("productCode", element.getProductCode());
31851      }
31852      if (element.hasStatusElement()) {
31853        composeEnumerationCore("status", element.getStatusElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory(), false);
31854        composeEnumerationExtras("status", element.getStatusElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory(), false);
31855      }
31856      if (element.hasRequest()) {
31857        openArray("request");
31858        for (Reference e : element.getRequest()) 
31859          composeReference(null, e);
31860        closeArray();
31861      };
31862      if (element.hasQuantityElement()) {
31863        composeIntegerCore("quantity", element.getQuantityElement(), false);
31864        composeIntegerExtras("quantity", element.getQuantityElement(), false);
31865      }
31866      if (element.hasParent()) {
31867        openArray("parent");
31868        for (Reference e : element.getParent()) 
31869          composeReference(null, e);
31870        closeArray();
31871      };
31872      if (element.hasCollection()) {
31873        composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent("collection", element.getCollection());
31874      }
31875      if (element.hasProcessing()) {
31876        openArray("processing");
31877        for (BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent e : element.getProcessing()) 
31878          composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(null, e);
31879        closeArray();
31880      };
31881      if (element.hasManipulation()) {
31882        composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent("manipulation", element.getManipulation());
31883      }
31884      if (element.hasStorage()) {
31885        openArray("storage");
31886        for (BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent e : element.getStorage()) 
31887          composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(null, e);
31888        closeArray();
31889      };
31890  }
31891
31892  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
31893    if (element != null) {
31894      open(name);
31895      composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentInner(element);
31896      close();
31897    }
31898  }
31899
31900  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
31901      composeBackbone(element);
31902      if (element.hasCollector()) {
31903        composeReference("collector", element.getCollector());
31904      }
31905      if (element.hasSource()) {
31906        composeReference("source", element.getSource());
31907      }
31908      if (element.hasCollected()) {
31909        composeType("collected", element.getCollected());
31910      }
31911  }
31912
31913  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent element) throws IOException {
31914    if (element != null) {
31915      open(name);
31916      composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentInner(element);
31917      close();
31918    }
31919  }
31920
31921  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent element) throws IOException {
31922      composeBackbone(element);
31923      if (element.hasDescriptionElement()) {
31924        composeStringCore("description", element.getDescriptionElement(), false);
31925        composeStringExtras("description", element.getDescriptionElement(), false);
31926      }
31927      if (element.hasProcedure()) {
31928        composeCodeableConcept("procedure", element.getProcedure());
31929      }
31930      if (element.hasAdditive()) {
31931        composeReference("additive", element.getAdditive());
31932      }
31933      if (element.hasTime()) {
31934        composeType("time", element.getTime());
31935      }
31936  }
31937
31938  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent element) throws IOException {
31939    if (element != null) {
31940      open(name);
31941      composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentInner(element);
31942      close();
31943    }
31944  }
31945
31946  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent element) throws IOException {
31947      composeBackbone(element);
31948      if (element.hasDescriptionElement()) {
31949        composeStringCore("description", element.getDescriptionElement(), false);
31950        composeStringExtras("description", element.getDescriptionElement(), false);
31951      }
31952      if (element.hasTime()) {
31953        composeType("time", element.getTime());
31954      }
31955  }
31956
31957  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent element) throws IOException {
31958    if (element != null) {
31959      open(name);
31960      composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentInner(element);
31961      close();
31962    }
31963  }
31964
31965  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent element) throws IOException {
31966      composeBackbone(element);
31967      if (element.hasDescriptionElement()) {
31968        composeStringCore("description", element.getDescriptionElement(), false);
31969        composeStringExtras("description", element.getDescriptionElement(), false);
31970      }
31971      if (element.hasTemperatureElement()) {
31972        composeDecimalCore("temperature", element.getTemperatureElement(), false);
31973        composeDecimalExtras("temperature", element.getTemperatureElement(), false);
31974      }
31975      if (element.hasScaleElement()) {
31976        composeEnumerationCore("scale", element.getScaleElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory(), false);
31977        composeEnumerationExtras("scale", element.getScaleElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory(), false);
31978      }
31979      if (element.hasDuration()) {
31980        composePeriod("duration", element.getDuration());
31981      }
31982  }
31983
31984  protected void composeBodyStructure(String name, BodyStructure element) throws IOException {
31985    if (element != null) {
31986      prop("resourceType", name);
31987      composeBodyStructureInner(element);
31988    }
31989  }
31990
31991  protected void composeBodyStructureInner(BodyStructure element) throws IOException {
31992      composeDomainResourceElements(element);
31993      if (element.hasIdentifier()) {
31994        openArray("identifier");
31995        for (Identifier e : element.getIdentifier()) 
31996          composeIdentifier(null, e);
31997        closeArray();
31998      };
31999      if (element.hasActiveElement()) {
32000        composeBooleanCore("active", element.getActiveElement(), false);
32001        composeBooleanExtras("active", element.getActiveElement(), false);
32002      }
32003      if (element.hasMorphology()) {
32004        composeCodeableConcept("morphology", element.getMorphology());
32005      }
32006      if (element.hasLocation()) {
32007        composeCodeableConcept("location", element.getLocation());
32008      }
32009      if (element.hasLocationQualifier()) {
32010        openArray("locationQualifier");
32011        for (CodeableConcept e : element.getLocationQualifier()) 
32012          composeCodeableConcept(null, e);
32013        closeArray();
32014      };
32015      if (element.hasDescriptionElement()) {
32016        composeStringCore("description", element.getDescriptionElement(), false);
32017        composeStringExtras("description", element.getDescriptionElement(), false);
32018      }
32019      if (element.hasImage()) {
32020        openArray("image");
32021        for (Attachment e : element.getImage()) 
32022          composeAttachment(null, e);
32023        closeArray();
32024      };
32025      if (element.hasPatient()) {
32026        composeReference("patient", element.getPatient());
32027      }
32028  }
32029
32030  protected void composeBundle(String name, Bundle element) throws IOException {
32031    if (element != null) {
32032      prop("resourceType", name);
32033      composeBundleInner(element);
32034    }
32035  }
32036
32037  protected void composeBundleInner(Bundle element) throws IOException {
32038      composeResourceElements(element);
32039      if (element.hasIdentifier()) {
32040        composeIdentifier("identifier", element.getIdentifier());
32041      }
32042      if (element.hasTypeElement()) {
32043        composeEnumerationCore("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
32044        composeEnumerationExtras("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
32045      }
32046      if (element.hasTimestampElement()) {
32047        composeInstantCore("timestamp", element.getTimestampElement(), false);
32048        composeInstantExtras("timestamp", element.getTimestampElement(), false);
32049      }
32050      if (element.hasTotalElement()) {
32051        composeUnsignedIntCore("total", element.getTotalElement(), false);
32052        composeUnsignedIntExtras("total", element.getTotalElement(), false);
32053      }
32054      if (element.hasLink()) {
32055        openArray("link");
32056        for (Bundle.BundleLinkComponent e : element.getLink()) 
32057          composeBundleBundleLinkComponent(null, e);
32058        closeArray();
32059      };
32060      if (element.hasEntry()) {
32061        openArray("entry");
32062        for (Bundle.BundleEntryComponent e : element.getEntry()) 
32063          composeBundleBundleEntryComponent(null, e);
32064        closeArray();
32065      };
32066      if (element.hasSignature()) {
32067        composeSignature("signature", element.getSignature());
32068      }
32069  }
32070
32071  protected void composeBundleBundleLinkComponent(String name, Bundle.BundleLinkComponent element) throws IOException {
32072    if (element != null) {
32073      open(name);
32074      composeBundleBundleLinkComponentInner(element);
32075      close();
32076    }
32077  }
32078
32079  protected void composeBundleBundleLinkComponentInner(Bundle.BundleLinkComponent element) throws IOException {
32080      composeBackbone(element);
32081      if (element.hasRelationElement()) {
32082        composeStringCore("relation", element.getRelationElement(), false);
32083        composeStringExtras("relation", element.getRelationElement(), false);
32084      }
32085      if (element.hasUrlElement()) {
32086        composeUriCore("url", element.getUrlElement(), false);
32087        composeUriExtras("url", element.getUrlElement(), false);
32088      }
32089  }
32090
32091  protected void composeBundleBundleEntryComponent(String name, Bundle.BundleEntryComponent element) throws IOException {
32092    if (element != null) {
32093      open(name);
32094      composeBundleBundleEntryComponentInner(element);
32095      close();
32096    }
32097  }
32098
32099  protected void composeBundleBundleEntryComponentInner(Bundle.BundleEntryComponent element) throws IOException {
32100      composeBackbone(element);
32101      if (element.hasLink()) {
32102        openArray("link");
32103        for (Bundle.BundleLinkComponent e : element.getLink()) 
32104          composeBundleBundleLinkComponent(null, e);
32105        closeArray();
32106      };
32107      if (element.hasFullUrlElement()) {
32108        composeUriCore("fullUrl", element.getFullUrlElement(), false);
32109        composeUriExtras("fullUrl", element.getFullUrlElement(), false);
32110      }
32111        if (element.hasResource()) {
32112          open("resource");
32113          composeResource(element.getResource());
32114          close();
32115        }
32116      if (element.hasSearch()) {
32117        composeBundleBundleEntrySearchComponent("search", element.getSearch());
32118      }
32119      if (element.hasRequest()) {
32120        composeBundleBundleEntryRequestComponent("request", element.getRequest());
32121      }
32122      if (element.hasResponse()) {
32123        composeBundleBundleEntryResponseComponent("response", element.getResponse());
32124      }
32125  }
32126
32127  protected void composeBundleBundleEntrySearchComponent(String name, Bundle.BundleEntrySearchComponent element) throws IOException {
32128    if (element != null) {
32129      open(name);
32130      composeBundleBundleEntrySearchComponentInner(element);
32131      close();
32132    }
32133  }
32134
32135  protected void composeBundleBundleEntrySearchComponentInner(Bundle.BundleEntrySearchComponent element) throws IOException {
32136      composeBackbone(element);
32137      if (element.hasModeElement()) {
32138        composeEnumerationCore("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
32139        composeEnumerationExtras("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
32140      }
32141      if (element.hasScoreElement()) {
32142        composeDecimalCore("score", element.getScoreElement(), false);
32143        composeDecimalExtras("score", element.getScoreElement(), false);
32144      }
32145  }
32146
32147  protected void composeBundleBundleEntryRequestComponent(String name, Bundle.BundleEntryRequestComponent element) throws IOException {
32148    if (element != null) {
32149      open(name);
32150      composeBundleBundleEntryRequestComponentInner(element);
32151      close();
32152    }
32153  }
32154
32155  protected void composeBundleBundleEntryRequestComponentInner(Bundle.BundleEntryRequestComponent element) throws IOException {
32156      composeBackbone(element);
32157      if (element.hasMethodElement()) {
32158        composeEnumerationCore("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
32159        composeEnumerationExtras("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
32160      }
32161      if (element.hasUrlElement()) {
32162        composeUriCore("url", element.getUrlElement(), false);
32163        composeUriExtras("url", element.getUrlElement(), false);
32164      }
32165      if (element.hasIfNoneMatchElement()) {
32166        composeStringCore("ifNoneMatch", element.getIfNoneMatchElement(), false);
32167        composeStringExtras("ifNoneMatch", element.getIfNoneMatchElement(), false);
32168      }
32169      if (element.hasIfModifiedSinceElement()) {
32170        composeInstantCore("ifModifiedSince", element.getIfModifiedSinceElement(), false);
32171        composeInstantExtras("ifModifiedSince", element.getIfModifiedSinceElement(), false);
32172      }
32173      if (element.hasIfMatchElement()) {
32174        composeStringCore("ifMatch", element.getIfMatchElement(), false);
32175        composeStringExtras("ifMatch", element.getIfMatchElement(), false);
32176      }
32177      if (element.hasIfNoneExistElement()) {
32178        composeStringCore("ifNoneExist", element.getIfNoneExistElement(), false);
32179        composeStringExtras("ifNoneExist", element.getIfNoneExistElement(), false);
32180      }
32181  }
32182
32183  protected void composeBundleBundleEntryResponseComponent(String name, Bundle.BundleEntryResponseComponent element) throws IOException {
32184    if (element != null) {
32185      open(name);
32186      composeBundleBundleEntryResponseComponentInner(element);
32187      close();
32188    }
32189  }
32190
32191  protected void composeBundleBundleEntryResponseComponentInner(Bundle.BundleEntryResponseComponent element) throws IOException {
32192      composeBackbone(element);
32193      if (element.hasStatusElement()) {
32194        composeStringCore("status", element.getStatusElement(), false);
32195        composeStringExtras("status", element.getStatusElement(), false);
32196      }
32197      if (element.hasLocationElement()) {
32198        composeUriCore("location", element.getLocationElement(), false);
32199        composeUriExtras("location", element.getLocationElement(), false);
32200      }
32201      if (element.hasEtagElement()) {
32202        composeStringCore("etag", element.getEtagElement(), false);
32203        composeStringExtras("etag", element.getEtagElement(), false);
32204      }
32205      if (element.hasLastModifiedElement()) {
32206        composeInstantCore("lastModified", element.getLastModifiedElement(), false);
32207        composeInstantExtras("lastModified", element.getLastModifiedElement(), false);
32208      }
32209        if (element.hasOutcome()) {
32210          open("outcome");
32211          composeResource(element.getOutcome());
32212          close();
32213        }
32214  }
32215
32216  protected void composeCapabilityStatement(String name, CapabilityStatement element) throws IOException {
32217    if (element != null) {
32218      prop("resourceType", name);
32219      composeCapabilityStatementInner(element);
32220    }
32221  }
32222
32223  protected void composeCapabilityStatementInner(CapabilityStatement element) throws IOException {
32224      composeDomainResourceElements(element);
32225      if (element.hasUrlElement()) {
32226        composeUriCore("url", element.getUrlElement(), false);
32227        composeUriExtras("url", element.getUrlElement(), false);
32228      }
32229      if (element.hasVersionElement()) {
32230        composeStringCore("version", element.getVersionElement(), false);
32231        composeStringExtras("version", element.getVersionElement(), false);
32232      }
32233      if (element.hasNameElement()) {
32234        composeStringCore("name", element.getNameElement(), false);
32235        composeStringExtras("name", element.getNameElement(), false);
32236      }
32237      if (element.hasTitleElement()) {
32238        composeStringCore("title", element.getTitleElement(), false);
32239        composeStringExtras("title", element.getTitleElement(), false);
32240      }
32241      if (element.hasStatusElement()) {
32242        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32243        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32244      }
32245      if (element.hasExperimentalElement()) {
32246        composeBooleanCore("experimental", element.getExperimentalElement(), false);
32247        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
32248      }
32249      if (element.hasDateElement()) {
32250        composeDateTimeCore("date", element.getDateElement(), false);
32251        composeDateTimeExtras("date", element.getDateElement(), false);
32252      }
32253      if (element.hasPublisherElement()) {
32254        composeStringCore("publisher", element.getPublisherElement(), false);
32255        composeStringExtras("publisher", element.getPublisherElement(), false);
32256      }
32257      if (element.hasContact()) {
32258        openArray("contact");
32259        for (ContactDetail e : element.getContact()) 
32260          composeContactDetail(null, e);
32261        closeArray();
32262      };
32263      if (element.hasDescriptionElement()) {
32264        composeMarkdownCore("description", element.getDescriptionElement(), false);
32265        composeMarkdownExtras("description", element.getDescriptionElement(), false);
32266      }
32267      if (element.hasUseContext()) {
32268        openArray("useContext");
32269        for (UsageContext e : element.getUseContext()) 
32270          composeUsageContext(null, e);
32271        closeArray();
32272      };
32273      if (element.hasJurisdiction()) {
32274        openArray("jurisdiction");
32275        for (CodeableConcept e : element.getJurisdiction()) 
32276          composeCodeableConcept(null, e);
32277        closeArray();
32278      };
32279      if (element.hasPurposeElement()) {
32280        composeMarkdownCore("purpose", element.getPurposeElement(), false);
32281        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
32282      }
32283      if (element.hasCopyrightElement()) {
32284        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
32285        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
32286      }
32287      if (element.hasKindElement()) {
32288        composeEnumerationCore("kind", element.getKindElement(), new CapabilityStatement.CapabilityStatementKindEnumFactory(), false);
32289        composeEnumerationExtras("kind", element.getKindElement(), new CapabilityStatement.CapabilityStatementKindEnumFactory(), false);
32290      }
32291      if (element.hasInstantiates()) {
32292        openArray("instantiates");
32293        for (CanonicalType e : element.getInstantiates()) 
32294          composeCanonicalCore(null, e, true);
32295        closeArray();
32296        if (anyHasExtras(element.getInstantiates())) {
32297          openArray("_instantiates");
32298          for (CanonicalType e : element.getInstantiates()) 
32299            composeCanonicalExtras(null, e, true);
32300          closeArray();
32301        }
32302      };
32303      if (element.hasImports()) {
32304        openArray("imports");
32305        for (CanonicalType e : element.getImports()) 
32306          composeCanonicalCore(null, e, true);
32307        closeArray();
32308        if (anyHasExtras(element.getImports())) {
32309          openArray("_imports");
32310          for (CanonicalType e : element.getImports()) 
32311            composeCanonicalExtras(null, e, true);
32312          closeArray();
32313        }
32314      };
32315      if (element.hasSoftware()) {
32316        composeCapabilityStatementCapabilityStatementSoftwareComponent("software", element.getSoftware());
32317      }
32318      if (element.hasImplementation()) {
32319        composeCapabilityStatementCapabilityStatementImplementationComponent("implementation", element.getImplementation());
32320      }
32321      if (element.hasFhirVersionElement()) {
32322        composeEnumerationCore("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
32323        composeEnumerationExtras("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
32324      }
32325      if (element.hasFormat()) {
32326        openArray("format");
32327        for (CodeType e : element.getFormat()) 
32328          composeCodeCore(null, e, true);
32329        closeArray();
32330        if (anyHasExtras(element.getFormat())) {
32331          openArray("_format");
32332          for (CodeType e : element.getFormat()) 
32333            composeCodeExtras(null, e, true);
32334          closeArray();
32335        }
32336      };
32337      if (element.hasPatchFormat()) {
32338        openArray("patchFormat");
32339        for (CodeType e : element.getPatchFormat()) 
32340          composeCodeCore(null, e, true);
32341        closeArray();
32342        if (anyHasExtras(element.getPatchFormat())) {
32343          openArray("_patchFormat");
32344          for (CodeType e : element.getPatchFormat()) 
32345            composeCodeExtras(null, e, true);
32346          closeArray();
32347        }
32348      };
32349      if (element.hasImplementationGuide()) {
32350        openArray("implementationGuide");
32351        for (CanonicalType e : element.getImplementationGuide()) 
32352          composeCanonicalCore(null, e, true);
32353        closeArray();
32354        if (anyHasExtras(element.getImplementationGuide())) {
32355          openArray("_implementationGuide");
32356          for (CanonicalType e : element.getImplementationGuide()) 
32357            composeCanonicalExtras(null, e, true);
32358          closeArray();
32359        }
32360      };
32361      if (element.hasRest()) {
32362        openArray("rest");
32363        for (CapabilityStatement.CapabilityStatementRestComponent e : element.getRest()) 
32364          composeCapabilityStatementCapabilityStatementRestComponent(null, e);
32365        closeArray();
32366      };
32367      if (element.hasMessaging()) {
32368        openArray("messaging");
32369        for (CapabilityStatement.CapabilityStatementMessagingComponent e : element.getMessaging()) 
32370          composeCapabilityStatementCapabilityStatementMessagingComponent(null, e);
32371        closeArray();
32372      };
32373      if (element.hasDocument()) {
32374        openArray("document");
32375        for (CapabilityStatement.CapabilityStatementDocumentComponent e : element.getDocument()) 
32376          composeCapabilityStatementCapabilityStatementDocumentComponent(null, e);
32377        closeArray();
32378      };
32379  }
32380
32381  protected void composeCapabilityStatementCapabilityStatementSoftwareComponent(String name, CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
32382    if (element != null) {
32383      open(name);
32384      composeCapabilityStatementCapabilityStatementSoftwareComponentInner(element);
32385      close();
32386    }
32387  }
32388
32389  protected void composeCapabilityStatementCapabilityStatementSoftwareComponentInner(CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
32390      composeBackbone(element);
32391      if (element.hasNameElement()) {
32392        composeStringCore("name", element.getNameElement(), false);
32393        composeStringExtras("name", element.getNameElement(), false);
32394      }
32395      if (element.hasVersionElement()) {
32396        composeStringCore("version", element.getVersionElement(), false);
32397        composeStringExtras("version", element.getVersionElement(), false);
32398      }
32399      if (element.hasReleaseDateElement()) {
32400        composeDateTimeCore("releaseDate", element.getReleaseDateElement(), false);
32401        composeDateTimeExtras("releaseDate", element.getReleaseDateElement(), false);
32402      }
32403  }
32404
32405  protected void composeCapabilityStatementCapabilityStatementImplementationComponent(String name, CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
32406    if (element != null) {
32407      open(name);
32408      composeCapabilityStatementCapabilityStatementImplementationComponentInner(element);
32409      close();
32410    }
32411  }
32412
32413  protected void composeCapabilityStatementCapabilityStatementImplementationComponentInner(CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
32414      composeBackbone(element);
32415      if (element.hasDescriptionElement()) {
32416        composeStringCore("description", element.getDescriptionElement(), false);
32417        composeStringExtras("description", element.getDescriptionElement(), false);
32418      }
32419      if (element.hasUrlElement()) {
32420        composeUrlCore("url", element.getUrlElement(), false);
32421        composeUrlExtras("url", element.getUrlElement(), false);
32422      }
32423      if (element.hasCustodian()) {
32424        composeReference("custodian", element.getCustodian());
32425      }
32426  }
32427
32428  protected void composeCapabilityStatementCapabilityStatementRestComponent(String name, CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
32429    if (element != null) {
32430      open(name);
32431      composeCapabilityStatementCapabilityStatementRestComponentInner(element);
32432      close();
32433    }
32434  }
32435
32436  protected void composeCapabilityStatementCapabilityStatementRestComponentInner(CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
32437      composeBackbone(element);
32438      if (element.hasModeElement()) {
32439        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
32440        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
32441      }
32442      if (element.hasDocumentationElement()) {
32443        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32444        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32445      }
32446      if (element.hasSecurity()) {
32447        composeCapabilityStatementCapabilityStatementRestSecurityComponent("security", element.getSecurity());
32448      }
32449      if (element.hasResource()) {
32450        openArray("resource");
32451        for (CapabilityStatement.CapabilityStatementRestResourceComponent e : element.getResource()) 
32452          composeCapabilityStatementCapabilityStatementRestResourceComponent(null, e);
32453        closeArray();
32454      };
32455      if (element.hasInteraction()) {
32456        openArray("interaction");
32457        for (CapabilityStatement.SystemInteractionComponent e : element.getInteraction()) 
32458          composeCapabilityStatementSystemInteractionComponent(null, e);
32459        closeArray();
32460      };
32461      if (element.hasSearchParam()) {
32462        openArray("searchParam");
32463        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
32464          composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(null, e);
32465        closeArray();
32466      };
32467      if (element.hasOperation()) {
32468        openArray("operation");
32469        for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
32470          composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(null, e);
32471        closeArray();
32472      };
32473      if (element.hasCompartment()) {
32474        openArray("compartment");
32475        for (CanonicalType e : element.getCompartment()) 
32476          composeCanonicalCore(null, e, true);
32477        closeArray();
32478        if (anyHasExtras(element.getCompartment())) {
32479          openArray("_compartment");
32480          for (CanonicalType e : element.getCompartment()) 
32481            composeCanonicalExtras(null, e, true);
32482          closeArray();
32483        }
32484      };
32485  }
32486
32487  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponent(String name, CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
32488    if (element != null) {
32489      open(name);
32490      composeCapabilityStatementCapabilityStatementRestSecurityComponentInner(element);
32491      close();
32492    }
32493  }
32494
32495  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponentInner(CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
32496      composeBackbone(element);
32497      if (element.hasCorsElement()) {
32498        composeBooleanCore("cors", element.getCorsElement(), false);
32499        composeBooleanExtras("cors", element.getCorsElement(), false);
32500      }
32501      if (element.hasService()) {
32502        openArray("service");
32503        for (CodeableConcept e : element.getService()) 
32504          composeCodeableConcept(null, e);
32505        closeArray();
32506      };
32507      if (element.hasDescriptionElement()) {
32508        composeMarkdownCore("description", element.getDescriptionElement(), false);
32509        composeMarkdownExtras("description", element.getDescriptionElement(), false);
32510      }
32511  }
32512
32513  protected void composeCapabilityStatementCapabilityStatementRestResourceComponent(String name, CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
32514    if (element != null) {
32515      open(name);
32516      composeCapabilityStatementCapabilityStatementRestResourceComponentInner(element);
32517      close();
32518    }
32519  }
32520
32521  protected void composeCapabilityStatementCapabilityStatementRestResourceComponentInner(CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
32522      composeBackbone(element);
32523      if (element.hasTypeElement()) {
32524        composeCodeCore("type", element.getTypeElement(), false);
32525        composeCodeExtras("type", element.getTypeElement(), false);
32526      }
32527      if (element.hasProfileElement()) {
32528        composeCanonicalCore("profile", element.getProfileElement(), false);
32529        composeCanonicalExtras("profile", element.getProfileElement(), false);
32530      }
32531      if (element.hasSupportedProfile()) {
32532        openArray("supportedProfile");
32533        for (CanonicalType e : element.getSupportedProfile()) 
32534          composeCanonicalCore(null, e, true);
32535        closeArray();
32536        if (anyHasExtras(element.getSupportedProfile())) {
32537          openArray("_supportedProfile");
32538          for (CanonicalType e : element.getSupportedProfile()) 
32539            composeCanonicalExtras(null, e, true);
32540          closeArray();
32541        }
32542      };
32543      if (element.hasDocumentationElement()) {
32544        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32545        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32546      }
32547      if (element.hasInteraction()) {
32548        openArray("interaction");
32549        for (CapabilityStatement.ResourceInteractionComponent e : element.getInteraction()) 
32550          composeCapabilityStatementResourceInteractionComponent(null, e);
32551        closeArray();
32552      };
32553      if (element.hasVersioningElement()) {
32554        composeEnumerationCore("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
32555        composeEnumerationExtras("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
32556      }
32557      if (element.hasReadHistoryElement()) {
32558        composeBooleanCore("readHistory", element.getReadHistoryElement(), false);
32559        composeBooleanExtras("readHistory", element.getReadHistoryElement(), false);
32560      }
32561      if (element.hasUpdateCreateElement()) {
32562        composeBooleanCore("updateCreate", element.getUpdateCreateElement(), false);
32563        composeBooleanExtras("updateCreate", element.getUpdateCreateElement(), false);
32564      }
32565      if (element.hasConditionalCreateElement()) {
32566        composeBooleanCore("conditionalCreate", element.getConditionalCreateElement(), false);
32567        composeBooleanExtras("conditionalCreate", element.getConditionalCreateElement(), false);
32568      }
32569      if (element.hasConditionalReadElement()) {
32570        composeEnumerationCore("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
32571        composeEnumerationExtras("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
32572      }
32573      if (element.hasConditionalUpdateElement()) {
32574        composeBooleanCore("conditionalUpdate", element.getConditionalUpdateElement(), false);
32575        composeBooleanExtras("conditionalUpdate", element.getConditionalUpdateElement(), false);
32576      }
32577      if (element.hasConditionalDeleteElement()) {
32578        composeEnumerationCore("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
32579        composeEnumerationExtras("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
32580      }
32581      if (element.hasReferencePolicy()) {
32582        openArray("referencePolicy");
32583        for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
32584          composeEnumerationCore(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
32585        closeArray();
32586        if (anyHasExtras(element.getReferencePolicy())) {
32587          openArray("_referencePolicy");
32588          for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
32589            composeEnumerationExtras(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
32590          closeArray();
32591        }
32592      };
32593      if (element.hasSearchInclude()) {
32594        openArray("searchInclude");
32595        for (StringType e : element.getSearchInclude()) 
32596          composeStringCore(null, e, true);
32597        closeArray();
32598        if (anyHasExtras(element.getSearchInclude())) {
32599          openArray("_searchInclude");
32600          for (StringType e : element.getSearchInclude()) 
32601            composeStringExtras(null, e, true);
32602          closeArray();
32603        }
32604      };
32605      if (element.hasSearchRevInclude()) {
32606        openArray("searchRevInclude");
32607        for (StringType e : element.getSearchRevInclude()) 
32608          composeStringCore(null, e, true);
32609        closeArray();
32610        if (anyHasExtras(element.getSearchRevInclude())) {
32611          openArray("_searchRevInclude");
32612          for (StringType e : element.getSearchRevInclude()) 
32613            composeStringExtras(null, e, true);
32614          closeArray();
32615        }
32616      };
32617      if (element.hasSearchParam()) {
32618        openArray("searchParam");
32619        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
32620          composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(null, e);
32621        closeArray();
32622      };
32623      if (element.hasOperation()) {
32624        openArray("operation");
32625        for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
32626          composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(null, e);
32627        closeArray();
32628      };
32629  }
32630
32631  protected void composeCapabilityStatementResourceInteractionComponent(String name, CapabilityStatement.ResourceInteractionComponent element) throws IOException {
32632    if (element != null) {
32633      open(name);
32634      composeCapabilityStatementResourceInteractionComponentInner(element);
32635      close();
32636    }
32637  }
32638
32639  protected void composeCapabilityStatementResourceInteractionComponentInner(CapabilityStatement.ResourceInteractionComponent element) throws IOException {
32640      composeBackbone(element);
32641      if (element.hasCodeElement()) {
32642        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
32643        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
32644      }
32645      if (element.hasDocumentationElement()) {
32646        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32647        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32648      }
32649  }
32650
32651  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(String name, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
32652    if (element != null) {
32653      open(name);
32654      composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentInner(element);
32655      close();
32656    }
32657  }
32658
32659  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentInner(CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
32660      composeBackbone(element);
32661      if (element.hasNameElement()) {
32662        composeStringCore("name", element.getNameElement(), false);
32663        composeStringExtras("name", element.getNameElement(), false);
32664      }
32665      if (element.hasDefinitionElement()) {
32666        composeCanonicalCore("definition", element.getDefinitionElement(), false);
32667        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
32668      }
32669      if (element.hasTypeElement()) {
32670        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
32671        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
32672      }
32673      if (element.hasDocumentationElement()) {
32674        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32675        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32676      }
32677  }
32678
32679  protected void composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(String name, CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
32680    if (element != null) {
32681      open(name);
32682      composeCapabilityStatementCapabilityStatementRestResourceOperationComponentInner(element);
32683      close();
32684    }
32685  }
32686
32687  protected void composeCapabilityStatementCapabilityStatementRestResourceOperationComponentInner(CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
32688      composeBackbone(element);
32689      if (element.hasNameElement()) {
32690        composeStringCore("name", element.getNameElement(), false);
32691        composeStringExtras("name", element.getNameElement(), false);
32692      }
32693      if (element.hasDefinitionElement()) {
32694        composeCanonicalCore("definition", element.getDefinitionElement(), false);
32695        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
32696      }
32697      if (element.hasDocumentationElement()) {
32698        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32699        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32700      }
32701  }
32702
32703  protected void composeCapabilityStatementSystemInteractionComponent(String name, CapabilityStatement.SystemInteractionComponent element) throws IOException {
32704    if (element != null) {
32705      open(name);
32706      composeCapabilityStatementSystemInteractionComponentInner(element);
32707      close();
32708    }
32709  }
32710
32711  protected void composeCapabilityStatementSystemInteractionComponentInner(CapabilityStatement.SystemInteractionComponent element) throws IOException {
32712      composeBackbone(element);
32713      if (element.hasCodeElement()) {
32714        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
32715        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
32716      }
32717      if (element.hasDocumentationElement()) {
32718        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32719        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32720      }
32721  }
32722
32723  protected void composeCapabilityStatementCapabilityStatementMessagingComponent(String name, CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
32724    if (element != null) {
32725      open(name);
32726      composeCapabilityStatementCapabilityStatementMessagingComponentInner(element);
32727      close();
32728    }
32729  }
32730
32731  protected void composeCapabilityStatementCapabilityStatementMessagingComponentInner(CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
32732      composeBackbone(element);
32733      if (element.hasEndpoint()) {
32734        openArray("endpoint");
32735        for (CapabilityStatement.CapabilityStatementMessagingEndpointComponent e : element.getEndpoint()) 
32736          composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(null, e);
32737        closeArray();
32738      };
32739      if (element.hasReliableCacheElement()) {
32740        composeUnsignedIntCore("reliableCache", element.getReliableCacheElement(), false);
32741        composeUnsignedIntExtras("reliableCache", element.getReliableCacheElement(), false);
32742      }
32743      if (element.hasDocumentationElement()) {
32744        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32745        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32746      }
32747      if (element.hasSupportedMessage()) {
32748        openArray("supportedMessage");
32749        for (CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent e : element.getSupportedMessage()) 
32750          composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(null, e);
32751        closeArray();
32752      };
32753  }
32754
32755  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(String name, CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
32756    if (element != null) {
32757      open(name);
32758      composeCapabilityStatementCapabilityStatementMessagingEndpointComponentInner(element);
32759      close();
32760    }
32761  }
32762
32763  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponentInner(CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
32764      composeBackbone(element);
32765      if (element.hasProtocol()) {
32766        composeCoding("protocol", element.getProtocol());
32767      }
32768      if (element.hasAddressElement()) {
32769        composeUrlCore("address", element.getAddressElement(), false);
32770        composeUrlExtras("address", element.getAddressElement(), false);
32771      }
32772  }
32773
32774  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(String name, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
32775    if (element != null) {
32776      open(name);
32777      composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentInner(element);
32778      close();
32779    }
32780  }
32781
32782  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentInner(CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
32783      composeBackbone(element);
32784      if (element.hasModeElement()) {
32785        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
32786        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
32787      }
32788      if (element.hasDefinitionElement()) {
32789        composeCanonicalCore("definition", element.getDefinitionElement(), false);
32790        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
32791      }
32792  }
32793
32794  protected void composeCapabilityStatementCapabilityStatementDocumentComponent(String name, CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
32795    if (element != null) {
32796      open(name);
32797      composeCapabilityStatementCapabilityStatementDocumentComponentInner(element);
32798      close();
32799    }
32800  }
32801
32802  protected void composeCapabilityStatementCapabilityStatementDocumentComponentInner(CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
32803      composeBackbone(element);
32804      if (element.hasModeElement()) {
32805        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
32806        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
32807      }
32808      if (element.hasDocumentationElement()) {
32809        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
32810        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
32811      }
32812      if (element.hasProfileElement()) {
32813        composeCanonicalCore("profile", element.getProfileElement(), false);
32814        composeCanonicalExtras("profile", element.getProfileElement(), false);
32815      }
32816  }
32817
32818  protected void composeCarePlan(String name, CarePlan element) throws IOException {
32819    if (element != null) {
32820      prop("resourceType", name);
32821      composeCarePlanInner(element);
32822    }
32823  }
32824
32825  protected void composeCarePlanInner(CarePlan element) throws IOException {
32826      composeDomainResourceElements(element);
32827      if (element.hasIdentifier()) {
32828        openArray("identifier");
32829        for (Identifier e : element.getIdentifier()) 
32830          composeIdentifier(null, e);
32831        closeArray();
32832      };
32833      if (element.hasInstantiatesCanonical()) {
32834        openArray("instantiatesCanonical");
32835        for (CanonicalType e : element.getInstantiatesCanonical()) 
32836          composeCanonicalCore(null, e, true);
32837        closeArray();
32838        if (anyHasExtras(element.getInstantiatesCanonical())) {
32839          openArray("_instantiatesCanonical");
32840          for (CanonicalType e : element.getInstantiatesCanonical()) 
32841            composeCanonicalExtras(null, e, true);
32842          closeArray();
32843        }
32844      };
32845      if (element.hasInstantiatesUri()) {
32846        openArray("instantiatesUri");
32847        for (UriType e : element.getInstantiatesUri()) 
32848          composeUriCore(null, e, true);
32849        closeArray();
32850        if (anyHasExtras(element.getInstantiatesUri())) {
32851          openArray("_instantiatesUri");
32852          for (UriType e : element.getInstantiatesUri()) 
32853            composeUriExtras(null, e, true);
32854          closeArray();
32855        }
32856      };
32857      if (element.hasBasedOn()) {
32858        openArray("basedOn");
32859        for (Reference e : element.getBasedOn()) 
32860          composeReference(null, e);
32861        closeArray();
32862      };
32863      if (element.hasReplaces()) {
32864        openArray("replaces");
32865        for (Reference e : element.getReplaces()) 
32866          composeReference(null, e);
32867        closeArray();
32868      };
32869      if (element.hasPartOf()) {
32870        openArray("partOf");
32871        for (Reference e : element.getPartOf()) 
32872          composeReference(null, e);
32873        closeArray();
32874      };
32875      if (element.hasStatusElement()) {
32876        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
32877        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
32878      }
32879      if (element.hasIntentElement()) {
32880        composeEnumerationCore("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
32881        composeEnumerationExtras("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
32882      }
32883      if (element.hasCategory()) {
32884        openArray("category");
32885        for (CodeableConcept e : element.getCategory()) 
32886          composeCodeableConcept(null, e);
32887        closeArray();
32888      };
32889      if (element.hasTitleElement()) {
32890        composeStringCore("title", element.getTitleElement(), false);
32891        composeStringExtras("title", element.getTitleElement(), false);
32892      }
32893      if (element.hasDescriptionElement()) {
32894        composeStringCore("description", element.getDescriptionElement(), false);
32895        composeStringExtras("description", element.getDescriptionElement(), false);
32896      }
32897      if (element.hasSubject()) {
32898        composeReference("subject", element.getSubject());
32899      }
32900      if (element.hasEncounter()) {
32901        composeReference("encounter", element.getEncounter());
32902      }
32903      if (element.hasPeriod()) {
32904        composePeriod("period", element.getPeriod());
32905      }
32906      if (element.hasCreatedElement()) {
32907        composeDateTimeCore("created", element.getCreatedElement(), false);
32908        composeDateTimeExtras("created", element.getCreatedElement(), false);
32909      }
32910      if (element.hasAuthor()) {
32911        composeReference("author", element.getAuthor());
32912      }
32913      if (element.hasContributor()) {
32914        openArray("contributor");
32915        for (Reference e : element.getContributor()) 
32916          composeReference(null, e);
32917        closeArray();
32918      };
32919      if (element.hasCareTeam()) {
32920        openArray("careTeam");
32921        for (Reference e : element.getCareTeam()) 
32922          composeReference(null, e);
32923        closeArray();
32924      };
32925      if (element.hasAddresses()) {
32926        openArray("addresses");
32927        for (Reference e : element.getAddresses()) 
32928          composeReference(null, e);
32929        closeArray();
32930      };
32931      if (element.hasSupportingInfo()) {
32932        openArray("supportingInfo");
32933        for (Reference e : element.getSupportingInfo()) 
32934          composeReference(null, e);
32935        closeArray();
32936      };
32937      if (element.hasGoal()) {
32938        openArray("goal");
32939        for (Reference e : element.getGoal()) 
32940          composeReference(null, e);
32941        closeArray();
32942      };
32943      if (element.hasActivity()) {
32944        openArray("activity");
32945        for (CarePlan.CarePlanActivityComponent e : element.getActivity()) 
32946          composeCarePlanCarePlanActivityComponent(null, e);
32947        closeArray();
32948      };
32949      if (element.hasNote()) {
32950        openArray("note");
32951        for (Annotation e : element.getNote()) 
32952          composeAnnotation(null, e);
32953        closeArray();
32954      };
32955  }
32956
32957  protected void composeCarePlanCarePlanActivityComponent(String name, CarePlan.CarePlanActivityComponent element) throws IOException {
32958    if (element != null) {
32959      open(name);
32960      composeCarePlanCarePlanActivityComponentInner(element);
32961      close();
32962    }
32963  }
32964
32965  protected void composeCarePlanCarePlanActivityComponentInner(CarePlan.CarePlanActivityComponent element) throws IOException {
32966      composeBackbone(element);
32967      if (element.hasOutcomeCodeableConcept()) {
32968        openArray("outcomeCodeableConcept");
32969        for (CodeableConcept e : element.getOutcomeCodeableConcept()) 
32970          composeCodeableConcept(null, e);
32971        closeArray();
32972      };
32973      if (element.hasOutcomeReference()) {
32974        openArray("outcomeReference");
32975        for (Reference e : element.getOutcomeReference()) 
32976          composeReference(null, e);
32977        closeArray();
32978      };
32979      if (element.hasProgress()) {
32980        openArray("progress");
32981        for (Annotation e : element.getProgress()) 
32982          composeAnnotation(null, e);
32983        closeArray();
32984      };
32985      if (element.hasReference()) {
32986        composeReference("reference", element.getReference());
32987      }
32988      if (element.hasDetail()) {
32989        composeCarePlanCarePlanActivityDetailComponent("detail", element.getDetail());
32990      }
32991  }
32992
32993  protected void composeCarePlanCarePlanActivityDetailComponent(String name, CarePlan.CarePlanActivityDetailComponent element) throws IOException {
32994    if (element != null) {
32995      open(name);
32996      composeCarePlanCarePlanActivityDetailComponentInner(element);
32997      close();
32998    }
32999  }
33000
33001  protected void composeCarePlanCarePlanActivityDetailComponentInner(CarePlan.CarePlanActivityDetailComponent element) throws IOException {
33002      composeBackbone(element);
33003      if (element.hasKindElement()) {
33004        composeEnumerationCore("kind", element.getKindElement(), new CarePlan.CarePlanActivityKindEnumFactory(), false);
33005        composeEnumerationExtras("kind", element.getKindElement(), new CarePlan.CarePlanActivityKindEnumFactory(), false);
33006      }
33007      if (element.hasInstantiatesCanonical()) {
33008        openArray("instantiatesCanonical");
33009        for (CanonicalType e : element.getInstantiatesCanonical()) 
33010          composeCanonicalCore(null, e, true);
33011        closeArray();
33012        if (anyHasExtras(element.getInstantiatesCanonical())) {
33013          openArray("_instantiatesCanonical");
33014          for (CanonicalType e : element.getInstantiatesCanonical()) 
33015            composeCanonicalExtras(null, e, true);
33016          closeArray();
33017        }
33018      };
33019      if (element.hasInstantiatesUri()) {
33020        openArray("instantiatesUri");
33021        for (UriType e : element.getInstantiatesUri()) 
33022          composeUriCore(null, e, true);
33023        closeArray();
33024        if (anyHasExtras(element.getInstantiatesUri())) {
33025          openArray("_instantiatesUri");
33026          for (UriType e : element.getInstantiatesUri()) 
33027            composeUriExtras(null, e, true);
33028          closeArray();
33029        }
33030      };
33031      if (element.hasCode()) {
33032        composeCodeableConcept("code", element.getCode());
33033      }
33034      if (element.hasReasonCode()) {
33035        openArray("reasonCode");
33036        for (CodeableConcept e : element.getReasonCode()) 
33037          composeCodeableConcept(null, e);
33038        closeArray();
33039      };
33040      if (element.hasReasonReference()) {
33041        openArray("reasonReference");
33042        for (Reference e : element.getReasonReference()) 
33043          composeReference(null, e);
33044        closeArray();
33045      };
33046      if (element.hasGoal()) {
33047        openArray("goal");
33048        for (Reference e : element.getGoal()) 
33049          composeReference(null, e);
33050        closeArray();
33051      };
33052      if (element.hasStatusElement()) {
33053        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
33054        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
33055      }
33056      if (element.hasStatusReason()) {
33057        composeCodeableConcept("statusReason", element.getStatusReason());
33058      }
33059      if (element.hasDoNotPerformElement()) {
33060        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
33061        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
33062      }
33063      if (element.hasScheduled()) {
33064        composeType("scheduled", element.getScheduled());
33065      }
33066      if (element.hasLocation()) {
33067        composeReference("location", element.getLocation());
33068      }
33069      if (element.hasPerformer()) {
33070        openArray("performer");
33071        for (Reference e : element.getPerformer()) 
33072          composeReference(null, e);
33073        closeArray();
33074      };
33075      if (element.hasProduct()) {
33076        composeType("product", element.getProduct());
33077      }
33078      if (element.hasDailyAmount()) {
33079        composeQuantity("dailyAmount", element.getDailyAmount());
33080      }
33081      if (element.hasQuantity()) {
33082        composeQuantity("quantity", element.getQuantity());
33083      }
33084      if (element.hasDescriptionElement()) {
33085        composeStringCore("description", element.getDescriptionElement(), false);
33086        composeStringExtras("description", element.getDescriptionElement(), false);
33087      }
33088  }
33089
33090  protected void composeCareTeam(String name, CareTeam element) throws IOException {
33091    if (element != null) {
33092      prop("resourceType", name);
33093      composeCareTeamInner(element);
33094    }
33095  }
33096
33097  protected void composeCareTeamInner(CareTeam element) throws IOException {
33098      composeDomainResourceElements(element);
33099      if (element.hasIdentifier()) {
33100        openArray("identifier");
33101        for (Identifier e : element.getIdentifier()) 
33102          composeIdentifier(null, e);
33103        closeArray();
33104      };
33105      if (element.hasStatusElement()) {
33106        composeEnumerationCore("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
33107        composeEnumerationExtras("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
33108      }
33109      if (element.hasCategory()) {
33110        openArray("category");
33111        for (CodeableConcept e : element.getCategory()) 
33112          composeCodeableConcept(null, e);
33113        closeArray();
33114      };
33115      if (element.hasNameElement()) {
33116        composeStringCore("name", element.getNameElement(), false);
33117        composeStringExtras("name", element.getNameElement(), false);
33118      }
33119      if (element.hasSubject()) {
33120        composeReference("subject", element.getSubject());
33121      }
33122      if (element.hasEncounter()) {
33123        composeReference("encounter", element.getEncounter());
33124      }
33125      if (element.hasPeriod()) {
33126        composePeriod("period", element.getPeriod());
33127      }
33128      if (element.hasParticipant()) {
33129        openArray("participant");
33130        for (CareTeam.CareTeamParticipantComponent e : element.getParticipant()) 
33131          composeCareTeamCareTeamParticipantComponent(null, e);
33132        closeArray();
33133      };
33134      if (element.hasReasonCode()) {
33135        openArray("reasonCode");
33136        for (CodeableConcept e : element.getReasonCode()) 
33137          composeCodeableConcept(null, e);
33138        closeArray();
33139      };
33140      if (element.hasReasonReference()) {
33141        openArray("reasonReference");
33142        for (Reference e : element.getReasonReference()) 
33143          composeReference(null, e);
33144        closeArray();
33145      };
33146      if (element.hasManagingOrganization()) {
33147        openArray("managingOrganization");
33148        for (Reference e : element.getManagingOrganization()) 
33149          composeReference(null, e);
33150        closeArray();
33151      };
33152      if (element.hasTelecom()) {
33153        openArray("telecom");
33154        for (ContactPoint e : element.getTelecom()) 
33155          composeContactPoint(null, e);
33156        closeArray();
33157      };
33158      if (element.hasNote()) {
33159        openArray("note");
33160        for (Annotation e : element.getNote()) 
33161          composeAnnotation(null, e);
33162        closeArray();
33163      };
33164  }
33165
33166  protected void composeCareTeamCareTeamParticipantComponent(String name, CareTeam.CareTeamParticipantComponent element) throws IOException {
33167    if (element != null) {
33168      open(name);
33169      composeCareTeamCareTeamParticipantComponentInner(element);
33170      close();
33171    }
33172  }
33173
33174  protected void composeCareTeamCareTeamParticipantComponentInner(CareTeam.CareTeamParticipantComponent element) throws IOException {
33175      composeBackbone(element);
33176      if (element.hasRole()) {
33177        openArray("role");
33178        for (CodeableConcept e : element.getRole()) 
33179          composeCodeableConcept(null, e);
33180        closeArray();
33181      };
33182      if (element.hasMember()) {
33183        composeReference("member", element.getMember());
33184      }
33185      if (element.hasOnBehalfOf()) {
33186        composeReference("onBehalfOf", element.getOnBehalfOf());
33187      }
33188      if (element.hasPeriod()) {
33189        composePeriod("period", element.getPeriod());
33190      }
33191  }
33192
33193  protected void composeCatalogEntry(String name, CatalogEntry element) throws IOException {
33194    if (element != null) {
33195      prop("resourceType", name);
33196      composeCatalogEntryInner(element);
33197    }
33198  }
33199
33200  protected void composeCatalogEntryInner(CatalogEntry element) throws IOException {
33201      composeDomainResourceElements(element);
33202      if (element.hasIdentifier()) {
33203        openArray("identifier");
33204        for (Identifier e : element.getIdentifier()) 
33205          composeIdentifier(null, e);
33206        closeArray();
33207      };
33208      if (element.hasType()) {
33209        composeCodeableConcept("type", element.getType());
33210      }
33211      if (element.hasOrderableElement()) {
33212        composeBooleanCore("orderable", element.getOrderableElement(), false);
33213        composeBooleanExtras("orderable", element.getOrderableElement(), false);
33214      }
33215      if (element.hasReferencedItem()) {
33216        composeReference("referencedItem", element.getReferencedItem());
33217      }
33218      if (element.hasAdditionalIdentifier()) {
33219        openArray("additionalIdentifier");
33220        for (Identifier e : element.getAdditionalIdentifier()) 
33221          composeIdentifier(null, e);
33222        closeArray();
33223      };
33224      if (element.hasClassification()) {
33225        openArray("classification");
33226        for (CodeableConcept e : element.getClassification()) 
33227          composeCodeableConcept(null, e);
33228        closeArray();
33229      };
33230      if (element.hasStatusElement()) {
33231        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
33232        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
33233      }
33234      if (element.hasValidityPeriod()) {
33235        composePeriod("validityPeriod", element.getValidityPeriod());
33236      }
33237      if (element.hasValidToElement()) {
33238        composeDateTimeCore("validTo", element.getValidToElement(), false);
33239        composeDateTimeExtras("validTo", element.getValidToElement(), false);
33240      }
33241      if (element.hasLastUpdatedElement()) {
33242        composeDateTimeCore("lastUpdated", element.getLastUpdatedElement(), false);
33243        composeDateTimeExtras("lastUpdated", element.getLastUpdatedElement(), false);
33244      }
33245      if (element.hasAdditionalCharacteristic()) {
33246        openArray("additionalCharacteristic");
33247        for (CodeableConcept e : element.getAdditionalCharacteristic()) 
33248          composeCodeableConcept(null, e);
33249        closeArray();
33250      };
33251      if (element.hasAdditionalClassification()) {
33252        openArray("additionalClassification");
33253        for (CodeableConcept e : element.getAdditionalClassification()) 
33254          composeCodeableConcept(null, e);
33255        closeArray();
33256      };
33257      if (element.hasRelatedEntry()) {
33258        openArray("relatedEntry");
33259        for (CatalogEntry.CatalogEntryRelatedEntryComponent e : element.getRelatedEntry()) 
33260          composeCatalogEntryCatalogEntryRelatedEntryComponent(null, e);
33261        closeArray();
33262      };
33263  }
33264
33265  protected void composeCatalogEntryCatalogEntryRelatedEntryComponent(String name, CatalogEntry.CatalogEntryRelatedEntryComponent element) throws IOException {
33266    if (element != null) {
33267      open(name);
33268      composeCatalogEntryCatalogEntryRelatedEntryComponentInner(element);
33269      close();
33270    }
33271  }
33272
33273  protected void composeCatalogEntryCatalogEntryRelatedEntryComponentInner(CatalogEntry.CatalogEntryRelatedEntryComponent element) throws IOException {
33274      composeBackbone(element);
33275      if (element.hasRelationtypeElement()) {
33276        composeEnumerationCore("relationtype", element.getRelationtypeElement(), new CatalogEntry.CatalogEntryRelationTypeEnumFactory(), false);
33277        composeEnumerationExtras("relationtype", element.getRelationtypeElement(), new CatalogEntry.CatalogEntryRelationTypeEnumFactory(), false);
33278      }
33279      if (element.hasItem()) {
33280        composeReference("item", element.getItem());
33281      }
33282  }
33283
33284  protected void composeChargeItem(String name, ChargeItem element) throws IOException {
33285    if (element != null) {
33286      prop("resourceType", name);
33287      composeChargeItemInner(element);
33288    }
33289  }
33290
33291  protected void composeChargeItemInner(ChargeItem element) throws IOException {
33292      composeDomainResourceElements(element);
33293      if (element.hasIdentifier()) {
33294        openArray("identifier");
33295        for (Identifier e : element.getIdentifier()) 
33296          composeIdentifier(null, e);
33297        closeArray();
33298      };
33299      if (element.hasDefinitionUri()) {
33300        openArray("definitionUri");
33301        for (UriType e : element.getDefinitionUri()) 
33302          composeUriCore(null, e, true);
33303        closeArray();
33304        if (anyHasExtras(element.getDefinitionUri())) {
33305          openArray("_definitionUri");
33306          for (UriType e : element.getDefinitionUri()) 
33307            composeUriExtras(null, e, true);
33308          closeArray();
33309        }
33310      };
33311      if (element.hasDefinitionCanonical()) {
33312        openArray("definitionCanonical");
33313        for (CanonicalType e : element.getDefinitionCanonical()) 
33314          composeCanonicalCore(null, e, true);
33315        closeArray();
33316        if (anyHasExtras(element.getDefinitionCanonical())) {
33317          openArray("_definitionCanonical");
33318          for (CanonicalType e : element.getDefinitionCanonical()) 
33319            composeCanonicalExtras(null, e, true);
33320          closeArray();
33321        }
33322      };
33323      if (element.hasStatusElement()) {
33324        composeEnumerationCore("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
33325        composeEnumerationExtras("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
33326      }
33327      if (element.hasPartOf()) {
33328        openArray("partOf");
33329        for (Reference e : element.getPartOf()) 
33330          composeReference(null, e);
33331        closeArray();
33332      };
33333      if (element.hasCode()) {
33334        composeCodeableConcept("code", element.getCode());
33335      }
33336      if (element.hasSubject()) {
33337        composeReference("subject", element.getSubject());
33338      }
33339      if (element.hasContext()) {
33340        composeReference("context", element.getContext());
33341      }
33342      if (element.hasOccurrence()) {
33343        composeType("occurrence", element.getOccurrence());
33344      }
33345      if (element.hasPerformer()) {
33346        openArray("performer");
33347        for (ChargeItem.ChargeItemPerformerComponent e : element.getPerformer()) 
33348          composeChargeItemChargeItemPerformerComponent(null, e);
33349        closeArray();
33350      };
33351      if (element.hasPerformingOrganization()) {
33352        composeReference("performingOrganization", element.getPerformingOrganization());
33353      }
33354      if (element.hasRequestingOrganization()) {
33355        composeReference("requestingOrganization", element.getRequestingOrganization());
33356      }
33357      if (element.hasCostCenter()) {
33358        composeReference("costCenter", element.getCostCenter());
33359      }
33360      if (element.hasQuantity()) {
33361        composeQuantity("quantity", element.getQuantity());
33362      }
33363      if (element.hasBodysite()) {
33364        openArray("bodysite");
33365        for (CodeableConcept e : element.getBodysite()) 
33366          composeCodeableConcept(null, e);
33367        closeArray();
33368      };
33369      if (element.hasFactorOverrideElement()) {
33370        composeDecimalCore("factorOverride", element.getFactorOverrideElement(), false);
33371        composeDecimalExtras("factorOverride", element.getFactorOverrideElement(), false);
33372      }
33373      if (element.hasPriceOverride()) {
33374        composeMoney("priceOverride", element.getPriceOverride());
33375      }
33376      if (element.hasOverrideReasonElement()) {
33377        composeStringCore("overrideReason", element.getOverrideReasonElement(), false);
33378        composeStringExtras("overrideReason", element.getOverrideReasonElement(), false);
33379      }
33380      if (element.hasEnterer()) {
33381        composeReference("enterer", element.getEnterer());
33382      }
33383      if (element.hasEnteredDateElement()) {
33384        composeDateTimeCore("enteredDate", element.getEnteredDateElement(), false);
33385        composeDateTimeExtras("enteredDate", element.getEnteredDateElement(), false);
33386      }
33387      if (element.hasReason()) {
33388        openArray("reason");
33389        for (CodeableConcept e : element.getReason()) 
33390          composeCodeableConcept(null, e);
33391        closeArray();
33392      };
33393      if (element.hasService()) {
33394        openArray("service");
33395        for (Reference e : element.getService()) 
33396          composeReference(null, e);
33397        closeArray();
33398      };
33399      if (element.hasProduct()) {
33400        composeType("product", element.getProduct());
33401      }
33402      if (element.hasAccount()) {
33403        openArray("account");
33404        for (Reference e : element.getAccount()) 
33405          composeReference(null, e);
33406        closeArray();
33407      };
33408      if (element.hasNote()) {
33409        openArray("note");
33410        for (Annotation e : element.getNote()) 
33411          composeAnnotation(null, e);
33412        closeArray();
33413      };
33414      if (element.hasSupportingInformation()) {
33415        openArray("supportingInformation");
33416        for (Reference e : element.getSupportingInformation()) 
33417          composeReference(null, e);
33418        closeArray();
33419      };
33420  }
33421
33422  protected void composeChargeItemChargeItemPerformerComponent(String name, ChargeItem.ChargeItemPerformerComponent element) throws IOException {
33423    if (element != null) {
33424      open(name);
33425      composeChargeItemChargeItemPerformerComponentInner(element);
33426      close();
33427    }
33428  }
33429
33430  protected void composeChargeItemChargeItemPerformerComponentInner(ChargeItem.ChargeItemPerformerComponent element) throws IOException {
33431      composeBackbone(element);
33432      if (element.hasFunction()) {
33433        composeCodeableConcept("function", element.getFunction());
33434      }
33435      if (element.hasActor()) {
33436        composeReference("actor", element.getActor());
33437      }
33438  }
33439
33440  protected void composeChargeItemDefinition(String name, ChargeItemDefinition element) throws IOException {
33441    if (element != null) {
33442      prop("resourceType", name);
33443      composeChargeItemDefinitionInner(element);
33444    }
33445  }
33446
33447  protected void composeChargeItemDefinitionInner(ChargeItemDefinition element) throws IOException {
33448      composeDomainResourceElements(element);
33449      if (element.hasUrlElement()) {
33450        composeUriCore("url", element.getUrlElement(), false);
33451        composeUriExtras("url", element.getUrlElement(), false);
33452      }
33453      if (element.hasIdentifier()) {
33454        openArray("identifier");
33455        for (Identifier e : element.getIdentifier()) 
33456          composeIdentifier(null, e);
33457        closeArray();
33458      };
33459      if (element.hasVersionElement()) {
33460        composeStringCore("version", element.getVersionElement(), false);
33461        composeStringExtras("version", element.getVersionElement(), false);
33462      }
33463      if (element.hasTitleElement()) {
33464        composeStringCore("title", element.getTitleElement(), false);
33465        composeStringExtras("title", element.getTitleElement(), false);
33466      }
33467      if (element.hasDerivedFromUri()) {
33468        openArray("derivedFromUri");
33469        for (UriType e : element.getDerivedFromUri()) 
33470          composeUriCore(null, e, true);
33471        closeArray();
33472        if (anyHasExtras(element.getDerivedFromUri())) {
33473          openArray("_derivedFromUri");
33474          for (UriType e : element.getDerivedFromUri()) 
33475            composeUriExtras(null, e, true);
33476          closeArray();
33477        }
33478      };
33479      if (element.hasPartOf()) {
33480        openArray("partOf");
33481        for (CanonicalType e : element.getPartOf()) 
33482          composeCanonicalCore(null, e, true);
33483        closeArray();
33484        if (anyHasExtras(element.getPartOf())) {
33485          openArray("_partOf");
33486          for (CanonicalType e : element.getPartOf()) 
33487            composeCanonicalExtras(null, e, true);
33488          closeArray();
33489        }
33490      };
33491      if (element.hasReplaces()) {
33492        openArray("replaces");
33493        for (CanonicalType e : element.getReplaces()) 
33494          composeCanonicalCore(null, e, true);
33495        closeArray();
33496        if (anyHasExtras(element.getReplaces())) {
33497          openArray("_replaces");
33498          for (CanonicalType e : element.getReplaces()) 
33499            composeCanonicalExtras(null, e, true);
33500          closeArray();
33501        }
33502      };
33503      if (element.hasStatusElement()) {
33504        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
33505        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
33506      }
33507      if (element.hasExperimentalElement()) {
33508        composeBooleanCore("experimental", element.getExperimentalElement(), false);
33509        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
33510      }
33511      if (element.hasDateElement()) {
33512        composeDateTimeCore("date", element.getDateElement(), false);
33513        composeDateTimeExtras("date", element.getDateElement(), false);
33514      }
33515      if (element.hasPublisherElement()) {
33516        composeStringCore("publisher", element.getPublisherElement(), false);
33517        composeStringExtras("publisher", element.getPublisherElement(), false);
33518      }
33519      if (element.hasContact()) {
33520        openArray("contact");
33521        for (ContactDetail e : element.getContact()) 
33522          composeContactDetail(null, e);
33523        closeArray();
33524      };
33525      if (element.hasDescriptionElement()) {
33526        composeMarkdownCore("description", element.getDescriptionElement(), false);
33527        composeMarkdownExtras("description", element.getDescriptionElement(), false);
33528      }
33529      if (element.hasUseContext()) {
33530        openArray("useContext");
33531        for (UsageContext e : element.getUseContext()) 
33532          composeUsageContext(null, e);
33533        closeArray();
33534      };
33535      if (element.hasJurisdiction()) {
33536        openArray("jurisdiction");
33537        for (CodeableConcept e : element.getJurisdiction()) 
33538          composeCodeableConcept(null, e);
33539        closeArray();
33540      };
33541      if (element.hasCopyrightElement()) {
33542        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
33543        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
33544      }
33545      if (element.hasApprovalDateElement()) {
33546        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
33547        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
33548      }
33549      if (element.hasLastReviewDateElement()) {
33550        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
33551        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
33552      }
33553      if (element.hasEffectivePeriod()) {
33554        composePeriod("effectivePeriod", element.getEffectivePeriod());
33555      }
33556      if (element.hasCode()) {
33557        composeCodeableConcept("code", element.getCode());
33558      }
33559      if (element.hasInstance()) {
33560        openArray("instance");
33561        for (Reference e : element.getInstance()) 
33562          composeReference(null, e);
33563        closeArray();
33564      };
33565      if (element.hasApplicability()) {
33566        openArray("applicability");
33567        for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability()) 
33568          composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(null, e);
33569        closeArray();
33570      };
33571      if (element.hasPropertyGroup()) {
33572        openArray("propertyGroup");
33573        for (ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent e : element.getPropertyGroup()) 
33574          composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(null, e);
33575        closeArray();
33576      };
33577  }
33578
33579  protected void composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(String name, ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
33580    if (element != null) {
33581      open(name);
33582      composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponentInner(element);
33583      close();
33584    }
33585  }
33586
33587  protected void composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponentInner(ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
33588      composeBackbone(element);
33589      if (element.hasDescriptionElement()) {
33590        composeStringCore("description", element.getDescriptionElement(), false);
33591        composeStringExtras("description", element.getDescriptionElement(), false);
33592      }
33593      if (element.hasLanguageElement()) {
33594        composeStringCore("language", element.getLanguageElement(), false);
33595        composeStringExtras("language", element.getLanguageElement(), false);
33596      }
33597      if (element.hasExpressionElement()) {
33598        composeStringCore("expression", element.getExpressionElement(), false);
33599        composeStringExtras("expression", element.getExpressionElement(), false);
33600      }
33601  }
33602
33603  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(String name, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
33604    if (element != null) {
33605      open(name);
33606      composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentInner(element);
33607      close();
33608    }
33609  }
33610
33611  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentInner(ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
33612      composeBackbone(element);
33613      if (element.hasApplicability()) {
33614        openArray("applicability");
33615        for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability()) 
33616          composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(null, e);
33617        closeArray();
33618      };
33619      if (element.hasPriceComponent()) {
33620        openArray("priceComponent");
33621        for (ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent e : element.getPriceComponent()) 
33622          composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(null, e);
33623        closeArray();
33624      };
33625  }
33626
33627  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(String name, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent element) throws IOException {
33628    if (element != null) {
33629      open(name);
33630      composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentInner(element);
33631      close();
33632    }
33633  }
33634
33635  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentInner(ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent element) throws IOException {
33636      composeBackbone(element);
33637      if (element.hasTypeElement()) {
33638        composeEnumerationCore("type", element.getTypeElement(), new ChargeItemDefinition.ChargeItemDefinitionPriceComponentTypeEnumFactory(), false);
33639        composeEnumerationExtras("type", element.getTypeElement(), new ChargeItemDefinition.ChargeItemDefinitionPriceComponentTypeEnumFactory(), false);
33640      }
33641      if (element.hasCode()) {
33642        composeCodeableConcept("code", element.getCode());
33643      }
33644      if (element.hasFactorElement()) {
33645        composeDecimalCore("factor", element.getFactorElement(), false);
33646        composeDecimalExtras("factor", element.getFactorElement(), false);
33647      }
33648      if (element.hasAmount()) {
33649        composeMoney("amount", element.getAmount());
33650      }
33651  }
33652
33653  protected void composeClaim(String name, Claim element) throws IOException {
33654    if (element != null) {
33655      prop("resourceType", name);
33656      composeClaimInner(element);
33657    }
33658  }
33659
33660  protected void composeClaimInner(Claim element) throws IOException {
33661      composeDomainResourceElements(element);
33662      if (element.hasIdentifier()) {
33663        openArray("identifier");
33664        for (Identifier e : element.getIdentifier()) 
33665          composeIdentifier(null, e);
33666        closeArray();
33667      };
33668      if (element.hasStatusElement()) {
33669        composeEnumerationCore("status", element.getStatusElement(), new Claim.ClaimStatusEnumFactory(), false);
33670        composeEnumerationExtras("status", element.getStatusElement(), new Claim.ClaimStatusEnumFactory(), false);
33671      }
33672      if (element.hasType()) {
33673        composeCodeableConcept("type", element.getType());
33674      }
33675      if (element.hasSubType()) {
33676        composeCodeableConcept("subType", element.getSubType());
33677      }
33678      if (element.hasUseElement()) {
33679        composeEnumerationCore("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
33680        composeEnumerationExtras("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
33681      }
33682      if (element.hasPatient()) {
33683        composeReference("patient", element.getPatient());
33684      }
33685      if (element.hasBillablePeriod()) {
33686        composePeriod("billablePeriod", element.getBillablePeriod());
33687      }
33688      if (element.hasCreatedElement()) {
33689        composeDateTimeCore("created", element.getCreatedElement(), false);
33690        composeDateTimeExtras("created", element.getCreatedElement(), false);
33691      }
33692      if (element.hasEnterer()) {
33693        composeReference("enterer", element.getEnterer());
33694      }
33695      if (element.hasInsurer()) {
33696        composeReference("insurer", element.getInsurer());
33697      }
33698      if (element.hasProvider()) {
33699        composeReference("provider", element.getProvider());
33700      }
33701      if (element.hasPriority()) {
33702        composeCodeableConcept("priority", element.getPriority());
33703      }
33704      if (element.hasFundsReserve()) {
33705        composeCodeableConcept("fundsReserve", element.getFundsReserve());
33706      }
33707      if (element.hasRelated()) {
33708        openArray("related");
33709        for (Claim.RelatedClaimComponent e : element.getRelated()) 
33710          composeClaimRelatedClaimComponent(null, e);
33711        closeArray();
33712      };
33713      if (element.hasPrescription()) {
33714        composeReference("prescription", element.getPrescription());
33715      }
33716      if (element.hasOriginalPrescription()) {
33717        composeReference("originalPrescription", element.getOriginalPrescription());
33718      }
33719      if (element.hasPayee()) {
33720        composeClaimPayeeComponent("payee", element.getPayee());
33721      }
33722      if (element.hasReferral()) {
33723        composeReference("referral", element.getReferral());
33724      }
33725      if (element.hasFacility()) {
33726        composeReference("facility", element.getFacility());
33727      }
33728      if (element.hasCareTeam()) {
33729        openArray("careTeam");
33730        for (Claim.CareTeamComponent e : element.getCareTeam()) 
33731          composeClaimCareTeamComponent(null, e);
33732        closeArray();
33733      };
33734      if (element.hasSupportingInfo()) {
33735        openArray("supportingInfo");
33736        for (Claim.SupportingInformationComponent e : element.getSupportingInfo()) 
33737          composeClaimSupportingInformationComponent(null, e);
33738        closeArray();
33739      };
33740      if (element.hasDiagnosis()) {
33741        openArray("diagnosis");
33742        for (Claim.DiagnosisComponent e : element.getDiagnosis()) 
33743          composeClaimDiagnosisComponent(null, e);
33744        closeArray();
33745      };
33746      if (element.hasProcedure()) {
33747        openArray("procedure");
33748        for (Claim.ProcedureComponent e : element.getProcedure()) 
33749          composeClaimProcedureComponent(null, e);
33750        closeArray();
33751      };
33752      if (element.hasInsurance()) {
33753        openArray("insurance");
33754        for (Claim.InsuranceComponent e : element.getInsurance()) 
33755          composeClaimInsuranceComponent(null, e);
33756        closeArray();
33757      };
33758      if (element.hasAccident()) {
33759        composeClaimAccidentComponent("accident", element.getAccident());
33760      }
33761      if (element.hasItem()) {
33762        openArray("item");
33763        for (Claim.ItemComponent e : element.getItem()) 
33764          composeClaimItemComponent(null, e);
33765        closeArray();
33766      };
33767      if (element.hasTotal()) {
33768        composeMoney("total", element.getTotal());
33769      }
33770  }
33771
33772  protected void composeClaimRelatedClaimComponent(String name, Claim.RelatedClaimComponent element) throws IOException {
33773    if (element != null) {
33774      open(name);
33775      composeClaimRelatedClaimComponentInner(element);
33776      close();
33777    }
33778  }
33779
33780  protected void composeClaimRelatedClaimComponentInner(Claim.RelatedClaimComponent element) throws IOException {
33781      composeBackbone(element);
33782      if (element.hasClaim()) {
33783        composeReference("claim", element.getClaim());
33784      }
33785      if (element.hasRelationship()) {
33786        composeCodeableConcept("relationship", element.getRelationship());
33787      }
33788      if (element.hasReference()) {
33789        composeIdentifier("reference", element.getReference());
33790      }
33791  }
33792
33793  protected void composeClaimPayeeComponent(String name, Claim.PayeeComponent element) throws IOException {
33794    if (element != null) {
33795      open(name);
33796      composeClaimPayeeComponentInner(element);
33797      close();
33798    }
33799  }
33800
33801  protected void composeClaimPayeeComponentInner(Claim.PayeeComponent element) throws IOException {
33802      composeBackbone(element);
33803      if (element.hasType()) {
33804        composeCodeableConcept("type", element.getType());
33805      }
33806      if (element.hasParty()) {
33807        composeReference("party", element.getParty());
33808      }
33809  }
33810
33811  protected void composeClaimCareTeamComponent(String name, Claim.CareTeamComponent element) throws IOException {
33812    if (element != null) {
33813      open(name);
33814      composeClaimCareTeamComponentInner(element);
33815      close();
33816    }
33817  }
33818
33819  protected void composeClaimCareTeamComponentInner(Claim.CareTeamComponent element) throws IOException {
33820      composeBackbone(element);
33821      if (element.hasSequenceElement()) {
33822        composePositiveIntCore("sequence", element.getSequenceElement(), false);
33823        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
33824      }
33825      if (element.hasProvider()) {
33826        composeReference("provider", element.getProvider());
33827      }
33828      if (element.hasResponsibleElement()) {
33829        composeBooleanCore("responsible", element.getResponsibleElement(), false);
33830        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
33831      }
33832      if (element.hasRole()) {
33833        composeCodeableConcept("role", element.getRole());
33834      }
33835      if (element.hasQualification()) {
33836        composeCodeableConcept("qualification", element.getQualification());
33837      }
33838  }
33839
33840  protected void composeClaimSupportingInformationComponent(String name, Claim.SupportingInformationComponent element) throws IOException {
33841    if (element != null) {
33842      open(name);
33843      composeClaimSupportingInformationComponentInner(element);
33844      close();
33845    }
33846  }
33847
33848  protected void composeClaimSupportingInformationComponentInner(Claim.SupportingInformationComponent element) throws IOException {
33849      composeBackbone(element);
33850      if (element.hasSequenceElement()) {
33851        composePositiveIntCore("sequence", element.getSequenceElement(), false);
33852        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
33853      }
33854      if (element.hasCategory()) {
33855        composeCodeableConcept("category", element.getCategory());
33856      }
33857      if (element.hasCode()) {
33858        composeCodeableConcept("code", element.getCode());
33859      }
33860      if (element.hasTiming()) {
33861        composeType("timing", element.getTiming());
33862      }
33863      if (element.hasValue()) {
33864        composeType("value", element.getValue());
33865      }
33866      if (element.hasReason()) {
33867        composeCodeableConcept("reason", element.getReason());
33868      }
33869  }
33870
33871  protected void composeClaimDiagnosisComponent(String name, Claim.DiagnosisComponent element) throws IOException {
33872    if (element != null) {
33873      open(name);
33874      composeClaimDiagnosisComponentInner(element);
33875      close();
33876    }
33877  }
33878
33879  protected void composeClaimDiagnosisComponentInner(Claim.DiagnosisComponent element) throws IOException {
33880      composeBackbone(element);
33881      if (element.hasSequenceElement()) {
33882        composePositiveIntCore("sequence", element.getSequenceElement(), false);
33883        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
33884      }
33885      if (element.hasDiagnosis()) {
33886        composeType("diagnosis", element.getDiagnosis());
33887      }
33888      if (element.hasType()) {
33889        openArray("type");
33890        for (CodeableConcept e : element.getType()) 
33891          composeCodeableConcept(null, e);
33892        closeArray();
33893      };
33894      if (element.hasOnAdmission()) {
33895        composeCodeableConcept("onAdmission", element.getOnAdmission());
33896      }
33897      if (element.hasPackageCode()) {
33898        composeCodeableConcept("packageCode", element.getPackageCode());
33899      }
33900  }
33901
33902  protected void composeClaimProcedureComponent(String name, Claim.ProcedureComponent element) throws IOException {
33903    if (element != null) {
33904      open(name);
33905      composeClaimProcedureComponentInner(element);
33906      close();
33907    }
33908  }
33909
33910  protected void composeClaimProcedureComponentInner(Claim.ProcedureComponent element) throws IOException {
33911      composeBackbone(element);
33912      if (element.hasSequenceElement()) {
33913        composePositiveIntCore("sequence", element.getSequenceElement(), false);
33914        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
33915      }
33916      if (element.hasType()) {
33917        openArray("type");
33918        for (CodeableConcept e : element.getType()) 
33919          composeCodeableConcept(null, e);
33920        closeArray();
33921      };
33922      if (element.hasDateElement()) {
33923        composeDateTimeCore("date", element.getDateElement(), false);
33924        composeDateTimeExtras("date", element.getDateElement(), false);
33925      }
33926      if (element.hasProcedure()) {
33927        composeType("procedure", element.getProcedure());
33928      }
33929      if (element.hasUdi()) {
33930        openArray("udi");
33931        for (Reference e : element.getUdi()) 
33932          composeReference(null, e);
33933        closeArray();
33934      };
33935  }
33936
33937  protected void composeClaimInsuranceComponent(String name, Claim.InsuranceComponent element) throws IOException {
33938    if (element != null) {
33939      open(name);
33940      composeClaimInsuranceComponentInner(element);
33941      close();
33942    }
33943  }
33944
33945  protected void composeClaimInsuranceComponentInner(Claim.InsuranceComponent element) throws IOException {
33946      composeBackbone(element);
33947      if (element.hasSequenceElement()) {
33948        composePositiveIntCore("sequence", element.getSequenceElement(), false);
33949        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
33950      }
33951      if (element.hasFocalElement()) {
33952        composeBooleanCore("focal", element.getFocalElement(), false);
33953        composeBooleanExtras("focal", element.getFocalElement(), false);
33954      }
33955      if (element.hasIdentifier()) {
33956        composeIdentifier("identifier", element.getIdentifier());
33957      }
33958      if (element.hasCoverage()) {
33959        composeReference("coverage", element.getCoverage());
33960      }
33961      if (element.hasBusinessArrangementElement()) {
33962        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
33963        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
33964      }
33965      if (element.hasPreAuthRef()) {
33966        openArray("preAuthRef");
33967        for (StringType e : element.getPreAuthRef()) 
33968          composeStringCore(null, e, true);
33969        closeArray();
33970        if (anyHasExtras(element.getPreAuthRef())) {
33971          openArray("_preAuthRef");
33972          for (StringType e : element.getPreAuthRef()) 
33973            composeStringExtras(null, e, true);
33974          closeArray();
33975        }
33976      };
33977      if (element.hasClaimResponse()) {
33978        composeReference("claimResponse", element.getClaimResponse());
33979      }
33980  }
33981
33982  protected void composeClaimAccidentComponent(String name, Claim.AccidentComponent element) throws IOException {
33983    if (element != null) {
33984      open(name);
33985      composeClaimAccidentComponentInner(element);
33986      close();
33987    }
33988  }
33989
33990  protected void composeClaimAccidentComponentInner(Claim.AccidentComponent element) throws IOException {
33991      composeBackbone(element);
33992      if (element.hasDateElement()) {
33993        composeDateCore("date", element.getDateElement(), false);
33994        composeDateExtras("date", element.getDateElement(), false);
33995      }
33996      if (element.hasType()) {
33997        composeCodeableConcept("type", element.getType());
33998      }
33999      if (element.hasLocation()) {
34000        composeType("location", element.getLocation());
34001      }
34002  }
34003
34004  protected void composeClaimItemComponent(String name, Claim.ItemComponent element) throws IOException {
34005    if (element != null) {
34006      open(name);
34007      composeClaimItemComponentInner(element);
34008      close();
34009    }
34010  }
34011
34012  protected void composeClaimItemComponentInner(Claim.ItemComponent element) throws IOException {
34013      composeBackbone(element);
34014      if (element.hasSequenceElement()) {
34015        composePositiveIntCore("sequence", element.getSequenceElement(), false);
34016        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
34017      }
34018      if (element.hasCareTeamSequence()) {
34019        openArray("careTeamSequence");
34020        for (PositiveIntType e : element.getCareTeamSequence()) 
34021          composePositiveIntCore(null, e, true);
34022        closeArray();
34023        if (anyHasExtras(element.getCareTeamSequence())) {
34024          openArray("_careTeamSequence");
34025          for (PositiveIntType e : element.getCareTeamSequence()) 
34026            composePositiveIntExtras(null, e, true);
34027          closeArray();
34028        }
34029      };
34030      if (element.hasDiagnosisSequence()) {
34031        openArray("diagnosisSequence");
34032        for (PositiveIntType e : element.getDiagnosisSequence()) 
34033          composePositiveIntCore(null, e, true);
34034        closeArray();
34035        if (anyHasExtras(element.getDiagnosisSequence())) {
34036          openArray("_diagnosisSequence");
34037          for (PositiveIntType e : element.getDiagnosisSequence()) 
34038            composePositiveIntExtras(null, e, true);
34039          closeArray();
34040        }
34041      };
34042      if (element.hasProcedureSequence()) {
34043        openArray("procedureSequence");
34044        for (PositiveIntType e : element.getProcedureSequence()) 
34045          composePositiveIntCore(null, e, true);
34046        closeArray();
34047        if (anyHasExtras(element.getProcedureSequence())) {
34048          openArray("_procedureSequence");
34049          for (PositiveIntType e : element.getProcedureSequence()) 
34050            composePositiveIntExtras(null, e, true);
34051          closeArray();
34052        }
34053      };
34054      if (element.hasInformationSequence()) {
34055        openArray("informationSequence");
34056        for (PositiveIntType e : element.getInformationSequence()) 
34057          composePositiveIntCore(null, e, true);
34058        closeArray();
34059        if (anyHasExtras(element.getInformationSequence())) {
34060          openArray("_informationSequence");
34061          for (PositiveIntType e : element.getInformationSequence()) 
34062            composePositiveIntExtras(null, e, true);
34063          closeArray();
34064        }
34065      };
34066      if (element.hasRevenue()) {
34067        composeCodeableConcept("revenue", element.getRevenue());
34068      }
34069      if (element.hasCategory()) {
34070        composeCodeableConcept("category", element.getCategory());
34071      }
34072      if (element.hasProductOrService()) {
34073        composeCodeableConcept("productOrService", element.getProductOrService());
34074      }
34075      if (element.hasModifier()) {
34076        openArray("modifier");
34077        for (CodeableConcept e : element.getModifier()) 
34078          composeCodeableConcept(null, e);
34079        closeArray();
34080      };
34081      if (element.hasProgramCode()) {
34082        openArray("programCode");
34083        for (CodeableConcept e : element.getProgramCode()) 
34084          composeCodeableConcept(null, e);
34085        closeArray();
34086      };
34087      if (element.hasServiced()) {
34088        composeType("serviced", element.getServiced());
34089      }
34090      if (element.hasLocation()) {
34091        composeType("location", element.getLocation());
34092      }
34093      if (element.hasQuantity()) {
34094        composeQuantity("quantity", element.getQuantity());
34095      }
34096      if (element.hasUnitPrice()) {
34097        composeMoney("unitPrice", element.getUnitPrice());
34098      }
34099      if (element.hasFactorElement()) {
34100        composeDecimalCore("factor", element.getFactorElement(), false);
34101        composeDecimalExtras("factor", element.getFactorElement(), false);
34102      }
34103      if (element.hasNet()) {
34104        composeMoney("net", element.getNet());
34105      }
34106      if (element.hasUdi()) {
34107        openArray("udi");
34108        for (Reference e : element.getUdi()) 
34109          composeReference(null, e);
34110        closeArray();
34111      };
34112      if (element.hasBodySite()) {
34113        composeCodeableConcept("bodySite", element.getBodySite());
34114      }
34115      if (element.hasSubSite()) {
34116        openArray("subSite");
34117        for (CodeableConcept e : element.getSubSite()) 
34118          composeCodeableConcept(null, e);
34119        closeArray();
34120      };
34121      if (element.hasEncounter()) {
34122        openArray("encounter");
34123        for (Reference e : element.getEncounter()) 
34124          composeReference(null, e);
34125        closeArray();
34126      };
34127      if (element.hasDetail()) {
34128        openArray("detail");
34129        for (Claim.DetailComponent e : element.getDetail()) 
34130          composeClaimDetailComponent(null, e);
34131        closeArray();
34132      };
34133  }
34134
34135  protected void composeClaimDetailComponent(String name, Claim.DetailComponent element) throws IOException {
34136    if (element != null) {
34137      open(name);
34138      composeClaimDetailComponentInner(element);
34139      close();
34140    }
34141  }
34142
34143  protected void composeClaimDetailComponentInner(Claim.DetailComponent element) throws IOException {
34144      composeBackbone(element);
34145      if (element.hasSequenceElement()) {
34146        composePositiveIntCore("sequence", element.getSequenceElement(), false);
34147        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
34148      }
34149      if (element.hasRevenue()) {
34150        composeCodeableConcept("revenue", element.getRevenue());
34151      }
34152      if (element.hasCategory()) {
34153        composeCodeableConcept("category", element.getCategory());
34154      }
34155      if (element.hasProductOrService()) {
34156        composeCodeableConcept("productOrService", element.getProductOrService());
34157      }
34158      if (element.hasModifier()) {
34159        openArray("modifier");
34160        for (CodeableConcept e : element.getModifier()) 
34161          composeCodeableConcept(null, e);
34162        closeArray();
34163      };
34164      if (element.hasProgramCode()) {
34165        openArray("programCode");
34166        for (CodeableConcept e : element.getProgramCode()) 
34167          composeCodeableConcept(null, e);
34168        closeArray();
34169      };
34170      if (element.hasQuantity()) {
34171        composeQuantity("quantity", element.getQuantity());
34172      }
34173      if (element.hasUnitPrice()) {
34174        composeMoney("unitPrice", element.getUnitPrice());
34175      }
34176      if (element.hasFactorElement()) {
34177        composeDecimalCore("factor", element.getFactorElement(), false);
34178        composeDecimalExtras("factor", element.getFactorElement(), false);
34179      }
34180      if (element.hasNet()) {
34181        composeMoney("net", element.getNet());
34182      }
34183      if (element.hasUdi()) {
34184        openArray("udi");
34185        for (Reference e : element.getUdi()) 
34186          composeReference(null, e);
34187        closeArray();
34188      };
34189      if (element.hasSubDetail()) {
34190        openArray("subDetail");
34191        for (Claim.SubDetailComponent e : element.getSubDetail()) 
34192          composeClaimSubDetailComponent(null, e);
34193        closeArray();
34194      };
34195  }
34196
34197  protected void composeClaimSubDetailComponent(String name, Claim.SubDetailComponent element) throws IOException {
34198    if (element != null) {
34199      open(name);
34200      composeClaimSubDetailComponentInner(element);
34201      close();
34202    }
34203  }
34204
34205  protected void composeClaimSubDetailComponentInner(Claim.SubDetailComponent element) throws IOException {
34206      composeBackbone(element);
34207      if (element.hasSequenceElement()) {
34208        composePositiveIntCore("sequence", element.getSequenceElement(), false);
34209        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
34210      }
34211      if (element.hasRevenue()) {
34212        composeCodeableConcept("revenue", element.getRevenue());
34213      }
34214      if (element.hasCategory()) {
34215        composeCodeableConcept("category", element.getCategory());
34216      }
34217      if (element.hasProductOrService()) {
34218        composeCodeableConcept("productOrService", element.getProductOrService());
34219      }
34220      if (element.hasModifier()) {
34221        openArray("modifier");
34222        for (CodeableConcept e : element.getModifier()) 
34223          composeCodeableConcept(null, e);
34224        closeArray();
34225      };
34226      if (element.hasProgramCode()) {
34227        openArray("programCode");
34228        for (CodeableConcept e : element.getProgramCode()) 
34229          composeCodeableConcept(null, e);
34230        closeArray();
34231      };
34232      if (element.hasQuantity()) {
34233        composeQuantity("quantity", element.getQuantity());
34234      }
34235      if (element.hasUnitPrice()) {
34236        composeMoney("unitPrice", element.getUnitPrice());
34237      }
34238      if (element.hasFactorElement()) {
34239        composeDecimalCore("factor", element.getFactorElement(), false);
34240        composeDecimalExtras("factor", element.getFactorElement(), false);
34241      }
34242      if (element.hasNet()) {
34243        composeMoney("net", element.getNet());
34244      }
34245      if (element.hasUdi()) {
34246        openArray("udi");
34247        for (Reference e : element.getUdi()) 
34248          composeReference(null, e);
34249        closeArray();
34250      };
34251  }
34252
34253  protected void composeClaimResponse(String name, ClaimResponse element) throws IOException {
34254    if (element != null) {
34255      prop("resourceType", name);
34256      composeClaimResponseInner(element);
34257    }
34258  }
34259
34260  protected void composeClaimResponseInner(ClaimResponse element) throws IOException {
34261      composeDomainResourceElements(element);
34262      if (element.hasIdentifier()) {
34263        openArray("identifier");
34264        for (Identifier e : element.getIdentifier()) 
34265          composeIdentifier(null, e);
34266        closeArray();
34267      };
34268      if (element.hasStatusElement()) {
34269        composeEnumerationCore("status", element.getStatusElement(), new ClaimResponse.ClaimResponseStatusEnumFactory(), false);
34270        composeEnumerationExtras("status", element.getStatusElement(), new ClaimResponse.ClaimResponseStatusEnumFactory(), false);
34271      }
34272      if (element.hasType()) {
34273        composeCodeableConcept("type", element.getType());
34274      }
34275      if (element.hasSubType()) {
34276        composeCodeableConcept("subType", element.getSubType());
34277      }
34278      if (element.hasUseElement()) {
34279        composeEnumerationCore("use", element.getUseElement(), new ClaimResponse.UseEnumFactory(), false);
34280        composeEnumerationExtras("use", element.getUseElement(), new ClaimResponse.UseEnumFactory(), false);
34281      }
34282      if (element.hasPatient()) {
34283        composeReference("patient", element.getPatient());
34284      }
34285      if (element.hasCreatedElement()) {
34286        composeDateTimeCore("created", element.getCreatedElement(), false);
34287        composeDateTimeExtras("created", element.getCreatedElement(), false);
34288      }
34289      if (element.hasInsurer()) {
34290        composeReference("insurer", element.getInsurer());
34291      }
34292      if (element.hasRequestor()) {
34293        composeReference("requestor", element.getRequestor());
34294      }
34295      if (element.hasRequest()) {
34296        composeReference("request", element.getRequest());
34297      }
34298      if (element.hasOutcomeElement()) {
34299        composeEnumerationCore("outcome", element.getOutcomeElement(), new ClaimResponse.RemittanceOutcomeEnumFactory(), false);
34300        composeEnumerationExtras("outcome", element.getOutcomeElement(), new ClaimResponse.RemittanceOutcomeEnumFactory(), false);
34301      }
34302      if (element.hasDispositionElement()) {
34303        composeStringCore("disposition", element.getDispositionElement(), false);
34304        composeStringExtras("disposition", element.getDispositionElement(), false);
34305      }
34306      if (element.hasPreAuthRefElement()) {
34307        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
34308        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
34309      }
34310      if (element.hasPreAuthPeriod()) {
34311        composePeriod("preAuthPeriod", element.getPreAuthPeriod());
34312      }
34313      if (element.hasPayeeType()) {
34314        composeCodeableConcept("payeeType", element.getPayeeType());
34315      }
34316      if (element.hasItem()) {
34317        openArray("item");
34318        for (ClaimResponse.ItemComponent e : element.getItem()) 
34319          composeClaimResponseItemComponent(null, e);
34320        closeArray();
34321      };
34322      if (element.hasAddItem()) {
34323        openArray("addItem");
34324        for (ClaimResponse.AddedItemComponent e : element.getAddItem()) 
34325          composeClaimResponseAddedItemComponent(null, e);
34326        closeArray();
34327      };
34328      if (element.hasAdjudication()) {
34329        openArray("adjudication");
34330        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
34331          composeClaimResponseAdjudicationComponent(null, e);
34332        closeArray();
34333      };
34334      if (element.hasTotal()) {
34335        openArray("total");
34336        for (ClaimResponse.TotalComponent e : element.getTotal()) 
34337          composeClaimResponseTotalComponent(null, e);
34338        closeArray();
34339      };
34340      if (element.hasPayment()) {
34341        composeClaimResponsePaymentComponent("payment", element.getPayment());
34342      }
34343      if (element.hasFundsReserve()) {
34344        composeCodeableConcept("fundsReserve", element.getFundsReserve());
34345      }
34346      if (element.hasFormCode()) {
34347        composeCodeableConcept("formCode", element.getFormCode());
34348      }
34349      if (element.hasForm()) {
34350        composeAttachment("form", element.getForm());
34351      }
34352      if (element.hasProcessNote()) {
34353        openArray("processNote");
34354        for (ClaimResponse.NoteComponent e : element.getProcessNote()) 
34355          composeClaimResponseNoteComponent(null, e);
34356        closeArray();
34357      };
34358      if (element.hasCommunicationRequest()) {
34359        openArray("communicationRequest");
34360        for (Reference e : element.getCommunicationRequest()) 
34361          composeReference(null, e);
34362        closeArray();
34363      };
34364      if (element.hasInsurance()) {
34365        openArray("insurance");
34366        for (ClaimResponse.InsuranceComponent e : element.getInsurance()) 
34367          composeClaimResponseInsuranceComponent(null, e);
34368        closeArray();
34369      };
34370      if (element.hasError()) {
34371        openArray("error");
34372        for (ClaimResponse.ErrorComponent e : element.getError()) 
34373          composeClaimResponseErrorComponent(null, e);
34374        closeArray();
34375      };
34376  }
34377
34378  protected void composeClaimResponseItemComponent(String name, ClaimResponse.ItemComponent element) throws IOException {
34379    if (element != null) {
34380      open(name);
34381      composeClaimResponseItemComponentInner(element);
34382      close();
34383    }
34384  }
34385
34386  protected void composeClaimResponseItemComponentInner(ClaimResponse.ItemComponent element) throws IOException {
34387      composeBackbone(element);
34388      if (element.hasItemSequenceElement()) {
34389        composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
34390        composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
34391      }
34392      if (element.hasNoteNumber()) {
34393        openArray("noteNumber");
34394        for (PositiveIntType e : element.getNoteNumber()) 
34395          composePositiveIntCore(null, e, true);
34396        closeArray();
34397        if (anyHasExtras(element.getNoteNumber())) {
34398          openArray("_noteNumber");
34399          for (PositiveIntType e : element.getNoteNumber()) 
34400            composePositiveIntExtras(null, e, true);
34401          closeArray();
34402        }
34403      };
34404      if (element.hasAdjudication()) {
34405        openArray("adjudication");
34406        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
34407          composeClaimResponseAdjudicationComponent(null, e);
34408        closeArray();
34409      };
34410      if (element.hasDetail()) {
34411        openArray("detail");
34412        for (ClaimResponse.ItemDetailComponent e : element.getDetail()) 
34413          composeClaimResponseItemDetailComponent(null, e);
34414        closeArray();
34415      };
34416  }
34417
34418  protected void composeClaimResponseAdjudicationComponent(String name, ClaimResponse.AdjudicationComponent element) throws IOException {
34419    if (element != null) {
34420      open(name);
34421      composeClaimResponseAdjudicationComponentInner(element);
34422      close();
34423    }
34424  }
34425
34426  protected void composeClaimResponseAdjudicationComponentInner(ClaimResponse.AdjudicationComponent element) throws IOException {
34427      composeBackbone(element);
34428      if (element.hasCategory()) {
34429        composeCodeableConcept("category", element.getCategory());
34430      }
34431      if (element.hasReason()) {
34432        composeCodeableConcept("reason", element.getReason());
34433      }
34434      if (element.hasAmount()) {
34435        composeMoney("amount", element.getAmount());
34436      }
34437      if (element.hasValueElement()) {
34438        composeDecimalCore("value", element.getValueElement(), false);
34439        composeDecimalExtras("value", element.getValueElement(), false);
34440      }
34441  }
34442
34443  protected void composeClaimResponseItemDetailComponent(String name, ClaimResponse.ItemDetailComponent element) throws IOException {
34444    if (element != null) {
34445      open(name);
34446      composeClaimResponseItemDetailComponentInner(element);
34447      close();
34448    }
34449  }
34450
34451  protected void composeClaimResponseItemDetailComponentInner(ClaimResponse.ItemDetailComponent element) throws IOException {
34452      composeBackbone(element);
34453      if (element.hasDetailSequenceElement()) {
34454        composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
34455        composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
34456      }
34457      if (element.hasNoteNumber()) {
34458        openArray("noteNumber");
34459        for (PositiveIntType e : element.getNoteNumber()) 
34460          composePositiveIntCore(null, e, true);
34461        closeArray();
34462        if (anyHasExtras(element.getNoteNumber())) {
34463          openArray("_noteNumber");
34464          for (PositiveIntType e : element.getNoteNumber()) 
34465            composePositiveIntExtras(null, e, true);
34466          closeArray();
34467        }
34468      };
34469      if (element.hasAdjudication()) {
34470        openArray("adjudication");
34471        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
34472          composeClaimResponseAdjudicationComponent(null, e);
34473        closeArray();
34474      };
34475      if (element.hasSubDetail()) {
34476        openArray("subDetail");
34477        for (ClaimResponse.SubDetailComponent e : element.getSubDetail()) 
34478          composeClaimResponseSubDetailComponent(null, e);
34479        closeArray();
34480      };
34481  }
34482
34483  protected void composeClaimResponseSubDetailComponent(String name, ClaimResponse.SubDetailComponent element) throws IOException {
34484    if (element != null) {
34485      open(name);
34486      composeClaimResponseSubDetailComponentInner(element);
34487      close();
34488    }
34489  }
34490
34491  protected void composeClaimResponseSubDetailComponentInner(ClaimResponse.SubDetailComponent element) throws IOException {
34492      composeBackbone(element);
34493      if (element.hasSubDetailSequenceElement()) {
34494        composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
34495        composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
34496      }
34497      if (element.hasNoteNumber()) {
34498        openArray("noteNumber");
34499        for (PositiveIntType e : element.getNoteNumber()) 
34500          composePositiveIntCore(null, e, true);
34501        closeArray();
34502        if (anyHasExtras(element.getNoteNumber())) {
34503          openArray("_noteNumber");
34504          for (PositiveIntType e : element.getNoteNumber()) 
34505            composePositiveIntExtras(null, e, true);
34506          closeArray();
34507        }
34508      };
34509      if (element.hasAdjudication()) {
34510        openArray("adjudication");
34511        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
34512          composeClaimResponseAdjudicationComponent(null, e);
34513        closeArray();
34514      };
34515  }
34516
34517  protected void composeClaimResponseAddedItemComponent(String name, ClaimResponse.AddedItemComponent element) throws IOException {
34518    if (element != null) {
34519      open(name);
34520      composeClaimResponseAddedItemComponentInner(element);
34521      close();
34522    }
34523  }
34524
34525  protected void composeClaimResponseAddedItemComponentInner(ClaimResponse.AddedItemComponent element) throws IOException {
34526      composeBackbone(element);
34527      if (element.hasItemSequence()) {
34528        openArray("itemSequence");
34529        for (PositiveIntType e : element.getItemSequence()) 
34530          composePositiveIntCore(null, e, true);
34531        closeArray();
34532        if (anyHasExtras(element.getItemSequence())) {
34533          openArray("_itemSequence");
34534          for (PositiveIntType e : element.getItemSequence()) 
34535            composePositiveIntExtras(null, e, true);
34536          closeArray();
34537        }
34538      };
34539      if (element.hasDetailSequence()) {
34540        openArray("detailSequence");
34541        for (PositiveIntType e : element.getDetailSequence()) 
34542          composePositiveIntCore(null, e, true);
34543        closeArray();
34544        if (anyHasExtras(element.getDetailSequence())) {
34545          openArray("_detailSequence");
34546          for (PositiveIntType e : element.getDetailSequence()) 
34547            composePositiveIntExtras(null, e, true);
34548          closeArray();
34549        }
34550      };
34551      if (element.hasSubdetailSequence()) {
34552        openArray("subdetailSequence");
34553        for (PositiveIntType e : element.getSubdetailSequence()) 
34554          composePositiveIntCore(null, e, true);
34555        closeArray();
34556        if (anyHasExtras(element.getSubdetailSequence())) {
34557          openArray("_subdetailSequence");
34558          for (PositiveIntType e : element.getSubdetailSequence()) 
34559            composePositiveIntExtras(null, e, true);
34560          closeArray();
34561        }
34562      };
34563      if (element.hasProvider()) {
34564        openArray("provider");
34565        for (Reference e : element.getProvider()) 
34566          composeReference(null, e);
34567        closeArray();
34568      };
34569      if (element.hasProductOrService()) {
34570        composeCodeableConcept("productOrService", element.getProductOrService());
34571      }
34572      if (element.hasModifier()) {
34573        openArray("modifier");
34574        for (CodeableConcept e : element.getModifier()) 
34575          composeCodeableConcept(null, e);
34576        closeArray();
34577      };
34578      if (element.hasProgramCode()) {
34579        openArray("programCode");
34580        for (CodeableConcept e : element.getProgramCode()) 
34581          composeCodeableConcept(null, e);
34582        closeArray();
34583      };
34584      if (element.hasServiced()) {
34585        composeType("serviced", element.getServiced());
34586      }
34587      if (element.hasLocation()) {
34588        composeType("location", element.getLocation());
34589      }
34590      if (element.hasQuantity()) {
34591        composeQuantity("quantity", element.getQuantity());
34592      }
34593      if (element.hasUnitPrice()) {
34594        composeMoney("unitPrice", element.getUnitPrice());
34595      }
34596      if (element.hasFactorElement()) {
34597        composeDecimalCore("factor", element.getFactorElement(), false);
34598        composeDecimalExtras("factor", element.getFactorElement(), false);
34599      }
34600      if (element.hasNet()) {
34601        composeMoney("net", element.getNet());
34602      }
34603      if (element.hasBodySite()) {
34604        composeCodeableConcept("bodySite", element.getBodySite());
34605      }
34606      if (element.hasSubSite()) {
34607        openArray("subSite");
34608        for (CodeableConcept e : element.getSubSite()) 
34609          composeCodeableConcept(null, e);
34610        closeArray();
34611      };
34612      if (element.hasNoteNumber()) {
34613        openArray("noteNumber");
34614        for (PositiveIntType e : element.getNoteNumber()) 
34615          composePositiveIntCore(null, e, true);
34616        closeArray();
34617        if (anyHasExtras(element.getNoteNumber())) {
34618          openArray("_noteNumber");
34619          for (PositiveIntType e : element.getNoteNumber()) 
34620            composePositiveIntExtras(null, e, true);
34621          closeArray();
34622        }
34623      };
34624      if (element.hasAdjudication()) {
34625        openArray("adjudication");
34626        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
34627          composeClaimResponseAdjudicationComponent(null, e);
34628        closeArray();
34629      };
34630      if (element.hasDetail()) {
34631        openArray("detail");
34632        for (ClaimResponse.AddedItemDetailComponent e : element.getDetail()) 
34633          composeClaimResponseAddedItemDetailComponent(null, e);
34634        closeArray();
34635      };
34636  }
34637
34638  protected void composeClaimResponseAddedItemDetailComponent(String name, ClaimResponse.AddedItemDetailComponent element) throws IOException {
34639    if (element != null) {
34640      open(name);
34641      composeClaimResponseAddedItemDetailComponentInner(element);
34642      close();
34643    }
34644  }
34645
34646  protected void composeClaimResponseAddedItemDetailComponentInner(ClaimResponse.AddedItemDetailComponent element) throws IOException {
34647      composeBackbone(element);
34648      if (element.hasProductOrService()) {
34649        composeCodeableConcept("productOrService", element.getProductOrService());
34650      }
34651      if (element.hasModifier()) {
34652        openArray("modifier");
34653        for (CodeableConcept e : element.getModifier()) 
34654          composeCodeableConcept(null, e);
34655        closeArray();
34656      };
34657      if (element.hasQuantity()) {
34658        composeQuantity("quantity", element.getQuantity());
34659      }
34660      if (element.hasUnitPrice()) {
34661        composeMoney("unitPrice", element.getUnitPrice());
34662      }
34663      if (element.hasFactorElement()) {
34664        composeDecimalCore("factor", element.getFactorElement(), false);
34665        composeDecimalExtras("factor", element.getFactorElement(), false);
34666      }
34667      if (element.hasNet()) {
34668        composeMoney("net", element.getNet());
34669      }
34670      if (element.hasNoteNumber()) {
34671        openArray("noteNumber");
34672        for (PositiveIntType e : element.getNoteNumber()) 
34673          composePositiveIntCore(null, e, true);
34674        closeArray();
34675        if (anyHasExtras(element.getNoteNumber())) {
34676          openArray("_noteNumber");
34677          for (PositiveIntType e : element.getNoteNumber()) 
34678            composePositiveIntExtras(null, e, true);
34679          closeArray();
34680        }
34681      };
34682      if (element.hasAdjudication()) {
34683        openArray("adjudication");
34684        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
34685          composeClaimResponseAdjudicationComponent(null, e);
34686        closeArray();
34687      };
34688      if (element.hasSubDetail()) {
34689        openArray("subDetail");
34690        for (ClaimResponse.AddedItemSubDetailComponent e : element.getSubDetail()) 
34691          composeClaimResponseAddedItemSubDetailComponent(null, e);
34692        closeArray();
34693      };
34694  }
34695
34696  protected void composeClaimResponseAddedItemSubDetailComponent(String name, ClaimResponse.AddedItemSubDetailComponent element) throws IOException {
34697    if (element != null) {
34698      open(name);
34699      composeClaimResponseAddedItemSubDetailComponentInner(element);
34700      close();
34701    }
34702  }
34703
34704  protected void composeClaimResponseAddedItemSubDetailComponentInner(ClaimResponse.AddedItemSubDetailComponent element) throws IOException {
34705      composeBackbone(element);
34706      if (element.hasProductOrService()) {
34707        composeCodeableConcept("productOrService", element.getProductOrService());
34708      }
34709      if (element.hasModifier()) {
34710        openArray("modifier");
34711        for (CodeableConcept e : element.getModifier()) 
34712          composeCodeableConcept(null, e);
34713        closeArray();
34714      };
34715      if (element.hasQuantity()) {
34716        composeQuantity("quantity", element.getQuantity());
34717      }
34718      if (element.hasUnitPrice()) {
34719        composeMoney("unitPrice", element.getUnitPrice());
34720      }
34721      if (element.hasFactorElement()) {
34722        composeDecimalCore("factor", element.getFactorElement(), false);
34723        composeDecimalExtras("factor", element.getFactorElement(), false);
34724      }
34725      if (element.hasNet()) {
34726        composeMoney("net", element.getNet());
34727      }
34728      if (element.hasNoteNumber()) {
34729        openArray("noteNumber");
34730        for (PositiveIntType e : element.getNoteNumber()) 
34731          composePositiveIntCore(null, e, true);
34732        closeArray();
34733        if (anyHasExtras(element.getNoteNumber())) {
34734          openArray("_noteNumber");
34735          for (PositiveIntType e : element.getNoteNumber()) 
34736            composePositiveIntExtras(null, e, true);
34737          closeArray();
34738        }
34739      };
34740      if (element.hasAdjudication()) {
34741        openArray("adjudication");
34742        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
34743          composeClaimResponseAdjudicationComponent(null, e);
34744        closeArray();
34745      };
34746  }
34747
34748  protected void composeClaimResponseTotalComponent(String name, ClaimResponse.TotalComponent element) throws IOException {
34749    if (element != null) {
34750      open(name);
34751      composeClaimResponseTotalComponentInner(element);
34752      close();
34753    }
34754  }
34755
34756  protected void composeClaimResponseTotalComponentInner(ClaimResponse.TotalComponent element) throws IOException {
34757      composeBackbone(element);
34758      if (element.hasCategory()) {
34759        composeCodeableConcept("category", element.getCategory());
34760      }
34761      if (element.hasAmount()) {
34762        composeMoney("amount", element.getAmount());
34763      }
34764  }
34765
34766  protected void composeClaimResponsePaymentComponent(String name, ClaimResponse.PaymentComponent element) throws IOException {
34767    if (element != null) {
34768      open(name);
34769      composeClaimResponsePaymentComponentInner(element);
34770      close();
34771    }
34772  }
34773
34774  protected void composeClaimResponsePaymentComponentInner(ClaimResponse.PaymentComponent element) throws IOException {
34775      composeBackbone(element);
34776      if (element.hasType()) {
34777        composeCodeableConcept("type", element.getType());
34778      }
34779      if (element.hasAdjustment()) {
34780        composeMoney("adjustment", element.getAdjustment());
34781      }
34782      if (element.hasAdjustmentReason()) {
34783        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
34784      }
34785      if (element.hasDateElement()) {
34786        composeDateCore("date", element.getDateElement(), false);
34787        composeDateExtras("date", element.getDateElement(), false);
34788      }
34789      if (element.hasAmount()) {
34790        composeMoney("amount", element.getAmount());
34791      }
34792      if (element.hasIdentifier()) {
34793        composeIdentifier("identifier", element.getIdentifier());
34794      }
34795  }
34796
34797  protected void composeClaimResponseNoteComponent(String name, ClaimResponse.NoteComponent element) throws IOException {
34798    if (element != null) {
34799      open(name);
34800      composeClaimResponseNoteComponentInner(element);
34801      close();
34802    }
34803  }
34804
34805  protected void composeClaimResponseNoteComponentInner(ClaimResponse.NoteComponent element) throws IOException {
34806      composeBackbone(element);
34807      if (element.hasNumberElement()) {
34808        composePositiveIntCore("number", element.getNumberElement(), false);
34809        composePositiveIntExtras("number", element.getNumberElement(), false);
34810      }
34811      if (element.hasTypeElement()) {
34812        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
34813        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
34814      }
34815      if (element.hasTextElement()) {
34816        composeStringCore("text", element.getTextElement(), false);
34817        composeStringExtras("text", element.getTextElement(), false);
34818      }
34819      if (element.hasLanguage()) {
34820        composeCodeableConcept("language", element.getLanguage());
34821      }
34822  }
34823
34824  protected void composeClaimResponseInsuranceComponent(String name, ClaimResponse.InsuranceComponent element) throws IOException {
34825    if (element != null) {
34826      open(name);
34827      composeClaimResponseInsuranceComponentInner(element);
34828      close();
34829    }
34830  }
34831
34832  protected void composeClaimResponseInsuranceComponentInner(ClaimResponse.InsuranceComponent element) throws IOException {
34833      composeBackbone(element);
34834      if (element.hasSequenceElement()) {
34835        composePositiveIntCore("sequence", element.getSequenceElement(), false);
34836        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
34837      }
34838      if (element.hasFocalElement()) {
34839        composeBooleanCore("focal", element.getFocalElement(), false);
34840        composeBooleanExtras("focal", element.getFocalElement(), false);
34841      }
34842      if (element.hasCoverage()) {
34843        composeReference("coverage", element.getCoverage());
34844      }
34845      if (element.hasBusinessArrangementElement()) {
34846        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
34847        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
34848      }
34849      if (element.hasClaimResponse()) {
34850        composeReference("claimResponse", element.getClaimResponse());
34851      }
34852  }
34853
34854  protected void composeClaimResponseErrorComponent(String name, ClaimResponse.ErrorComponent element) throws IOException {
34855    if (element != null) {
34856      open(name);
34857      composeClaimResponseErrorComponentInner(element);
34858      close();
34859    }
34860  }
34861
34862  protected void composeClaimResponseErrorComponentInner(ClaimResponse.ErrorComponent element) throws IOException {
34863      composeBackbone(element);
34864      if (element.hasItemSequenceElement()) {
34865        composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
34866        composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
34867      }
34868      if (element.hasDetailSequenceElement()) {
34869        composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
34870        composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
34871      }
34872      if (element.hasSubDetailSequenceElement()) {
34873        composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
34874        composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
34875      }
34876      if (element.hasCode()) {
34877        composeCodeableConcept("code", element.getCode());
34878      }
34879  }
34880
34881  protected void composeClinicalImpression(String name, ClinicalImpression element) throws IOException {
34882    if (element != null) {
34883      prop("resourceType", name);
34884      composeClinicalImpressionInner(element);
34885    }
34886  }
34887
34888  protected void composeClinicalImpressionInner(ClinicalImpression element) throws IOException {
34889      composeDomainResourceElements(element);
34890      if (element.hasIdentifier()) {
34891        openArray("identifier");
34892        for (Identifier e : element.getIdentifier()) 
34893          composeIdentifier(null, e);
34894        closeArray();
34895      };
34896      if (element.hasStatusElement()) {
34897        composeEnumerationCore("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
34898        composeEnumerationExtras("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
34899      }
34900      if (element.hasStatusReason()) {
34901        composeCodeableConcept("statusReason", element.getStatusReason());
34902      }
34903      if (element.hasCode()) {
34904        composeCodeableConcept("code", element.getCode());
34905      }
34906      if (element.hasDescriptionElement()) {
34907        composeStringCore("description", element.getDescriptionElement(), false);
34908        composeStringExtras("description", element.getDescriptionElement(), false);
34909      }
34910      if (element.hasSubject()) {
34911        composeReference("subject", element.getSubject());
34912      }
34913      if (element.hasEncounter()) {
34914        composeReference("encounter", element.getEncounter());
34915      }
34916      if (element.hasEffective()) {
34917        composeType("effective", element.getEffective());
34918      }
34919      if (element.hasDateElement()) {
34920        composeDateTimeCore("date", element.getDateElement(), false);
34921        composeDateTimeExtras("date", element.getDateElement(), false);
34922      }
34923      if (element.hasAssessor()) {
34924        composeReference("assessor", element.getAssessor());
34925      }
34926      if (element.hasPrevious()) {
34927        composeReference("previous", element.getPrevious());
34928      }
34929      if (element.hasProblem()) {
34930        openArray("problem");
34931        for (Reference e : element.getProblem()) 
34932          composeReference(null, e);
34933        closeArray();
34934      };
34935      if (element.hasInvestigation()) {
34936        openArray("investigation");
34937        for (ClinicalImpression.ClinicalImpressionInvestigationComponent e : element.getInvestigation()) 
34938          composeClinicalImpressionClinicalImpressionInvestigationComponent(null, e);
34939        closeArray();
34940      };
34941      if (element.hasProtocol()) {
34942        openArray("protocol");
34943        for (UriType e : element.getProtocol()) 
34944          composeUriCore(null, e, true);
34945        closeArray();
34946        if (anyHasExtras(element.getProtocol())) {
34947          openArray("_protocol");
34948          for (UriType e : element.getProtocol()) 
34949            composeUriExtras(null, e, true);
34950          closeArray();
34951        }
34952      };
34953      if (element.hasSummaryElement()) {
34954        composeStringCore("summary", element.getSummaryElement(), false);
34955        composeStringExtras("summary", element.getSummaryElement(), false);
34956      }
34957      if (element.hasFinding()) {
34958        openArray("finding");
34959        for (ClinicalImpression.ClinicalImpressionFindingComponent e : element.getFinding()) 
34960          composeClinicalImpressionClinicalImpressionFindingComponent(null, e);
34961        closeArray();
34962      };
34963      if (element.hasPrognosisCodeableConcept()) {
34964        openArray("prognosisCodeableConcept");
34965        for (CodeableConcept e : element.getPrognosisCodeableConcept()) 
34966          composeCodeableConcept(null, e);
34967        closeArray();
34968      };
34969      if (element.hasPrognosisReference()) {
34970        openArray("prognosisReference");
34971        for (Reference e : element.getPrognosisReference()) 
34972          composeReference(null, e);
34973        closeArray();
34974      };
34975      if (element.hasSupportingInfo()) {
34976        openArray("supportingInfo");
34977        for (Reference e : element.getSupportingInfo()) 
34978          composeReference(null, e);
34979        closeArray();
34980      };
34981      if (element.hasNote()) {
34982        openArray("note");
34983        for (Annotation e : element.getNote()) 
34984          composeAnnotation(null, e);
34985        closeArray();
34986      };
34987  }
34988
34989  protected void composeClinicalImpressionClinicalImpressionInvestigationComponent(String name, ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
34990    if (element != null) {
34991      open(name);
34992      composeClinicalImpressionClinicalImpressionInvestigationComponentInner(element);
34993      close();
34994    }
34995  }
34996
34997  protected void composeClinicalImpressionClinicalImpressionInvestigationComponentInner(ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
34998      composeBackbone(element);
34999      if (element.hasCode()) {
35000        composeCodeableConcept("code", element.getCode());
35001      }
35002      if (element.hasItem()) {
35003        openArray("item");
35004        for (Reference e : element.getItem()) 
35005          composeReference(null, e);
35006        closeArray();
35007      };
35008  }
35009
35010  protected void composeClinicalImpressionClinicalImpressionFindingComponent(String name, ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
35011    if (element != null) {
35012      open(name);
35013      composeClinicalImpressionClinicalImpressionFindingComponentInner(element);
35014      close();
35015    }
35016  }
35017
35018  protected void composeClinicalImpressionClinicalImpressionFindingComponentInner(ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
35019      composeBackbone(element);
35020      if (element.hasItemCodeableConcept()) {
35021        composeCodeableConcept("itemCodeableConcept", element.getItemCodeableConcept());
35022      }
35023      if (element.hasItemReference()) {
35024        composeReference("itemReference", element.getItemReference());
35025      }
35026      if (element.hasBasisElement()) {
35027        composeStringCore("basis", element.getBasisElement(), false);
35028        composeStringExtras("basis", element.getBasisElement(), false);
35029      }
35030  }
35031
35032  protected void composeCodeSystem(String name, CodeSystem element) throws IOException {
35033    if (element != null) {
35034      prop("resourceType", name);
35035      composeCodeSystemInner(element);
35036    }
35037  }
35038
35039  protected void composeCodeSystemInner(CodeSystem element) throws IOException {
35040      composeDomainResourceElements(element);
35041      if (element.hasUrlElement()) {
35042        composeUriCore("url", element.getUrlElement(), false);
35043        composeUriExtras("url", element.getUrlElement(), false);
35044      }
35045      if (element.hasIdentifier()) {
35046        openArray("identifier");
35047        for (Identifier e : element.getIdentifier()) 
35048          composeIdentifier(null, e);
35049        closeArray();
35050      };
35051      if (element.hasVersionElement()) {
35052        composeStringCore("version", element.getVersionElement(), false);
35053        composeStringExtras("version", element.getVersionElement(), false);
35054      }
35055      if (element.hasNameElement()) {
35056        composeStringCore("name", element.getNameElement(), false);
35057        composeStringExtras("name", element.getNameElement(), false);
35058      }
35059      if (element.hasTitleElement()) {
35060        composeStringCore("title", element.getTitleElement(), false);
35061        composeStringExtras("title", element.getTitleElement(), false);
35062      }
35063      if (element.hasStatusElement()) {
35064        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35065        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35066      }
35067      if (element.hasExperimentalElement()) {
35068        composeBooleanCore("experimental", element.getExperimentalElement(), false);
35069        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35070      }
35071      if (element.hasDateElement()) {
35072        composeDateTimeCore("date", element.getDateElement(), false);
35073        composeDateTimeExtras("date", element.getDateElement(), false);
35074      }
35075      if (element.hasPublisherElement()) {
35076        composeStringCore("publisher", element.getPublisherElement(), false);
35077        composeStringExtras("publisher", element.getPublisherElement(), false);
35078      }
35079      if (element.hasContact()) {
35080        openArray("contact");
35081        for (ContactDetail e : element.getContact()) 
35082          composeContactDetail(null, e);
35083        closeArray();
35084      };
35085      if (element.hasDescriptionElement()) {
35086        composeMarkdownCore("description", element.getDescriptionElement(), false);
35087        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35088      }
35089      if (element.hasUseContext()) {
35090        openArray("useContext");
35091        for (UsageContext e : element.getUseContext()) 
35092          composeUsageContext(null, e);
35093        closeArray();
35094      };
35095      if (element.hasJurisdiction()) {
35096        openArray("jurisdiction");
35097        for (CodeableConcept e : element.getJurisdiction()) 
35098          composeCodeableConcept(null, e);
35099        closeArray();
35100      };
35101      if (element.hasPurposeElement()) {
35102        composeMarkdownCore("purpose", element.getPurposeElement(), false);
35103        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
35104      }
35105      if (element.hasCopyrightElement()) {
35106        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
35107        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
35108      }
35109      if (element.hasCaseSensitiveElement()) {
35110        composeBooleanCore("caseSensitive", element.getCaseSensitiveElement(), false);
35111        composeBooleanExtras("caseSensitive", element.getCaseSensitiveElement(), false);
35112      }
35113      if (element.hasValueSetElement()) {
35114        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
35115        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
35116      }
35117      if (element.hasHierarchyMeaningElement()) {
35118        composeEnumerationCore("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
35119        composeEnumerationExtras("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
35120      }
35121      if (element.hasCompositionalElement()) {
35122        composeBooleanCore("compositional", element.getCompositionalElement(), false);
35123        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
35124      }
35125      if (element.hasVersionNeededElement()) {
35126        composeBooleanCore("versionNeeded", element.getVersionNeededElement(), false);
35127        composeBooleanExtras("versionNeeded", element.getVersionNeededElement(), false);
35128      }
35129      if (element.hasContentElement()) {
35130        composeEnumerationCore("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
35131        composeEnumerationExtras("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
35132      }
35133      if (element.hasSupplementsElement()) {
35134        composeCanonicalCore("supplements", element.getSupplementsElement(), false);
35135        composeCanonicalExtras("supplements", element.getSupplementsElement(), false);
35136      }
35137      if (element.hasCountElement()) {
35138        composeUnsignedIntCore("count", element.getCountElement(), false);
35139        composeUnsignedIntExtras("count", element.getCountElement(), false);
35140      }
35141      if (element.hasFilter()) {
35142        openArray("filter");
35143        for (CodeSystem.CodeSystemFilterComponent e : element.getFilter()) 
35144          composeCodeSystemCodeSystemFilterComponent(null, e);
35145        closeArray();
35146      };
35147      if (element.hasProperty()) {
35148        openArray("property");
35149        for (CodeSystem.PropertyComponent e : element.getProperty()) 
35150          composeCodeSystemPropertyComponent(null, e);
35151        closeArray();
35152      };
35153      if (element.hasConcept()) {
35154        openArray("concept");
35155        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
35156          composeCodeSystemConceptDefinitionComponent(null, e);
35157        closeArray();
35158      };
35159  }
35160
35161  protected void composeCodeSystemCodeSystemFilterComponent(String name, CodeSystem.CodeSystemFilterComponent element) throws IOException {
35162    if (element != null) {
35163      open(name);
35164      composeCodeSystemCodeSystemFilterComponentInner(element);
35165      close();
35166    }
35167  }
35168
35169  protected void composeCodeSystemCodeSystemFilterComponentInner(CodeSystem.CodeSystemFilterComponent element) throws IOException {
35170      composeBackbone(element);
35171      if (element.hasCodeElement()) {
35172        composeCodeCore("code", element.getCodeElement(), false);
35173        composeCodeExtras("code", element.getCodeElement(), false);
35174      }
35175      if (element.hasDescriptionElement()) {
35176        composeStringCore("description", element.getDescriptionElement(), false);
35177        composeStringExtras("description", element.getDescriptionElement(), false);
35178      }
35179      if (element.hasOperator()) {
35180        openArray("operator");
35181        for (Enumeration<CodeSystem.FilterOperator> e : element.getOperator()) 
35182          composeEnumerationCore(null, e, new CodeSystem.FilterOperatorEnumFactory(), true);
35183        closeArray();
35184        if (anyHasExtras(element.getOperator())) {
35185          openArray("_operator");
35186          for (Enumeration<CodeSystem.FilterOperator> e : element.getOperator()) 
35187            composeEnumerationExtras(null, e, new CodeSystem.FilterOperatorEnumFactory(), true);
35188          closeArray();
35189        }
35190      };
35191      if (element.hasValueElement()) {
35192        composeStringCore("value", element.getValueElement(), false);
35193        composeStringExtras("value", element.getValueElement(), false);
35194      }
35195  }
35196
35197  protected void composeCodeSystemPropertyComponent(String name, CodeSystem.PropertyComponent element) throws IOException {
35198    if (element != null) {
35199      open(name);
35200      composeCodeSystemPropertyComponentInner(element);
35201      close();
35202    }
35203  }
35204
35205  protected void composeCodeSystemPropertyComponentInner(CodeSystem.PropertyComponent element) throws IOException {
35206      composeBackbone(element);
35207      if (element.hasCodeElement()) {
35208        composeCodeCore("code", element.getCodeElement(), false);
35209        composeCodeExtras("code", element.getCodeElement(), false);
35210      }
35211      if (element.hasUriElement()) {
35212        composeUriCore("uri", element.getUriElement(), false);
35213        composeUriExtras("uri", element.getUriElement(), false);
35214      }
35215      if (element.hasDescriptionElement()) {
35216        composeStringCore("description", element.getDescriptionElement(), false);
35217        composeStringExtras("description", element.getDescriptionElement(), false);
35218      }
35219      if (element.hasTypeElement()) {
35220        composeEnumerationCore("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
35221        composeEnumerationExtras("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
35222      }
35223  }
35224
35225  protected void composeCodeSystemConceptDefinitionComponent(String name, CodeSystem.ConceptDefinitionComponent element) throws IOException {
35226    if (element != null) {
35227      open(name);
35228      composeCodeSystemConceptDefinitionComponentInner(element);
35229      close();
35230    }
35231  }
35232
35233  protected void composeCodeSystemConceptDefinitionComponentInner(CodeSystem.ConceptDefinitionComponent element) throws IOException {
35234      composeBackbone(element);
35235      if (element.hasCodeElement()) {
35236        composeCodeCore("code", element.getCodeElement(), false);
35237        composeCodeExtras("code", element.getCodeElement(), false);
35238      }
35239      if (element.hasDisplayElement()) {
35240        composeStringCore("display", element.getDisplayElement(), false);
35241        composeStringExtras("display", element.getDisplayElement(), false);
35242      }
35243      if (element.hasDefinitionElement()) {
35244        composeStringCore("definition", element.getDefinitionElement(), false);
35245        composeStringExtras("definition", element.getDefinitionElement(), false);
35246      }
35247      if (element.hasDesignation()) {
35248        openArray("designation");
35249        for (CodeSystem.ConceptDefinitionDesignationComponent e : element.getDesignation()) 
35250          composeCodeSystemConceptDefinitionDesignationComponent(null, e);
35251        closeArray();
35252      };
35253      if (element.hasProperty()) {
35254        openArray("property");
35255        for (CodeSystem.ConceptPropertyComponent e : element.getProperty()) 
35256          composeCodeSystemConceptPropertyComponent(null, e);
35257        closeArray();
35258      };
35259      if (element.hasConcept()) {
35260        openArray("concept");
35261        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
35262          composeCodeSystemConceptDefinitionComponent(null, e);
35263        closeArray();
35264      };
35265  }
35266
35267  protected void composeCodeSystemConceptDefinitionDesignationComponent(String name, CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
35268    if (element != null) {
35269      open(name);
35270      composeCodeSystemConceptDefinitionDesignationComponentInner(element);
35271      close();
35272    }
35273  }
35274
35275  protected void composeCodeSystemConceptDefinitionDesignationComponentInner(CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
35276      composeBackbone(element);
35277      if (element.hasLanguageElement()) {
35278        composeCodeCore("language", element.getLanguageElement(), false);
35279        composeCodeExtras("language", element.getLanguageElement(), false);
35280      }
35281      if (element.hasUse()) {
35282        composeCoding("use", element.getUse());
35283      }
35284      if (element.hasValueElement()) {
35285        composeStringCore("value", element.getValueElement(), false);
35286        composeStringExtras("value", element.getValueElement(), false);
35287      }
35288  }
35289
35290  protected void composeCodeSystemConceptPropertyComponent(String name, CodeSystem.ConceptPropertyComponent element) throws IOException {
35291    if (element != null) {
35292      open(name);
35293      composeCodeSystemConceptPropertyComponentInner(element);
35294      close();
35295    }
35296  }
35297
35298  protected void composeCodeSystemConceptPropertyComponentInner(CodeSystem.ConceptPropertyComponent element) throws IOException {
35299      composeBackbone(element);
35300      if (element.hasCodeElement()) {
35301        composeCodeCore("code", element.getCodeElement(), false);
35302        composeCodeExtras("code", element.getCodeElement(), false);
35303      }
35304      if (element.hasValue()) {
35305        composeType("value", element.getValue());
35306      }
35307  }
35308
35309  protected void composeCommunication(String name, Communication element) throws IOException {
35310    if (element != null) {
35311      prop("resourceType", name);
35312      composeCommunicationInner(element);
35313    }
35314  }
35315
35316  protected void composeCommunicationInner(Communication element) throws IOException {
35317      composeDomainResourceElements(element);
35318      if (element.hasIdentifier()) {
35319        openArray("identifier");
35320        for (Identifier e : element.getIdentifier()) 
35321          composeIdentifier(null, e);
35322        closeArray();
35323      };
35324      if (element.hasInstantiatesCanonical()) {
35325        openArray("instantiatesCanonical");
35326        for (CanonicalType e : element.getInstantiatesCanonical()) 
35327          composeCanonicalCore(null, e, true);
35328        closeArray();
35329        if (anyHasExtras(element.getInstantiatesCanonical())) {
35330          openArray("_instantiatesCanonical");
35331          for (CanonicalType e : element.getInstantiatesCanonical()) 
35332            composeCanonicalExtras(null, e, true);
35333          closeArray();
35334        }
35335      };
35336      if (element.hasInstantiatesUri()) {
35337        openArray("instantiatesUri");
35338        for (UriType e : element.getInstantiatesUri()) 
35339          composeUriCore(null, e, true);
35340        closeArray();
35341        if (anyHasExtras(element.getInstantiatesUri())) {
35342          openArray("_instantiatesUri");
35343          for (UriType e : element.getInstantiatesUri()) 
35344            composeUriExtras(null, e, true);
35345          closeArray();
35346        }
35347      };
35348      if (element.hasBasedOn()) {
35349        openArray("basedOn");
35350        for (Reference e : element.getBasedOn()) 
35351          composeReference(null, e);
35352        closeArray();
35353      };
35354      if (element.hasPartOf()) {
35355        openArray("partOf");
35356        for (Reference e : element.getPartOf()) 
35357          composeReference(null, e);
35358        closeArray();
35359      };
35360      if (element.hasInResponseTo()) {
35361        openArray("inResponseTo");
35362        for (Reference e : element.getInResponseTo()) 
35363          composeReference(null, e);
35364        closeArray();
35365      };
35366      if (element.hasStatusElement()) {
35367        composeEnumerationCore("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
35368        composeEnumerationExtras("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
35369      }
35370      if (element.hasStatusReason()) {
35371        composeCodeableConcept("statusReason", element.getStatusReason());
35372      }
35373      if (element.hasCategory()) {
35374        openArray("category");
35375        for (CodeableConcept e : element.getCategory()) 
35376          composeCodeableConcept(null, e);
35377        closeArray();
35378      };
35379      if (element.hasPriorityElement()) {
35380        composeEnumerationCore("priority", element.getPriorityElement(), new Communication.CommunicationPriorityEnumFactory(), false);
35381        composeEnumerationExtras("priority", element.getPriorityElement(), new Communication.CommunicationPriorityEnumFactory(), false);
35382      }
35383      if (element.hasMedium()) {
35384        openArray("medium");
35385        for (CodeableConcept e : element.getMedium()) 
35386          composeCodeableConcept(null, e);
35387        closeArray();
35388      };
35389      if (element.hasSubject()) {
35390        composeReference("subject", element.getSubject());
35391      }
35392      if (element.hasTopic()) {
35393        composeCodeableConcept("topic", element.getTopic());
35394      }
35395      if (element.hasAbout()) {
35396        openArray("about");
35397        for (Reference e : element.getAbout()) 
35398          composeReference(null, e);
35399        closeArray();
35400      };
35401      if (element.hasEncounter()) {
35402        composeReference("encounter", element.getEncounter());
35403      }
35404      if (element.hasSentElement()) {
35405        composeDateTimeCore("sent", element.getSentElement(), false);
35406        composeDateTimeExtras("sent", element.getSentElement(), false);
35407      }
35408      if (element.hasReceivedElement()) {
35409        composeDateTimeCore("received", element.getReceivedElement(), false);
35410        composeDateTimeExtras("received", element.getReceivedElement(), false);
35411      }
35412      if (element.hasRecipient()) {
35413        openArray("recipient");
35414        for (Reference e : element.getRecipient()) 
35415          composeReference(null, e);
35416        closeArray();
35417      };
35418      if (element.hasSender()) {
35419        composeReference("sender", element.getSender());
35420      }
35421      if (element.hasReasonCode()) {
35422        openArray("reasonCode");
35423        for (CodeableConcept e : element.getReasonCode()) 
35424          composeCodeableConcept(null, e);
35425        closeArray();
35426      };
35427      if (element.hasReasonReference()) {
35428        openArray("reasonReference");
35429        for (Reference e : element.getReasonReference()) 
35430          composeReference(null, e);
35431        closeArray();
35432      };
35433      if (element.hasPayload()) {
35434        openArray("payload");
35435        for (Communication.CommunicationPayloadComponent e : element.getPayload()) 
35436          composeCommunicationCommunicationPayloadComponent(null, e);
35437        closeArray();
35438      };
35439      if (element.hasNote()) {
35440        openArray("note");
35441        for (Annotation e : element.getNote()) 
35442          composeAnnotation(null, e);
35443        closeArray();
35444      };
35445  }
35446
35447  protected void composeCommunicationCommunicationPayloadComponent(String name, Communication.CommunicationPayloadComponent element) throws IOException {
35448    if (element != null) {
35449      open(name);
35450      composeCommunicationCommunicationPayloadComponentInner(element);
35451      close();
35452    }
35453  }
35454
35455  protected void composeCommunicationCommunicationPayloadComponentInner(Communication.CommunicationPayloadComponent element) throws IOException {
35456      composeBackbone(element);
35457      if (element.hasContent()) {
35458        composeType("content", element.getContent());
35459      }
35460  }
35461
35462  protected void composeCommunicationRequest(String name, CommunicationRequest element) throws IOException {
35463    if (element != null) {
35464      prop("resourceType", name);
35465      composeCommunicationRequestInner(element);
35466    }
35467  }
35468
35469  protected void composeCommunicationRequestInner(CommunicationRequest element) throws IOException {
35470      composeDomainResourceElements(element);
35471      if (element.hasIdentifier()) {
35472        openArray("identifier");
35473        for (Identifier e : element.getIdentifier()) 
35474          composeIdentifier(null, e);
35475        closeArray();
35476      };
35477      if (element.hasBasedOn()) {
35478        openArray("basedOn");
35479        for (Reference e : element.getBasedOn()) 
35480          composeReference(null, e);
35481        closeArray();
35482      };
35483      if (element.hasReplaces()) {
35484        openArray("replaces");
35485        for (Reference e : element.getReplaces()) 
35486          composeReference(null, e);
35487        closeArray();
35488      };
35489      if (element.hasGroupIdentifier()) {
35490        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
35491      }
35492      if (element.hasStatusElement()) {
35493        composeEnumerationCore("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
35494        composeEnumerationExtras("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
35495      }
35496      if (element.hasStatusReason()) {
35497        composeCodeableConcept("statusReason", element.getStatusReason());
35498      }
35499      if (element.hasCategory()) {
35500        openArray("category");
35501        for (CodeableConcept e : element.getCategory()) 
35502          composeCodeableConcept(null, e);
35503        closeArray();
35504      };
35505      if (element.hasPriorityElement()) {
35506        composeEnumerationCore("priority", element.getPriorityElement(), new CommunicationRequest.CommunicationPriorityEnumFactory(), false);
35507        composeEnumerationExtras("priority", element.getPriorityElement(), new CommunicationRequest.CommunicationPriorityEnumFactory(), false);
35508      }
35509      if (element.hasDoNotPerformElement()) {
35510        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
35511        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
35512      }
35513      if (element.hasMedium()) {
35514        openArray("medium");
35515        for (CodeableConcept e : element.getMedium()) 
35516          composeCodeableConcept(null, e);
35517        closeArray();
35518      };
35519      if (element.hasSubject()) {
35520        composeReference("subject", element.getSubject());
35521      }
35522      if (element.hasAbout()) {
35523        openArray("about");
35524        for (Reference e : element.getAbout()) 
35525          composeReference(null, e);
35526        closeArray();
35527      };
35528      if (element.hasEncounter()) {
35529        composeReference("encounter", element.getEncounter());
35530      }
35531      if (element.hasPayload()) {
35532        openArray("payload");
35533        for (CommunicationRequest.CommunicationRequestPayloadComponent e : element.getPayload()) 
35534          composeCommunicationRequestCommunicationRequestPayloadComponent(null, e);
35535        closeArray();
35536      };
35537      if (element.hasOccurrence()) {
35538        composeType("occurrence", element.getOccurrence());
35539      }
35540      if (element.hasAuthoredOnElement()) {
35541        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
35542        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
35543      }
35544      if (element.hasRequester()) {
35545        composeReference("requester", element.getRequester());
35546      }
35547      if (element.hasRecipient()) {
35548        openArray("recipient");
35549        for (Reference e : element.getRecipient()) 
35550          composeReference(null, e);
35551        closeArray();
35552      };
35553      if (element.hasSender()) {
35554        composeReference("sender", element.getSender());
35555      }
35556      if (element.hasReasonCode()) {
35557        openArray("reasonCode");
35558        for (CodeableConcept e : element.getReasonCode()) 
35559          composeCodeableConcept(null, e);
35560        closeArray();
35561      };
35562      if (element.hasReasonReference()) {
35563        openArray("reasonReference");
35564        for (Reference e : element.getReasonReference()) 
35565          composeReference(null, e);
35566        closeArray();
35567      };
35568      if (element.hasNote()) {
35569        openArray("note");
35570        for (Annotation e : element.getNote()) 
35571          composeAnnotation(null, e);
35572        closeArray();
35573      };
35574  }
35575
35576  protected void composeCommunicationRequestCommunicationRequestPayloadComponent(String name, CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
35577    if (element != null) {
35578      open(name);
35579      composeCommunicationRequestCommunicationRequestPayloadComponentInner(element);
35580      close();
35581    }
35582  }
35583
35584  protected void composeCommunicationRequestCommunicationRequestPayloadComponentInner(CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
35585      composeBackbone(element);
35586      if (element.hasContent()) {
35587        composeType("content", element.getContent());
35588      }
35589  }
35590
35591  protected void composeCompartmentDefinition(String name, CompartmentDefinition element) throws IOException {
35592    if (element != null) {
35593      prop("resourceType", name);
35594      composeCompartmentDefinitionInner(element);
35595    }
35596  }
35597
35598  protected void composeCompartmentDefinitionInner(CompartmentDefinition element) throws IOException {
35599      composeDomainResourceElements(element);
35600      if (element.hasUrlElement()) {
35601        composeUriCore("url", element.getUrlElement(), false);
35602        composeUriExtras("url", element.getUrlElement(), false);
35603      }
35604      if (element.hasVersionElement()) {
35605        composeStringCore("version", element.getVersionElement(), false);
35606        composeStringExtras("version", element.getVersionElement(), false);
35607      }
35608      if (element.hasNameElement()) {
35609        composeStringCore("name", element.getNameElement(), false);
35610        composeStringExtras("name", element.getNameElement(), false);
35611      }
35612      if (element.hasStatusElement()) {
35613        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35614        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35615      }
35616      if (element.hasExperimentalElement()) {
35617        composeBooleanCore("experimental", element.getExperimentalElement(), false);
35618        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35619      }
35620      if (element.hasDateElement()) {
35621        composeDateTimeCore("date", element.getDateElement(), false);
35622        composeDateTimeExtras("date", element.getDateElement(), false);
35623      }
35624      if (element.hasPublisherElement()) {
35625        composeStringCore("publisher", element.getPublisherElement(), false);
35626        composeStringExtras("publisher", element.getPublisherElement(), false);
35627      }
35628      if (element.hasContact()) {
35629        openArray("contact");
35630        for (ContactDetail e : element.getContact()) 
35631          composeContactDetail(null, e);
35632        closeArray();
35633      };
35634      if (element.hasDescriptionElement()) {
35635        composeMarkdownCore("description", element.getDescriptionElement(), false);
35636        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35637      }
35638      if (element.hasUseContext()) {
35639        openArray("useContext");
35640        for (UsageContext e : element.getUseContext()) 
35641          composeUsageContext(null, e);
35642        closeArray();
35643      };
35644      if (element.hasPurposeElement()) {
35645        composeMarkdownCore("purpose", element.getPurposeElement(), false);
35646        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
35647      }
35648      if (element.hasCodeElement()) {
35649        composeEnumerationCore("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(), false);
35650        composeEnumerationExtras("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(), false);
35651      }
35652      if (element.hasSearchElement()) {
35653        composeBooleanCore("search", element.getSearchElement(), false);
35654        composeBooleanExtras("search", element.getSearchElement(), false);
35655      }
35656      if (element.hasResource()) {
35657        openArray("resource");
35658        for (CompartmentDefinition.CompartmentDefinitionResourceComponent e : element.getResource()) 
35659          composeCompartmentDefinitionCompartmentDefinitionResourceComponent(null, e);
35660        closeArray();
35661      };
35662  }
35663
35664  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponent(String name, CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
35665    if (element != null) {
35666      open(name);
35667      composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(element);
35668      close();
35669    }
35670  }
35671
35672  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
35673      composeBackbone(element);
35674      if (element.hasCodeElement()) {
35675        composeCodeCore("code", element.getCodeElement(), false);
35676        composeCodeExtras("code", element.getCodeElement(), false);
35677      }
35678      if (element.hasParam()) {
35679        openArray("param");
35680        for (StringType e : element.getParam()) 
35681          composeStringCore(null, e, true);
35682        closeArray();
35683        if (anyHasExtras(element.getParam())) {
35684          openArray("_param");
35685          for (StringType e : element.getParam()) 
35686            composeStringExtras(null, e, true);
35687          closeArray();
35688        }
35689      };
35690      if (element.hasDocumentationElement()) {
35691        composeStringCore("documentation", element.getDocumentationElement(), false);
35692        composeStringExtras("documentation", element.getDocumentationElement(), false);
35693      }
35694  }
35695
35696  protected void composeComposition(String name, Composition element) throws IOException {
35697    if (element != null) {
35698      prop("resourceType", name);
35699      composeCompositionInner(element);
35700    }
35701  }
35702
35703  protected void composeCompositionInner(Composition element) throws IOException {
35704      composeDomainResourceElements(element);
35705      if (element.hasIdentifier()) {
35706        composeIdentifier("identifier", element.getIdentifier());
35707      }
35708      if (element.hasStatusElement()) {
35709        composeEnumerationCore("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
35710        composeEnumerationExtras("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
35711      }
35712      if (element.hasType()) {
35713        composeCodeableConcept("type", element.getType());
35714      }
35715      if (element.hasCategory()) {
35716        openArray("category");
35717        for (CodeableConcept e : element.getCategory()) 
35718          composeCodeableConcept(null, e);
35719        closeArray();
35720      };
35721      if (element.hasSubject()) {
35722        composeReference("subject", element.getSubject());
35723      }
35724      if (element.hasEncounter()) {
35725        composeReference("encounter", element.getEncounter());
35726      }
35727      if (element.hasDateElement()) {
35728        composeDateTimeCore("date", element.getDateElement(), false);
35729        composeDateTimeExtras("date", element.getDateElement(), false);
35730      }
35731      if (element.hasAuthor()) {
35732        openArray("author");
35733        for (Reference e : element.getAuthor()) 
35734          composeReference(null, e);
35735        closeArray();
35736      };
35737      if (element.hasTitleElement()) {
35738        composeStringCore("title", element.getTitleElement(), false);
35739        composeStringExtras("title", element.getTitleElement(), false);
35740      }
35741      if (element.hasConfidentialityElement()) {
35742        composeEnumerationCore("confidentiality", element.getConfidentialityElement(), new Composition.DocumentConfidentialityEnumFactory(), false);
35743        composeEnumerationExtras("confidentiality", element.getConfidentialityElement(), new Composition.DocumentConfidentialityEnumFactory(), false);
35744      }
35745      if (element.hasAttester()) {
35746        openArray("attester");
35747        for (Composition.CompositionAttesterComponent e : element.getAttester()) 
35748          composeCompositionCompositionAttesterComponent(null, e);
35749        closeArray();
35750      };
35751      if (element.hasCustodian()) {
35752        composeReference("custodian", element.getCustodian());
35753      }
35754      if (element.hasRelatesTo()) {
35755        openArray("relatesTo");
35756        for (Composition.CompositionRelatesToComponent e : element.getRelatesTo()) 
35757          composeCompositionCompositionRelatesToComponent(null, e);
35758        closeArray();
35759      };
35760      if (element.hasEvent()) {
35761        openArray("event");
35762        for (Composition.CompositionEventComponent e : element.getEvent()) 
35763          composeCompositionCompositionEventComponent(null, e);
35764        closeArray();
35765      };
35766      if (element.hasSection()) {
35767        openArray("section");
35768        for (Composition.SectionComponent e : element.getSection()) 
35769          composeCompositionSectionComponent(null, e);
35770        closeArray();
35771      };
35772  }
35773
35774  protected void composeCompositionCompositionAttesterComponent(String name, Composition.CompositionAttesterComponent element) throws IOException {
35775    if (element != null) {
35776      open(name);
35777      composeCompositionCompositionAttesterComponentInner(element);
35778      close();
35779    }
35780  }
35781
35782  protected void composeCompositionCompositionAttesterComponentInner(Composition.CompositionAttesterComponent element) throws IOException {
35783      composeBackbone(element);
35784      if (element.hasModeElement()) {
35785        composeEnumerationCore("mode", element.getModeElement(), new Composition.CompositionAttestationModeEnumFactory(), false);
35786        composeEnumerationExtras("mode", element.getModeElement(), new Composition.CompositionAttestationModeEnumFactory(), false);
35787      }
35788      if (element.hasTimeElement()) {
35789        composeDateTimeCore("time", element.getTimeElement(), false);
35790        composeDateTimeExtras("time", element.getTimeElement(), false);
35791      }
35792      if (element.hasParty()) {
35793        composeReference("party", element.getParty());
35794      }
35795  }
35796
35797  protected void composeCompositionCompositionRelatesToComponent(String name, Composition.CompositionRelatesToComponent element) throws IOException {
35798    if (element != null) {
35799      open(name);
35800      composeCompositionCompositionRelatesToComponentInner(element);
35801      close();
35802    }
35803  }
35804
35805  protected void composeCompositionCompositionRelatesToComponentInner(Composition.CompositionRelatesToComponent element) throws IOException {
35806      composeBackbone(element);
35807      if (element.hasCodeElement()) {
35808        composeEnumerationCore("code", element.getCodeElement(), new Composition.DocumentRelationshipTypeEnumFactory(), false);
35809        composeEnumerationExtras("code", element.getCodeElement(), new Composition.DocumentRelationshipTypeEnumFactory(), false);
35810      }
35811      if (element.hasTarget()) {
35812        composeType("target", element.getTarget());
35813      }
35814  }
35815
35816  protected void composeCompositionCompositionEventComponent(String name, Composition.CompositionEventComponent element) throws IOException {
35817    if (element != null) {
35818      open(name);
35819      composeCompositionCompositionEventComponentInner(element);
35820      close();
35821    }
35822  }
35823
35824  protected void composeCompositionCompositionEventComponentInner(Composition.CompositionEventComponent element) throws IOException {
35825      composeBackbone(element);
35826      if (element.hasCode()) {
35827        openArray("code");
35828        for (CodeableConcept e : element.getCode()) 
35829          composeCodeableConcept(null, e);
35830        closeArray();
35831      };
35832      if (element.hasPeriod()) {
35833        composePeriod("period", element.getPeriod());
35834      }
35835      if (element.hasDetail()) {
35836        openArray("detail");
35837        for (Reference e : element.getDetail()) 
35838          composeReference(null, e);
35839        closeArray();
35840      };
35841  }
35842
35843  protected void composeCompositionSectionComponent(String name, Composition.SectionComponent element) throws IOException {
35844    if (element != null) {
35845      open(name);
35846      composeCompositionSectionComponentInner(element);
35847      close();
35848    }
35849  }
35850
35851  protected void composeCompositionSectionComponentInner(Composition.SectionComponent element) throws IOException {
35852      composeBackbone(element);
35853      if (element.hasTitleElement()) {
35854        composeStringCore("title", element.getTitleElement(), false);
35855        composeStringExtras("title", element.getTitleElement(), false);
35856      }
35857      if (element.hasCode()) {
35858        composeCodeableConcept("code", element.getCode());
35859      }
35860      if (element.hasAuthor()) {
35861        openArray("author");
35862        for (Reference e : element.getAuthor()) 
35863          composeReference(null, e);
35864        closeArray();
35865      };
35866      if (element.hasFocus()) {
35867        composeReference("focus", element.getFocus());
35868      }
35869      if (element.hasText()) {
35870        composeNarrative("text", element.getText());
35871      }
35872      if (element.hasModeElement()) {
35873        composeEnumerationCore("mode", element.getModeElement(), new Composition.SectionModeEnumFactory(), false);
35874        composeEnumerationExtras("mode", element.getModeElement(), new Composition.SectionModeEnumFactory(), false);
35875      }
35876      if (element.hasOrderedBy()) {
35877        composeCodeableConcept("orderedBy", element.getOrderedBy());
35878      }
35879      if (element.hasEntry()) {
35880        openArray("entry");
35881        for (Reference e : element.getEntry()) 
35882          composeReference(null, e);
35883        closeArray();
35884      };
35885      if (element.hasEmptyReason()) {
35886        composeCodeableConcept("emptyReason", element.getEmptyReason());
35887      }
35888      if (element.hasSection()) {
35889        openArray("section");
35890        for (Composition.SectionComponent e : element.getSection()) 
35891          composeCompositionSectionComponent(null, e);
35892        closeArray();
35893      };
35894  }
35895
35896  protected void composeConceptMap(String name, ConceptMap element) throws IOException {
35897    if (element != null) {
35898      prop("resourceType", name);
35899      composeConceptMapInner(element);
35900    }
35901  }
35902
35903  protected void composeConceptMapInner(ConceptMap element) throws IOException {
35904      composeDomainResourceElements(element);
35905      if (element.hasUrlElement()) {
35906        composeUriCore("url", element.getUrlElement(), false);
35907        composeUriExtras("url", element.getUrlElement(), false);
35908      }
35909      if (element.hasIdentifier()) {
35910        composeIdentifier("identifier", element.getIdentifier());
35911      }
35912      if (element.hasVersionElement()) {
35913        composeStringCore("version", element.getVersionElement(), false);
35914        composeStringExtras("version", element.getVersionElement(), false);
35915      }
35916      if (element.hasNameElement()) {
35917        composeStringCore("name", element.getNameElement(), false);
35918        composeStringExtras("name", element.getNameElement(), false);
35919      }
35920      if (element.hasTitleElement()) {
35921        composeStringCore("title", element.getTitleElement(), false);
35922        composeStringExtras("title", element.getTitleElement(), false);
35923      }
35924      if (element.hasStatusElement()) {
35925        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35926        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35927      }
35928      if (element.hasExperimentalElement()) {
35929        composeBooleanCore("experimental", element.getExperimentalElement(), false);
35930        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35931      }
35932      if (element.hasDateElement()) {
35933        composeDateTimeCore("date", element.getDateElement(), false);
35934        composeDateTimeExtras("date", element.getDateElement(), false);
35935      }
35936      if (element.hasPublisherElement()) {
35937        composeStringCore("publisher", element.getPublisherElement(), false);
35938        composeStringExtras("publisher", element.getPublisherElement(), false);
35939      }
35940      if (element.hasContact()) {
35941        openArray("contact");
35942        for (ContactDetail e : element.getContact()) 
35943          composeContactDetail(null, e);
35944        closeArray();
35945      };
35946      if (element.hasDescriptionElement()) {
35947        composeMarkdownCore("description", element.getDescriptionElement(), false);
35948        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35949      }
35950      if (element.hasUseContext()) {
35951        openArray("useContext");
35952        for (UsageContext e : element.getUseContext()) 
35953          composeUsageContext(null, e);
35954        closeArray();
35955      };
35956      if (element.hasJurisdiction()) {
35957        openArray("jurisdiction");
35958        for (CodeableConcept e : element.getJurisdiction()) 
35959          composeCodeableConcept(null, e);
35960        closeArray();
35961      };
35962      if (element.hasPurposeElement()) {
35963        composeMarkdownCore("purpose", element.getPurposeElement(), false);
35964        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
35965      }
35966      if (element.hasCopyrightElement()) {
35967        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
35968        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
35969      }
35970      if (element.hasSource()) {
35971        composeType("source", element.getSource());
35972      }
35973      if (element.hasTarget()) {
35974        composeType("target", element.getTarget());
35975      }
35976      if (element.hasGroup()) {
35977        openArray("group");
35978        for (ConceptMap.ConceptMapGroupComponent e : element.getGroup()) 
35979          composeConceptMapConceptMapGroupComponent(null, e);
35980        closeArray();
35981      };
35982  }
35983
35984  protected void composeConceptMapConceptMapGroupComponent(String name, ConceptMap.ConceptMapGroupComponent element) throws IOException {
35985    if (element != null) {
35986      open(name);
35987      composeConceptMapConceptMapGroupComponentInner(element);
35988      close();
35989    }
35990  }
35991
35992  protected void composeConceptMapConceptMapGroupComponentInner(ConceptMap.ConceptMapGroupComponent element) throws IOException {
35993      composeBackbone(element);
35994      if (element.hasSourceElement()) {
35995        composeUriCore("source", element.getSourceElement(), false);
35996        composeUriExtras("source", element.getSourceElement(), false);
35997      }
35998      if (element.hasSourceVersionElement()) {
35999        composeStringCore("sourceVersion", element.getSourceVersionElement(), false);
36000        composeStringExtras("sourceVersion", element.getSourceVersionElement(), false);
36001      }
36002      if (element.hasTargetElement()) {
36003        composeUriCore("target", element.getTargetElement(), false);
36004        composeUriExtras("target", element.getTargetElement(), false);
36005      }
36006      if (element.hasTargetVersionElement()) {
36007        composeStringCore("targetVersion", element.getTargetVersionElement(), false);
36008        composeStringExtras("targetVersion", element.getTargetVersionElement(), false);
36009      }
36010      if (element.hasElement()) {
36011        openArray("element");
36012        for (ConceptMap.SourceElementComponent e : element.getElement()) 
36013          composeConceptMapSourceElementComponent(null, e);
36014        closeArray();
36015      };
36016      if (element.hasUnmapped()) {
36017        composeConceptMapConceptMapGroupUnmappedComponent("unmapped", element.getUnmapped());
36018      }
36019  }
36020
36021  protected void composeConceptMapSourceElementComponent(String name, ConceptMap.SourceElementComponent element) throws IOException {
36022    if (element != null) {
36023      open(name);
36024      composeConceptMapSourceElementComponentInner(element);
36025      close();
36026    }
36027  }
36028
36029  protected void composeConceptMapSourceElementComponentInner(ConceptMap.SourceElementComponent element) throws IOException {
36030      composeBackbone(element);
36031      if (element.hasCodeElement()) {
36032        composeCodeCore("code", element.getCodeElement(), false);
36033        composeCodeExtras("code", element.getCodeElement(), false);
36034      }
36035      if (element.hasDisplayElement()) {
36036        composeStringCore("display", element.getDisplayElement(), false);
36037        composeStringExtras("display", element.getDisplayElement(), false);
36038      }
36039      if (element.hasTarget()) {
36040        openArray("target");
36041        for (ConceptMap.TargetElementComponent e : element.getTarget()) 
36042          composeConceptMapTargetElementComponent(null, e);
36043        closeArray();
36044      };
36045  }
36046
36047  protected void composeConceptMapTargetElementComponent(String name, ConceptMap.TargetElementComponent element) throws IOException {
36048    if (element != null) {
36049      open(name);
36050      composeConceptMapTargetElementComponentInner(element);
36051      close();
36052    }
36053  }
36054
36055  protected void composeConceptMapTargetElementComponentInner(ConceptMap.TargetElementComponent element) throws IOException {
36056      composeBackbone(element);
36057      if (element.hasCodeElement()) {
36058        composeCodeCore("code", element.getCodeElement(), false);
36059        composeCodeExtras("code", element.getCodeElement(), false);
36060      }
36061      if (element.hasDisplayElement()) {
36062        composeStringCore("display", element.getDisplayElement(), false);
36063        composeStringExtras("display", element.getDisplayElement(), false);
36064      }
36065      if (element.hasEquivalenceElement()) {
36066        composeEnumerationCore("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
36067        composeEnumerationExtras("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
36068      }
36069      if (element.hasCommentElement()) {
36070        composeStringCore("comment", element.getCommentElement(), false);
36071        composeStringExtras("comment", element.getCommentElement(), false);
36072      }
36073      if (element.hasDependsOn()) {
36074        openArray("dependsOn");
36075        for (ConceptMap.OtherElementComponent e : element.getDependsOn()) 
36076          composeConceptMapOtherElementComponent(null, e);
36077        closeArray();
36078      };
36079      if (element.hasProduct()) {
36080        openArray("product");
36081        for (ConceptMap.OtherElementComponent e : element.getProduct()) 
36082          composeConceptMapOtherElementComponent(null, e);
36083        closeArray();
36084      };
36085  }
36086
36087  protected void composeConceptMapOtherElementComponent(String name, ConceptMap.OtherElementComponent element) throws IOException {
36088    if (element != null) {
36089      open(name);
36090      composeConceptMapOtherElementComponentInner(element);
36091      close();
36092    }
36093  }
36094
36095  protected void composeConceptMapOtherElementComponentInner(ConceptMap.OtherElementComponent element) throws IOException {
36096      composeBackbone(element);
36097      if (element.hasPropertyElement()) {
36098        composeUriCore("property", element.getPropertyElement(), false);
36099        composeUriExtras("property", element.getPropertyElement(), false);
36100      }
36101      if (element.hasSystemElement()) {
36102        composeCanonicalCore("system", element.getSystemElement(), false);
36103        composeCanonicalExtras("system", element.getSystemElement(), false);
36104      }
36105      if (element.hasValueElement()) {
36106        composeStringCore("value", element.getValueElement(), false);
36107        composeStringExtras("value", element.getValueElement(), false);
36108      }
36109      if (element.hasDisplayElement()) {
36110        composeStringCore("display", element.getDisplayElement(), false);
36111        composeStringExtras("display", element.getDisplayElement(), false);
36112      }
36113  }
36114
36115  protected void composeConceptMapConceptMapGroupUnmappedComponent(String name, ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
36116    if (element != null) {
36117      open(name);
36118      composeConceptMapConceptMapGroupUnmappedComponentInner(element);
36119      close();
36120    }
36121  }
36122
36123  protected void composeConceptMapConceptMapGroupUnmappedComponentInner(ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
36124      composeBackbone(element);
36125      if (element.hasModeElement()) {
36126        composeEnumerationCore("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
36127        composeEnumerationExtras("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
36128      }
36129      if (element.hasCodeElement()) {
36130        composeCodeCore("code", element.getCodeElement(), false);
36131        composeCodeExtras("code", element.getCodeElement(), false);
36132      }
36133      if (element.hasDisplayElement()) {
36134        composeStringCore("display", element.getDisplayElement(), false);
36135        composeStringExtras("display", element.getDisplayElement(), false);
36136      }
36137      if (element.hasUrlElement()) {
36138        composeCanonicalCore("url", element.getUrlElement(), false);
36139        composeCanonicalExtras("url", element.getUrlElement(), false);
36140      }
36141  }
36142
36143  protected void composeCondition(String name, Condition element) throws IOException {
36144    if (element != null) {
36145      prop("resourceType", name);
36146      composeConditionInner(element);
36147    }
36148  }
36149
36150  protected void composeConditionInner(Condition element) throws IOException {
36151      composeDomainResourceElements(element);
36152      if (element.hasIdentifier()) {
36153        openArray("identifier");
36154        for (Identifier e : element.getIdentifier()) 
36155          composeIdentifier(null, e);
36156        closeArray();
36157      };
36158      if (element.hasClinicalStatus()) {
36159        composeCodeableConcept("clinicalStatus", element.getClinicalStatus());
36160      }
36161      if (element.hasVerificationStatus()) {
36162        composeCodeableConcept("verificationStatus", element.getVerificationStatus());
36163      }
36164      if (element.hasCategory()) {
36165        openArray("category");
36166        for (CodeableConcept e : element.getCategory()) 
36167          composeCodeableConcept(null, e);
36168        closeArray();
36169      };
36170      if (element.hasSeverity()) {
36171        composeCodeableConcept("severity", element.getSeverity());
36172      }
36173      if (element.hasCode()) {
36174        composeCodeableConcept("code", element.getCode());
36175      }
36176      if (element.hasBodySite()) {
36177        openArray("bodySite");
36178        for (CodeableConcept e : element.getBodySite()) 
36179          composeCodeableConcept(null, e);
36180        closeArray();
36181      };
36182      if (element.hasSubject()) {
36183        composeReference("subject", element.getSubject());
36184      }
36185      if (element.hasEncounter()) {
36186        composeReference("encounter", element.getEncounter());
36187      }
36188      if (element.hasOnset()) {
36189        composeType("onset", element.getOnset());
36190      }
36191      if (element.hasAbatement()) {
36192        composeType("abatement", element.getAbatement());
36193      }
36194      if (element.hasRecordedDateElement()) {
36195        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
36196        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
36197      }
36198      if (element.hasRecorder()) {
36199        composeReference("recorder", element.getRecorder());
36200      }
36201      if (element.hasAsserter()) {
36202        composeReference("asserter", element.getAsserter());
36203      }
36204      if (element.hasStage()) {
36205        openArray("stage");
36206        for (Condition.ConditionStageComponent e : element.getStage()) 
36207          composeConditionConditionStageComponent(null, e);
36208        closeArray();
36209      };
36210      if (element.hasEvidence()) {
36211        openArray("evidence");
36212        for (Condition.ConditionEvidenceComponent e : element.getEvidence()) 
36213          composeConditionConditionEvidenceComponent(null, e);
36214        closeArray();
36215      };
36216      if (element.hasNote()) {
36217        openArray("note");
36218        for (Annotation e : element.getNote()) 
36219          composeAnnotation(null, e);
36220        closeArray();
36221      };
36222  }
36223
36224  protected void composeConditionConditionStageComponent(String name, Condition.ConditionStageComponent element) throws IOException {
36225    if (element != null) {
36226      open(name);
36227      composeConditionConditionStageComponentInner(element);
36228      close();
36229    }
36230  }
36231
36232  protected void composeConditionConditionStageComponentInner(Condition.ConditionStageComponent element) throws IOException {
36233      composeBackbone(element);
36234      if (element.hasSummary()) {
36235        composeCodeableConcept("summary", element.getSummary());
36236      }
36237      if (element.hasAssessment()) {
36238        openArray("assessment");
36239        for (Reference e : element.getAssessment()) 
36240          composeReference(null, e);
36241        closeArray();
36242      };
36243      if (element.hasType()) {
36244        composeCodeableConcept("type", element.getType());
36245      }
36246  }
36247
36248  protected void composeConditionConditionEvidenceComponent(String name, Condition.ConditionEvidenceComponent element) throws IOException {
36249    if (element != null) {
36250      open(name);
36251      composeConditionConditionEvidenceComponentInner(element);
36252      close();
36253    }
36254  }
36255
36256  protected void composeConditionConditionEvidenceComponentInner(Condition.ConditionEvidenceComponent element) throws IOException {
36257      composeBackbone(element);
36258      if (element.hasCode()) {
36259        openArray("code");
36260        for (CodeableConcept e : element.getCode()) 
36261          composeCodeableConcept(null, e);
36262        closeArray();
36263      };
36264      if (element.hasDetail()) {
36265        openArray("detail");
36266        for (Reference e : element.getDetail()) 
36267          composeReference(null, e);
36268        closeArray();
36269      };
36270  }
36271
36272  protected void composeConsent(String name, Consent element) throws IOException {
36273    if (element != null) {
36274      prop("resourceType", name);
36275      composeConsentInner(element);
36276    }
36277  }
36278
36279  protected void composeConsentInner(Consent element) throws IOException {
36280      composeDomainResourceElements(element);
36281      if (element.hasIdentifier()) {
36282        openArray("identifier");
36283        for (Identifier e : element.getIdentifier()) 
36284          composeIdentifier(null, e);
36285        closeArray();
36286      };
36287      if (element.hasStatusElement()) {
36288        composeEnumerationCore("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
36289        composeEnumerationExtras("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
36290      }
36291      if (element.hasScope()) {
36292        composeCodeableConcept("scope", element.getScope());
36293      }
36294      if (element.hasCategory()) {
36295        openArray("category");
36296        for (CodeableConcept e : element.getCategory()) 
36297          composeCodeableConcept(null, e);
36298        closeArray();
36299      };
36300      if (element.hasPatient()) {
36301        composeReference("patient", element.getPatient());
36302      }
36303      if (element.hasDateTimeElement()) {
36304        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
36305        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
36306      }
36307      if (element.hasPerformer()) {
36308        openArray("performer");
36309        for (Reference e : element.getPerformer()) 
36310          composeReference(null, e);
36311        closeArray();
36312      };
36313      if (element.hasOrganization()) {
36314        openArray("organization");
36315        for (Reference e : element.getOrganization()) 
36316          composeReference(null, e);
36317        closeArray();
36318      };
36319      if (element.hasSource()) {
36320        composeType("source", element.getSource());
36321      }
36322      if (element.hasPolicy()) {
36323        openArray("policy");
36324        for (Consent.ConsentPolicyComponent e : element.getPolicy()) 
36325          composeConsentConsentPolicyComponent(null, e);
36326        closeArray();
36327      };
36328      if (element.hasPolicyRule()) {
36329        composeCodeableConcept("policyRule", element.getPolicyRule());
36330      }
36331      if (element.hasVerification()) {
36332        openArray("verification");
36333        for (Consent.ConsentVerificationComponent e : element.getVerification()) 
36334          composeConsentConsentVerificationComponent(null, e);
36335        closeArray();
36336      };
36337      if (element.hasProvision()) {
36338        composeConsentprovisionComponent("provision", element.getProvision());
36339      }
36340  }
36341
36342  protected void composeConsentConsentPolicyComponent(String name, Consent.ConsentPolicyComponent element) throws IOException {
36343    if (element != null) {
36344      open(name);
36345      composeConsentConsentPolicyComponentInner(element);
36346      close();
36347    }
36348  }
36349
36350  protected void composeConsentConsentPolicyComponentInner(Consent.ConsentPolicyComponent element) throws IOException {
36351      composeBackbone(element);
36352      if (element.hasAuthorityElement()) {
36353        composeUriCore("authority", element.getAuthorityElement(), false);
36354        composeUriExtras("authority", element.getAuthorityElement(), false);
36355      }
36356      if (element.hasUriElement()) {
36357        composeUriCore("uri", element.getUriElement(), false);
36358        composeUriExtras("uri", element.getUriElement(), false);
36359      }
36360  }
36361
36362  protected void composeConsentConsentVerificationComponent(String name, Consent.ConsentVerificationComponent element) throws IOException {
36363    if (element != null) {
36364      open(name);
36365      composeConsentConsentVerificationComponentInner(element);
36366      close();
36367    }
36368  }
36369
36370  protected void composeConsentConsentVerificationComponentInner(Consent.ConsentVerificationComponent element) throws IOException {
36371      composeBackbone(element);
36372      if (element.hasVerifiedElement()) {
36373        composeBooleanCore("verified", element.getVerifiedElement(), false);
36374        composeBooleanExtras("verified", element.getVerifiedElement(), false);
36375      }
36376      if (element.hasVerifiedWith()) {
36377        composeReference("verifiedWith", element.getVerifiedWith());
36378      }
36379      if (element.hasVerificationDateElement()) {
36380        composeDateTimeCore("verificationDate", element.getVerificationDateElement(), false);
36381        composeDateTimeExtras("verificationDate", element.getVerificationDateElement(), false);
36382      }
36383  }
36384
36385  protected void composeConsentprovisionComponent(String name, Consent.provisionComponent element) throws IOException {
36386    if (element != null) {
36387      open(name);
36388      composeConsentprovisionComponentInner(element);
36389      close();
36390    }
36391  }
36392
36393  protected void composeConsentprovisionComponentInner(Consent.provisionComponent element) throws IOException {
36394      composeBackbone(element);
36395      if (element.hasTypeElement()) {
36396        composeEnumerationCore("type", element.getTypeElement(), new Consent.ConsentProvisionTypeEnumFactory(), false);
36397        composeEnumerationExtras("type", element.getTypeElement(), new Consent.ConsentProvisionTypeEnumFactory(), false);
36398      }
36399      if (element.hasPeriod()) {
36400        composePeriod("period", element.getPeriod());
36401      }
36402      if (element.hasActor()) {
36403        openArray("actor");
36404        for (Consent.provisionActorComponent e : element.getActor()) 
36405          composeConsentprovisionActorComponent(null, e);
36406        closeArray();
36407      };
36408      if (element.hasAction()) {
36409        openArray("action");
36410        for (CodeableConcept e : element.getAction()) 
36411          composeCodeableConcept(null, e);
36412        closeArray();
36413      };
36414      if (element.hasSecurityLabel()) {
36415        openArray("securityLabel");
36416        for (Coding e : element.getSecurityLabel()) 
36417          composeCoding(null, e);
36418        closeArray();
36419      };
36420      if (element.hasPurpose()) {
36421        openArray("purpose");
36422        for (Coding e : element.getPurpose()) 
36423          composeCoding(null, e);
36424        closeArray();
36425      };
36426      if (element.hasClass_()) {
36427        openArray("class");
36428        for (Coding e : element.getClass_()) 
36429          composeCoding(null, e);
36430        closeArray();
36431      };
36432      if (element.hasCode()) {
36433        openArray("code");
36434        for (CodeableConcept e : element.getCode()) 
36435          composeCodeableConcept(null, e);
36436        closeArray();
36437      };
36438      if (element.hasDataPeriod()) {
36439        composePeriod("dataPeriod", element.getDataPeriod());
36440      }
36441      if (element.hasData()) {
36442        openArray("data");
36443        for (Consent.provisionDataComponent e : element.getData()) 
36444          composeConsentprovisionDataComponent(null, e);
36445        closeArray();
36446      };
36447      if (element.hasProvision()) {
36448        openArray("provision");
36449        for (Consent.provisionComponent e : element.getProvision()) 
36450          composeConsentprovisionComponent(null, e);
36451        closeArray();
36452      };
36453  }
36454
36455  protected void composeConsentprovisionActorComponent(String name, Consent.provisionActorComponent element) throws IOException {
36456    if (element != null) {
36457      open(name);
36458      composeConsentprovisionActorComponentInner(element);
36459      close();
36460    }
36461  }
36462
36463  protected void composeConsentprovisionActorComponentInner(Consent.provisionActorComponent element) throws IOException {
36464      composeBackbone(element);
36465      if (element.hasRole()) {
36466        composeCodeableConcept("role", element.getRole());
36467      }
36468      if (element.hasReference()) {
36469        composeReference("reference", element.getReference());
36470      }
36471  }
36472
36473  protected void composeConsentprovisionDataComponent(String name, Consent.provisionDataComponent element) throws IOException {
36474    if (element != null) {
36475      open(name);
36476      composeConsentprovisionDataComponentInner(element);
36477      close();
36478    }
36479  }
36480
36481  protected void composeConsentprovisionDataComponentInner(Consent.provisionDataComponent element) throws IOException {
36482      composeBackbone(element);
36483      if (element.hasMeaningElement()) {
36484        composeEnumerationCore("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
36485        composeEnumerationExtras("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
36486      }
36487      if (element.hasReference()) {
36488        composeReference("reference", element.getReference());
36489      }
36490  }
36491
36492  protected void composeContract(String name, Contract element) throws IOException {
36493    if (element != null) {
36494      prop("resourceType", name);
36495      composeContractInner(element);
36496    }
36497  }
36498
36499  protected void composeContractInner(Contract element) throws IOException {
36500      composeDomainResourceElements(element);
36501      if (element.hasIdentifier()) {
36502        openArray("identifier");
36503        for (Identifier e : element.getIdentifier()) 
36504          composeIdentifier(null, e);
36505        closeArray();
36506      };
36507      if (element.hasUrlElement()) {
36508        composeUriCore("url", element.getUrlElement(), false);
36509        composeUriExtras("url", element.getUrlElement(), false);
36510      }
36511      if (element.hasVersionElement()) {
36512        composeStringCore("version", element.getVersionElement(), false);
36513        composeStringExtras("version", element.getVersionElement(), false);
36514      }
36515      if (element.hasStatusElement()) {
36516        composeEnumerationCore("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory(), false);
36517        composeEnumerationExtras("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory(), false);
36518      }
36519      if (element.hasLegalState()) {
36520        composeCodeableConcept("legalState", element.getLegalState());
36521      }
36522      if (element.hasInstantiatesCanonical()) {
36523        composeReference("instantiatesCanonical", element.getInstantiatesCanonical());
36524      }
36525      if (element.hasInstantiatesUriElement()) {
36526        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
36527        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
36528      }
36529      if (element.hasContentDerivative()) {
36530        composeCodeableConcept("contentDerivative", element.getContentDerivative());
36531      }
36532      if (element.hasIssuedElement()) {
36533        composeDateTimeCore("issued", element.getIssuedElement(), false);
36534        composeDateTimeExtras("issued", element.getIssuedElement(), false);
36535      }
36536      if (element.hasApplies()) {
36537        composePeriod("applies", element.getApplies());
36538      }
36539      if (element.hasExpirationType()) {
36540        composeCodeableConcept("expirationType", element.getExpirationType());
36541      }
36542      if (element.hasSubject()) {
36543        openArray("subject");
36544        for (Reference e : element.getSubject()) 
36545          composeReference(null, e);
36546        closeArray();
36547      };
36548      if (element.hasAuthority()) {
36549        openArray("authority");
36550        for (Reference e : element.getAuthority()) 
36551          composeReference(null, e);
36552        closeArray();
36553      };
36554      if (element.hasDomain()) {
36555        openArray("domain");
36556        for (Reference e : element.getDomain()) 
36557          composeReference(null, e);
36558        closeArray();
36559      };
36560      if (element.hasSite()) {
36561        openArray("site");
36562        for (Reference e : element.getSite()) 
36563          composeReference(null, e);
36564        closeArray();
36565      };
36566      if (element.hasNameElement()) {
36567        composeStringCore("name", element.getNameElement(), false);
36568        composeStringExtras("name", element.getNameElement(), false);
36569      }
36570      if (element.hasTitleElement()) {
36571        composeStringCore("title", element.getTitleElement(), false);
36572        composeStringExtras("title", element.getTitleElement(), false);
36573      }
36574      if (element.hasSubtitleElement()) {
36575        composeStringCore("subtitle", element.getSubtitleElement(), false);
36576        composeStringExtras("subtitle", element.getSubtitleElement(), false);
36577      }
36578      if (element.hasAlias()) {
36579        openArray("alias");
36580        for (StringType e : element.getAlias()) 
36581          composeStringCore(null, e, true);
36582        closeArray();
36583        if (anyHasExtras(element.getAlias())) {
36584          openArray("_alias");
36585          for (StringType e : element.getAlias()) 
36586            composeStringExtras(null, e, true);
36587          closeArray();
36588        }
36589      };
36590      if (element.hasAuthor()) {
36591        composeReference("author", element.getAuthor());
36592      }
36593      if (element.hasScope()) {
36594        composeCodeableConcept("scope", element.getScope());
36595      }
36596      if (element.hasTopic()) {
36597        composeType("topic", element.getTopic());
36598      }
36599      if (element.hasType()) {
36600        composeCodeableConcept("type", element.getType());
36601      }
36602      if (element.hasSubType()) {
36603        openArray("subType");
36604        for (CodeableConcept e : element.getSubType()) 
36605          composeCodeableConcept(null, e);
36606        closeArray();
36607      };
36608      if (element.hasContentDefinition()) {
36609        composeContractContentDefinitionComponent("contentDefinition", element.getContentDefinition());
36610      }
36611      if (element.hasTerm()) {
36612        openArray("term");
36613        for (Contract.TermComponent e : element.getTerm()) 
36614          composeContractTermComponent(null, e);
36615        closeArray();
36616      };
36617      if (element.hasSupportingInfo()) {
36618        openArray("supportingInfo");
36619        for (Reference e : element.getSupportingInfo()) 
36620          composeReference(null, e);
36621        closeArray();
36622      };
36623      if (element.hasRelevantHistory()) {
36624        openArray("relevantHistory");
36625        for (Reference e : element.getRelevantHistory()) 
36626          composeReference(null, e);
36627        closeArray();
36628      };
36629      if (element.hasSigner()) {
36630        openArray("signer");
36631        for (Contract.SignatoryComponent e : element.getSigner()) 
36632          composeContractSignatoryComponent(null, e);
36633        closeArray();
36634      };
36635      if (element.hasFriendly()) {
36636        openArray("friendly");
36637        for (Contract.FriendlyLanguageComponent e : element.getFriendly()) 
36638          composeContractFriendlyLanguageComponent(null, e);
36639        closeArray();
36640      };
36641      if (element.hasLegal()) {
36642        openArray("legal");
36643        for (Contract.LegalLanguageComponent e : element.getLegal()) 
36644          composeContractLegalLanguageComponent(null, e);
36645        closeArray();
36646      };
36647      if (element.hasRule()) {
36648        openArray("rule");
36649        for (Contract.ComputableLanguageComponent e : element.getRule()) 
36650          composeContractComputableLanguageComponent(null, e);
36651        closeArray();
36652      };
36653      if (element.hasLegallyBinding()) {
36654        composeType("legallyBinding", element.getLegallyBinding());
36655      }
36656  }
36657
36658  protected void composeContractContentDefinitionComponent(String name, Contract.ContentDefinitionComponent element) throws IOException {
36659    if (element != null) {
36660      open(name);
36661      composeContractContentDefinitionComponentInner(element);
36662      close();
36663    }
36664  }
36665
36666  protected void composeContractContentDefinitionComponentInner(Contract.ContentDefinitionComponent element) throws IOException {
36667      composeBackbone(element);
36668      if (element.hasType()) {
36669        composeCodeableConcept("type", element.getType());
36670      }
36671      if (element.hasSubType()) {
36672        composeCodeableConcept("subType", element.getSubType());
36673      }
36674      if (element.hasPublisher()) {
36675        composeReference("publisher", element.getPublisher());
36676      }
36677      if (element.hasPublicationDateElement()) {
36678        composeDateTimeCore("publicationDate", element.getPublicationDateElement(), false);
36679        composeDateTimeExtras("publicationDate", element.getPublicationDateElement(), false);
36680      }
36681      if (element.hasPublicationStatusElement()) {
36682        composeEnumerationCore("publicationStatus", element.getPublicationStatusElement(), new Contract.ContractPublicationStatusEnumFactory(), false);
36683        composeEnumerationExtras("publicationStatus", element.getPublicationStatusElement(), new Contract.ContractPublicationStatusEnumFactory(), false);
36684      }
36685      if (element.hasCopyrightElement()) {
36686        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
36687        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
36688      }
36689  }
36690
36691  protected void composeContractTermComponent(String name, Contract.TermComponent element) throws IOException {
36692    if (element != null) {
36693      open(name);
36694      composeContractTermComponentInner(element);
36695      close();
36696    }
36697  }
36698
36699  protected void composeContractTermComponentInner(Contract.TermComponent element) throws IOException {
36700      composeBackbone(element);
36701      if (element.hasIdentifier()) {
36702        composeIdentifier("identifier", element.getIdentifier());
36703      }
36704      if (element.hasIssuedElement()) {
36705        composeDateTimeCore("issued", element.getIssuedElement(), false);
36706        composeDateTimeExtras("issued", element.getIssuedElement(), false);
36707      }
36708      if (element.hasApplies()) {
36709        composePeriod("applies", element.getApplies());
36710      }
36711      if (element.hasTopic()) {
36712        composeType("topic", element.getTopic());
36713      }
36714      if (element.hasType()) {
36715        composeCodeableConcept("type", element.getType());
36716      }
36717      if (element.hasSubType()) {
36718        composeCodeableConcept("subType", element.getSubType());
36719      }
36720      if (element.hasTextElement()) {
36721        composeStringCore("text", element.getTextElement(), false);
36722        composeStringExtras("text", element.getTextElement(), false);
36723      }
36724      if (element.hasSecurityLabel()) {
36725        openArray("securityLabel");
36726        for (Contract.SecurityLabelComponent e : element.getSecurityLabel()) 
36727          composeContractSecurityLabelComponent(null, e);
36728        closeArray();
36729      };
36730      if (element.hasOffer()) {
36731        composeContractContractOfferComponent("offer", element.getOffer());
36732      }
36733      if (element.hasAsset()) {
36734        openArray("asset");
36735        for (Contract.ContractAssetComponent e : element.getAsset()) 
36736          composeContractContractAssetComponent(null, e);
36737        closeArray();
36738      };
36739      if (element.hasAction()) {
36740        openArray("action");
36741        for (Contract.ActionComponent e : element.getAction()) 
36742          composeContractActionComponent(null, e);
36743        closeArray();
36744      };
36745      if (element.hasGroup()) {
36746        openArray("group");
36747        for (Contract.TermComponent e : element.getGroup()) 
36748          composeContractTermComponent(null, e);
36749        closeArray();
36750      };
36751  }
36752
36753  protected void composeContractSecurityLabelComponent(String name, Contract.SecurityLabelComponent element) throws IOException {
36754    if (element != null) {
36755      open(name);
36756      composeContractSecurityLabelComponentInner(element);
36757      close();
36758    }
36759  }
36760
36761  protected void composeContractSecurityLabelComponentInner(Contract.SecurityLabelComponent element) throws IOException {
36762      composeBackbone(element);
36763      if (element.hasNumber()) {
36764        openArray("number");
36765        for (UnsignedIntType e : element.getNumber()) 
36766          composeUnsignedIntCore(null, e, true);
36767        closeArray();
36768        if (anyHasExtras(element.getNumber())) {
36769          openArray("_number");
36770          for (UnsignedIntType e : element.getNumber()) 
36771            composeUnsignedIntExtras(null, e, true);
36772          closeArray();
36773        }
36774      };
36775      if (element.hasClassification()) {
36776        composeCoding("classification", element.getClassification());
36777      }
36778      if (element.hasCategory()) {
36779        openArray("category");
36780        for (Coding e : element.getCategory()) 
36781          composeCoding(null, e);
36782        closeArray();
36783      };
36784      if (element.hasControl()) {
36785        openArray("control");
36786        for (Coding e : element.getControl()) 
36787          composeCoding(null, e);
36788        closeArray();
36789      };
36790  }
36791
36792  protected void composeContractContractOfferComponent(String name, Contract.ContractOfferComponent element) throws IOException {
36793    if (element != null) {
36794      open(name);
36795      composeContractContractOfferComponentInner(element);
36796      close();
36797    }
36798  }
36799
36800  protected void composeContractContractOfferComponentInner(Contract.ContractOfferComponent element) throws IOException {
36801      composeBackbone(element);
36802      if (element.hasIdentifier()) {
36803        openArray("identifier");
36804        for (Identifier e : element.getIdentifier()) 
36805          composeIdentifier(null, e);
36806        closeArray();
36807      };
36808      if (element.hasParty()) {
36809        openArray("party");
36810        for (Contract.ContractPartyComponent e : element.getParty()) 
36811          composeContractContractPartyComponent(null, e);
36812        closeArray();
36813      };
36814      if (element.hasTopic()) {
36815        composeReference("topic", element.getTopic());
36816      }
36817      if (element.hasType()) {
36818        composeCodeableConcept("type", element.getType());
36819      }
36820      if (element.hasDecision()) {
36821        composeCodeableConcept("decision", element.getDecision());
36822      }
36823      if (element.hasDecisionMode()) {
36824        openArray("decisionMode");
36825        for (CodeableConcept e : element.getDecisionMode()) 
36826          composeCodeableConcept(null, e);
36827        closeArray();
36828      };
36829      if (element.hasAnswer()) {
36830        openArray("answer");
36831        for (Contract.AnswerComponent e : element.getAnswer()) 
36832          composeContractAnswerComponent(null, e);
36833        closeArray();
36834      };
36835      if (element.hasTextElement()) {
36836        composeStringCore("text", element.getTextElement(), false);
36837        composeStringExtras("text", element.getTextElement(), false);
36838      }
36839      if (element.hasLinkId()) {
36840        openArray("linkId");
36841        for (StringType e : element.getLinkId()) 
36842          composeStringCore(null, e, true);
36843        closeArray();
36844        if (anyHasExtras(element.getLinkId())) {
36845          openArray("_linkId");
36846          for (StringType e : element.getLinkId()) 
36847            composeStringExtras(null, e, true);
36848          closeArray();
36849        }
36850      };
36851      if (element.hasSecurityLabelNumber()) {
36852        openArray("securityLabelNumber");
36853        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
36854          composeUnsignedIntCore(null, e, true);
36855        closeArray();
36856        if (anyHasExtras(element.getSecurityLabelNumber())) {
36857          openArray("_securityLabelNumber");
36858          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
36859            composeUnsignedIntExtras(null, e, true);
36860          closeArray();
36861        }
36862      };
36863  }
36864
36865  protected void composeContractContractPartyComponent(String name, Contract.ContractPartyComponent element) throws IOException {
36866    if (element != null) {
36867      open(name);
36868      composeContractContractPartyComponentInner(element);
36869      close();
36870    }
36871  }
36872
36873  protected void composeContractContractPartyComponentInner(Contract.ContractPartyComponent element) throws IOException {
36874      composeBackbone(element);
36875      if (element.hasReference()) {
36876        openArray("reference");
36877        for (Reference e : element.getReference()) 
36878          composeReference(null, e);
36879        closeArray();
36880      };
36881      if (element.hasRole()) {
36882        composeCodeableConcept("role", element.getRole());
36883      }
36884  }
36885
36886  protected void composeContractAnswerComponent(String name, Contract.AnswerComponent element) throws IOException {
36887    if (element != null) {
36888      open(name);
36889      composeContractAnswerComponentInner(element);
36890      close();
36891    }
36892  }
36893
36894  protected void composeContractAnswerComponentInner(Contract.AnswerComponent element) throws IOException {
36895      composeBackbone(element);
36896      if (element.hasValue()) {
36897        composeType("value", element.getValue());
36898      }
36899  }
36900
36901  protected void composeContractContractAssetComponent(String name, Contract.ContractAssetComponent element) throws IOException {
36902    if (element != null) {
36903      open(name);
36904      composeContractContractAssetComponentInner(element);
36905      close();
36906    }
36907  }
36908
36909  protected void composeContractContractAssetComponentInner(Contract.ContractAssetComponent element) throws IOException {
36910      composeBackbone(element);
36911      if (element.hasScope()) {
36912        composeCodeableConcept("scope", element.getScope());
36913      }
36914      if (element.hasType()) {
36915        openArray("type");
36916        for (CodeableConcept e : element.getType()) 
36917          composeCodeableConcept(null, e);
36918        closeArray();
36919      };
36920      if (element.hasTypeReference()) {
36921        openArray("typeReference");
36922        for (Reference e : element.getTypeReference()) 
36923          composeReference(null, e);
36924        closeArray();
36925      };
36926      if (element.hasSubtype()) {
36927        openArray("subtype");
36928        for (CodeableConcept e : element.getSubtype()) 
36929          composeCodeableConcept(null, e);
36930        closeArray();
36931      };
36932      if (element.hasRelationship()) {
36933        composeCoding("relationship", element.getRelationship());
36934      }
36935      if (element.hasContext()) {
36936        openArray("context");
36937        for (Contract.AssetContextComponent e : element.getContext()) 
36938          composeContractAssetContextComponent(null, e);
36939        closeArray();
36940      };
36941      if (element.hasConditionElement()) {
36942        composeStringCore("condition", element.getConditionElement(), false);
36943        composeStringExtras("condition", element.getConditionElement(), false);
36944      }
36945      if (element.hasPeriodType()) {
36946        openArray("periodType");
36947        for (CodeableConcept e : element.getPeriodType()) 
36948          composeCodeableConcept(null, e);
36949        closeArray();
36950      };
36951      if (element.hasPeriod()) {
36952        openArray("period");
36953        for (Period e : element.getPeriod()) 
36954          composePeriod(null, e);
36955        closeArray();
36956      };
36957      if (element.hasUsePeriod()) {
36958        openArray("usePeriod");
36959        for (Period e : element.getUsePeriod()) 
36960          composePeriod(null, e);
36961        closeArray();
36962      };
36963      if (element.hasTextElement()) {
36964        composeStringCore("text", element.getTextElement(), false);
36965        composeStringExtras("text", element.getTextElement(), false);
36966      }
36967      if (element.hasLinkId()) {
36968        openArray("linkId");
36969        for (StringType e : element.getLinkId()) 
36970          composeStringCore(null, e, true);
36971        closeArray();
36972        if (anyHasExtras(element.getLinkId())) {
36973          openArray("_linkId");
36974          for (StringType e : element.getLinkId()) 
36975            composeStringExtras(null, e, true);
36976          closeArray();
36977        }
36978      };
36979      if (element.hasAnswer()) {
36980        openArray("answer");
36981        for (Contract.AnswerComponent e : element.getAnswer()) 
36982          composeContractAnswerComponent(null, e);
36983        closeArray();
36984      };
36985      if (element.hasSecurityLabelNumber()) {
36986        openArray("securityLabelNumber");
36987        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
36988          composeUnsignedIntCore(null, e, true);
36989        closeArray();
36990        if (anyHasExtras(element.getSecurityLabelNumber())) {
36991          openArray("_securityLabelNumber");
36992          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
36993            composeUnsignedIntExtras(null, e, true);
36994          closeArray();
36995        }
36996      };
36997      if (element.hasValuedItem()) {
36998        openArray("valuedItem");
36999        for (Contract.ValuedItemComponent e : element.getValuedItem()) 
37000          composeContractValuedItemComponent(null, e);
37001        closeArray();
37002      };
37003  }
37004
37005  protected void composeContractAssetContextComponent(String name, Contract.AssetContextComponent element) throws IOException {
37006    if (element != null) {
37007      open(name);
37008      composeContractAssetContextComponentInner(element);
37009      close();
37010    }
37011  }
37012
37013  protected void composeContractAssetContextComponentInner(Contract.AssetContextComponent element) throws IOException {
37014      composeBackbone(element);
37015      if (element.hasReference()) {
37016        composeReference("reference", element.getReference());
37017      }
37018      if (element.hasCode()) {
37019        openArray("code");
37020        for (CodeableConcept e : element.getCode()) 
37021          composeCodeableConcept(null, e);
37022        closeArray();
37023      };
37024      if (element.hasTextElement()) {
37025        composeStringCore("text", element.getTextElement(), false);
37026        composeStringExtras("text", element.getTextElement(), false);
37027      }
37028  }
37029
37030  protected void composeContractValuedItemComponent(String name, Contract.ValuedItemComponent element) throws IOException {
37031    if (element != null) {
37032      open(name);
37033      composeContractValuedItemComponentInner(element);
37034      close();
37035    }
37036  }
37037
37038  protected void composeContractValuedItemComponentInner(Contract.ValuedItemComponent element) throws IOException {
37039      composeBackbone(element);
37040      if (element.hasEntity()) {
37041        composeType("entity", element.getEntity());
37042      }
37043      if (element.hasIdentifier()) {
37044        composeIdentifier("identifier", element.getIdentifier());
37045      }
37046      if (element.hasEffectiveTimeElement()) {
37047        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
37048        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
37049      }
37050      if (element.hasQuantity()) {
37051        composeQuantity("quantity", element.getQuantity());
37052      }
37053      if (element.hasUnitPrice()) {
37054        composeMoney("unitPrice", element.getUnitPrice());
37055      }
37056      if (element.hasFactorElement()) {
37057        composeDecimalCore("factor", element.getFactorElement(), false);
37058        composeDecimalExtras("factor", element.getFactorElement(), false);
37059      }
37060      if (element.hasPointsElement()) {
37061        composeDecimalCore("points", element.getPointsElement(), false);
37062        composeDecimalExtras("points", element.getPointsElement(), false);
37063      }
37064      if (element.hasNet()) {
37065        composeMoney("net", element.getNet());
37066      }
37067      if (element.hasPaymentElement()) {
37068        composeStringCore("payment", element.getPaymentElement(), false);
37069        composeStringExtras("payment", element.getPaymentElement(), false);
37070      }
37071      if (element.hasPaymentDateElement()) {
37072        composeDateTimeCore("paymentDate", element.getPaymentDateElement(), false);
37073        composeDateTimeExtras("paymentDate", element.getPaymentDateElement(), false);
37074      }
37075      if (element.hasResponsible()) {
37076        composeReference("responsible", element.getResponsible());
37077      }
37078      if (element.hasRecipient()) {
37079        composeReference("recipient", element.getRecipient());
37080      }
37081      if (element.hasLinkId()) {
37082        openArray("linkId");
37083        for (StringType e : element.getLinkId()) 
37084          composeStringCore(null, e, true);
37085        closeArray();
37086        if (anyHasExtras(element.getLinkId())) {
37087          openArray("_linkId");
37088          for (StringType e : element.getLinkId()) 
37089            composeStringExtras(null, e, true);
37090          closeArray();
37091        }
37092      };
37093      if (element.hasSecurityLabelNumber()) {
37094        openArray("securityLabelNumber");
37095        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
37096          composeUnsignedIntCore(null, e, true);
37097        closeArray();
37098        if (anyHasExtras(element.getSecurityLabelNumber())) {
37099          openArray("_securityLabelNumber");
37100          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
37101            composeUnsignedIntExtras(null, e, true);
37102          closeArray();
37103        }
37104      };
37105  }
37106
37107  protected void composeContractActionComponent(String name, Contract.ActionComponent element) throws IOException {
37108    if (element != null) {
37109      open(name);
37110      composeContractActionComponentInner(element);
37111      close();
37112    }
37113  }
37114
37115  protected void composeContractActionComponentInner(Contract.ActionComponent element) throws IOException {
37116      composeBackbone(element);
37117      if (element.hasDoNotPerformElement()) {
37118        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
37119        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
37120      }
37121      if (element.hasType()) {
37122        composeCodeableConcept("type", element.getType());
37123      }
37124      if (element.hasSubject()) {
37125        openArray("subject");
37126        for (Contract.ActionSubjectComponent e : element.getSubject()) 
37127          composeContractActionSubjectComponent(null, e);
37128        closeArray();
37129      };
37130      if (element.hasIntent()) {
37131        composeCodeableConcept("intent", element.getIntent());
37132      }
37133      if (element.hasLinkId()) {
37134        openArray("linkId");
37135        for (StringType e : element.getLinkId()) 
37136          composeStringCore(null, e, true);
37137        closeArray();
37138        if (anyHasExtras(element.getLinkId())) {
37139          openArray("_linkId");
37140          for (StringType e : element.getLinkId()) 
37141            composeStringExtras(null, e, true);
37142          closeArray();
37143        }
37144      };
37145      if (element.hasStatus()) {
37146        composeCodeableConcept("status", element.getStatus());
37147      }
37148      if (element.hasContext()) {
37149        composeReference("context", element.getContext());
37150      }
37151      if (element.hasContextLinkId()) {
37152        openArray("contextLinkId");
37153        for (StringType e : element.getContextLinkId()) 
37154          composeStringCore(null, e, true);
37155        closeArray();
37156        if (anyHasExtras(element.getContextLinkId())) {
37157          openArray("_contextLinkId");
37158          for (StringType e : element.getContextLinkId()) 
37159            composeStringExtras(null, e, true);
37160          closeArray();
37161        }
37162      };
37163      if (element.hasOccurrence()) {
37164        composeType("occurrence", element.getOccurrence());
37165      }
37166      if (element.hasRequester()) {
37167        openArray("requester");
37168        for (Reference e : element.getRequester()) 
37169          composeReference(null, e);
37170        closeArray();
37171      };
37172      if (element.hasRequesterLinkId()) {
37173        openArray("requesterLinkId");
37174        for (StringType e : element.getRequesterLinkId()) 
37175          composeStringCore(null, e, true);
37176        closeArray();
37177        if (anyHasExtras(element.getRequesterLinkId())) {
37178          openArray("_requesterLinkId");
37179          for (StringType e : element.getRequesterLinkId()) 
37180            composeStringExtras(null, e, true);
37181          closeArray();
37182        }
37183      };
37184      if (element.hasPerformerType()) {
37185        openArray("performerType");
37186        for (CodeableConcept e : element.getPerformerType()) 
37187          composeCodeableConcept(null, e);
37188        closeArray();
37189      };
37190      if (element.hasPerformerRole()) {
37191        composeCodeableConcept("performerRole", element.getPerformerRole());
37192      }
37193      if (element.hasPerformer()) {
37194        composeReference("performer", element.getPerformer());
37195      }
37196      if (element.hasPerformerLinkId()) {
37197        openArray("performerLinkId");
37198        for (StringType e : element.getPerformerLinkId()) 
37199          composeStringCore(null, e, true);
37200        closeArray();
37201        if (anyHasExtras(element.getPerformerLinkId())) {
37202          openArray("_performerLinkId");
37203          for (StringType e : element.getPerformerLinkId()) 
37204            composeStringExtras(null, e, true);
37205          closeArray();
37206        }
37207      };
37208      if (element.hasReasonCode()) {
37209        openArray("reasonCode");
37210        for (CodeableConcept e : element.getReasonCode()) 
37211          composeCodeableConcept(null, e);
37212        closeArray();
37213      };
37214      if (element.hasReasonReference()) {
37215        openArray("reasonReference");
37216        for (Reference e : element.getReasonReference()) 
37217          composeReference(null, e);
37218        closeArray();
37219      };
37220      if (element.hasReason()) {
37221        openArray("reason");
37222        for (StringType e : element.getReason()) 
37223          composeStringCore(null, e, true);
37224        closeArray();
37225        if (anyHasExtras(element.getReason())) {
37226          openArray("_reason");
37227          for (StringType e : element.getReason()) 
37228            composeStringExtras(null, e, true);
37229          closeArray();
37230        }
37231      };
37232      if (element.hasReasonLinkId()) {
37233        openArray("reasonLinkId");
37234        for (StringType e : element.getReasonLinkId()) 
37235          composeStringCore(null, e, true);
37236        closeArray();
37237        if (anyHasExtras(element.getReasonLinkId())) {
37238          openArray("_reasonLinkId");
37239          for (StringType e : element.getReasonLinkId()) 
37240            composeStringExtras(null, e, true);
37241          closeArray();
37242        }
37243      };
37244      if (element.hasNote()) {
37245        openArray("note");
37246        for (Annotation e : element.getNote()) 
37247          composeAnnotation(null, e);
37248        closeArray();
37249      };
37250      if (element.hasSecurityLabelNumber()) {
37251        openArray("securityLabelNumber");
37252        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
37253          composeUnsignedIntCore(null, e, true);
37254        closeArray();
37255        if (anyHasExtras(element.getSecurityLabelNumber())) {
37256          openArray("_securityLabelNumber");
37257          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
37258            composeUnsignedIntExtras(null, e, true);
37259          closeArray();
37260        }
37261      };
37262  }
37263
37264  protected void composeContractActionSubjectComponent(String name, Contract.ActionSubjectComponent element) throws IOException {
37265    if (element != null) {
37266      open(name);
37267      composeContractActionSubjectComponentInner(element);
37268      close();
37269    }
37270  }
37271
37272  protected void composeContractActionSubjectComponentInner(Contract.ActionSubjectComponent element) throws IOException {
37273      composeBackbone(element);
37274      if (element.hasReference()) {
37275        openArray("reference");
37276        for (Reference e : element.getReference()) 
37277          composeReference(null, e);
37278        closeArray();
37279      };
37280      if (element.hasRole()) {
37281        composeCodeableConcept("role", element.getRole());
37282      }
37283  }
37284
37285  protected void composeContractSignatoryComponent(String name, Contract.SignatoryComponent element) throws IOException {
37286    if (element != null) {
37287      open(name);
37288      composeContractSignatoryComponentInner(element);
37289      close();
37290    }
37291  }
37292
37293  protected void composeContractSignatoryComponentInner(Contract.SignatoryComponent element) throws IOException {
37294      composeBackbone(element);
37295      if (element.hasType()) {
37296        composeCoding("type", element.getType());
37297      }
37298      if (element.hasParty()) {
37299        composeReference("party", element.getParty());
37300      }
37301      if (element.hasSignature()) {
37302        openArray("signature");
37303        for (Signature e : element.getSignature()) 
37304          composeSignature(null, e);
37305        closeArray();
37306      };
37307  }
37308
37309  protected void composeContractFriendlyLanguageComponent(String name, Contract.FriendlyLanguageComponent element) throws IOException {
37310    if (element != null) {
37311      open(name);
37312      composeContractFriendlyLanguageComponentInner(element);
37313      close();
37314    }
37315  }
37316
37317  protected void composeContractFriendlyLanguageComponentInner(Contract.FriendlyLanguageComponent element) throws IOException {
37318      composeBackbone(element);
37319      if (element.hasContent()) {
37320        composeType("content", element.getContent());
37321      }
37322  }
37323
37324  protected void composeContractLegalLanguageComponent(String name, Contract.LegalLanguageComponent element) throws IOException {
37325    if (element != null) {
37326      open(name);
37327      composeContractLegalLanguageComponentInner(element);
37328      close();
37329    }
37330  }
37331
37332  protected void composeContractLegalLanguageComponentInner(Contract.LegalLanguageComponent element) throws IOException {
37333      composeBackbone(element);
37334      if (element.hasContent()) {
37335        composeType("content", element.getContent());
37336      }
37337  }
37338
37339  protected void composeContractComputableLanguageComponent(String name, Contract.ComputableLanguageComponent element) throws IOException {
37340    if (element != null) {
37341      open(name);
37342      composeContractComputableLanguageComponentInner(element);
37343      close();
37344    }
37345  }
37346
37347  protected void composeContractComputableLanguageComponentInner(Contract.ComputableLanguageComponent element) throws IOException {
37348      composeBackbone(element);
37349      if (element.hasContent()) {
37350        composeType("content", element.getContent());
37351      }
37352  }
37353
37354  protected void composeCoverage(String name, Coverage element) throws IOException {
37355    if (element != null) {
37356      prop("resourceType", name);
37357      composeCoverageInner(element);
37358    }
37359  }
37360
37361  protected void composeCoverageInner(Coverage element) throws IOException {
37362      composeDomainResourceElements(element);
37363      if (element.hasIdentifier()) {
37364        openArray("identifier");
37365        for (Identifier e : element.getIdentifier()) 
37366          composeIdentifier(null, e);
37367        closeArray();
37368      };
37369      if (element.hasStatusElement()) {
37370        composeEnumerationCore("status", element.getStatusElement(), new Coverage.CoverageStatusEnumFactory(), false);
37371        composeEnumerationExtras("status", element.getStatusElement(), new Coverage.CoverageStatusEnumFactory(), false);
37372      }
37373      if (element.hasType()) {
37374        composeCodeableConcept("type", element.getType());
37375      }
37376      if (element.hasPolicyHolder()) {
37377        composeReference("policyHolder", element.getPolicyHolder());
37378      }
37379      if (element.hasSubscriber()) {
37380        composeReference("subscriber", element.getSubscriber());
37381      }
37382      if (element.hasSubscriberIdElement()) {
37383        composeStringCore("subscriberId", element.getSubscriberIdElement(), false);
37384        composeStringExtras("subscriberId", element.getSubscriberIdElement(), false);
37385      }
37386      if (element.hasBeneficiary()) {
37387        composeReference("beneficiary", element.getBeneficiary());
37388      }
37389      if (element.hasDependentElement()) {
37390        composeStringCore("dependent", element.getDependentElement(), false);
37391        composeStringExtras("dependent", element.getDependentElement(), false);
37392      }
37393      if (element.hasRelationship()) {
37394        composeCodeableConcept("relationship", element.getRelationship());
37395      }
37396      if (element.hasPeriod()) {
37397        composePeriod("period", element.getPeriod());
37398      }
37399      if (element.hasPayor()) {
37400        openArray("payor");
37401        for (Reference e : element.getPayor()) 
37402          composeReference(null, e);
37403        closeArray();
37404      };
37405      if (element.hasClass_()) {
37406        openArray("class");
37407        for (Coverage.ClassComponent e : element.getClass_()) 
37408          composeCoverageClassComponent(null, e);
37409        closeArray();
37410      };
37411      if (element.hasOrderElement()) {
37412        composePositiveIntCore("order", element.getOrderElement(), false);
37413        composePositiveIntExtras("order", element.getOrderElement(), false);
37414      }
37415      if (element.hasNetworkElement()) {
37416        composeStringCore("network", element.getNetworkElement(), false);
37417        composeStringExtras("network", element.getNetworkElement(), false);
37418      }
37419      if (element.hasCostToBeneficiary()) {
37420        openArray("costToBeneficiary");
37421        for (Coverage.CostToBeneficiaryComponent e : element.getCostToBeneficiary()) 
37422          composeCoverageCostToBeneficiaryComponent(null, e);
37423        closeArray();
37424      };
37425      if (element.hasSubrogationElement()) {
37426        composeBooleanCore("subrogation", element.getSubrogationElement(), false);
37427        composeBooleanExtras("subrogation", element.getSubrogationElement(), false);
37428      }
37429      if (element.hasContract()) {
37430        openArray("contract");
37431        for (Reference e : element.getContract()) 
37432          composeReference(null, e);
37433        closeArray();
37434      };
37435  }
37436
37437  protected void composeCoverageClassComponent(String name, Coverage.ClassComponent element) throws IOException {
37438    if (element != null) {
37439      open(name);
37440      composeCoverageClassComponentInner(element);
37441      close();
37442    }
37443  }
37444
37445  protected void composeCoverageClassComponentInner(Coverage.ClassComponent element) throws IOException {
37446      composeBackbone(element);
37447      if (element.hasType()) {
37448        composeCodeableConcept("type", element.getType());
37449      }
37450      if (element.hasValueElement()) {
37451        composeStringCore("value", element.getValueElement(), false);
37452        composeStringExtras("value", element.getValueElement(), false);
37453      }
37454      if (element.hasNameElement()) {
37455        composeStringCore("name", element.getNameElement(), false);
37456        composeStringExtras("name", element.getNameElement(), false);
37457      }
37458  }
37459
37460  protected void composeCoverageCostToBeneficiaryComponent(String name, Coverage.CostToBeneficiaryComponent element) throws IOException {
37461    if (element != null) {
37462      open(name);
37463      composeCoverageCostToBeneficiaryComponentInner(element);
37464      close();
37465    }
37466  }
37467
37468  protected void composeCoverageCostToBeneficiaryComponentInner(Coverage.CostToBeneficiaryComponent element) throws IOException {
37469      composeBackbone(element);
37470      if (element.hasType()) {
37471        composeCodeableConcept("type", element.getType());
37472      }
37473      if (element.hasValue()) {
37474        composeType("value", element.getValue());
37475      }
37476      if (element.hasException()) {
37477        openArray("exception");
37478        for (Coverage.ExemptionComponent e : element.getException()) 
37479          composeCoverageExemptionComponent(null, e);
37480        closeArray();
37481      };
37482  }
37483
37484  protected void composeCoverageExemptionComponent(String name, Coverage.ExemptionComponent element) throws IOException {
37485    if (element != null) {
37486      open(name);
37487      composeCoverageExemptionComponentInner(element);
37488      close();
37489    }
37490  }
37491
37492  protected void composeCoverageExemptionComponentInner(Coverage.ExemptionComponent element) throws IOException {
37493      composeBackbone(element);
37494      if (element.hasType()) {
37495        composeCodeableConcept("type", element.getType());
37496      }
37497      if (element.hasPeriod()) {
37498        composePeriod("period", element.getPeriod());
37499      }
37500  }
37501
37502  protected void composeCoverageEligibilityRequest(String name, CoverageEligibilityRequest element) throws IOException {
37503    if (element != null) {
37504      prop("resourceType", name);
37505      composeCoverageEligibilityRequestInner(element);
37506    }
37507  }
37508
37509  protected void composeCoverageEligibilityRequestInner(CoverageEligibilityRequest element) throws IOException {
37510      composeDomainResourceElements(element);
37511      if (element.hasIdentifier()) {
37512        openArray("identifier");
37513        for (Identifier e : element.getIdentifier()) 
37514          composeIdentifier(null, e);
37515        closeArray();
37516      };
37517      if (element.hasStatusElement()) {
37518        composeEnumerationCore("status", element.getStatusElement(), new CoverageEligibilityRequest.EligibilityRequestStatusEnumFactory(), false);
37519        composeEnumerationExtras("status", element.getStatusElement(), new CoverageEligibilityRequest.EligibilityRequestStatusEnumFactory(), false);
37520      }
37521      if (element.hasPriority()) {
37522        composeCodeableConcept("priority", element.getPriority());
37523      }
37524      if (element.hasPurpose()) {
37525        openArray("purpose");
37526        for (Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose> e : element.getPurpose()) 
37527          composeEnumerationCore(null, e, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), true);
37528        closeArray();
37529        if (anyHasExtras(element.getPurpose())) {
37530          openArray("_purpose");
37531          for (Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose> e : element.getPurpose()) 
37532            composeEnumerationExtras(null, e, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), true);
37533          closeArray();
37534        }
37535      };
37536      if (element.hasPatient()) {
37537        composeReference("patient", element.getPatient());
37538      }
37539      if (element.hasServiced()) {
37540        composeType("serviced", element.getServiced());
37541      }
37542      if (element.hasCreatedElement()) {
37543        composeDateTimeCore("created", element.getCreatedElement(), false);
37544        composeDateTimeExtras("created", element.getCreatedElement(), false);
37545      }
37546      if (element.hasEnterer()) {
37547        composeReference("enterer", element.getEnterer());
37548      }
37549      if (element.hasProvider()) {
37550        composeReference("provider", element.getProvider());
37551      }
37552      if (element.hasInsurer()) {
37553        composeReference("insurer", element.getInsurer());
37554      }
37555      if (element.hasFacility()) {
37556        composeReference("facility", element.getFacility());
37557      }
37558      if (element.hasSupportingInfo()) {
37559        openArray("supportingInfo");
37560        for (CoverageEligibilityRequest.SupportingInformationComponent e : element.getSupportingInfo()) 
37561          composeCoverageEligibilityRequestSupportingInformationComponent(null, e);
37562        closeArray();
37563      };
37564      if (element.hasInsurance()) {
37565        openArray("insurance");
37566        for (CoverageEligibilityRequest.InsuranceComponent e : element.getInsurance()) 
37567          composeCoverageEligibilityRequestInsuranceComponent(null, e);
37568        closeArray();
37569      };
37570      if (element.hasItem()) {
37571        openArray("item");
37572        for (CoverageEligibilityRequest.DetailsComponent e : element.getItem()) 
37573          composeCoverageEligibilityRequestDetailsComponent(null, e);
37574        closeArray();
37575      };
37576  }
37577
37578  protected void composeCoverageEligibilityRequestSupportingInformationComponent(String name, CoverageEligibilityRequest.SupportingInformationComponent element) throws IOException {
37579    if (element != null) {
37580      open(name);
37581      composeCoverageEligibilityRequestSupportingInformationComponentInner(element);
37582      close();
37583    }
37584  }
37585
37586  protected void composeCoverageEligibilityRequestSupportingInformationComponentInner(CoverageEligibilityRequest.SupportingInformationComponent element) throws IOException {
37587      composeBackbone(element);
37588      if (element.hasSequenceElement()) {
37589        composePositiveIntCore("sequence", element.getSequenceElement(), false);
37590        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
37591      }
37592      if (element.hasInformation()) {
37593        composeReference("information", element.getInformation());
37594      }
37595      if (element.hasAppliesToAllElement()) {
37596        composeBooleanCore("appliesToAll", element.getAppliesToAllElement(), false);
37597        composeBooleanExtras("appliesToAll", element.getAppliesToAllElement(), false);
37598      }
37599  }
37600
37601  protected void composeCoverageEligibilityRequestInsuranceComponent(String name, CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
37602    if (element != null) {
37603      open(name);
37604      composeCoverageEligibilityRequestInsuranceComponentInner(element);
37605      close();
37606    }
37607  }
37608
37609  protected void composeCoverageEligibilityRequestInsuranceComponentInner(CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
37610      composeBackbone(element);
37611      if (element.hasFocalElement()) {
37612        composeBooleanCore("focal", element.getFocalElement(), false);
37613        composeBooleanExtras("focal", element.getFocalElement(), false);
37614      }
37615      if (element.hasCoverage()) {
37616        composeReference("coverage", element.getCoverage());
37617      }
37618      if (element.hasBusinessArrangementElement()) {
37619        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
37620        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
37621      }
37622  }
37623
37624  protected void composeCoverageEligibilityRequestDetailsComponent(String name, CoverageEligibilityRequest.DetailsComponent element) throws IOException {
37625    if (element != null) {
37626      open(name);
37627      composeCoverageEligibilityRequestDetailsComponentInner(element);
37628      close();
37629    }
37630  }
37631
37632  protected void composeCoverageEligibilityRequestDetailsComponentInner(CoverageEligibilityRequest.DetailsComponent element) throws IOException {
37633      composeBackbone(element);
37634      if (element.hasSupportingInfoSequence()) {
37635        openArray("supportingInfoSequence");
37636        for (PositiveIntType e : element.getSupportingInfoSequence()) 
37637          composePositiveIntCore(null, e, true);
37638        closeArray();
37639        if (anyHasExtras(element.getSupportingInfoSequence())) {
37640          openArray("_supportingInfoSequence");
37641          for (PositiveIntType e : element.getSupportingInfoSequence()) 
37642            composePositiveIntExtras(null, e, true);
37643          closeArray();
37644        }
37645      };
37646      if (element.hasCategory()) {
37647        composeCodeableConcept("category", element.getCategory());
37648      }
37649      if (element.hasProductOrService()) {
37650        composeCodeableConcept("productOrService", element.getProductOrService());
37651      }
37652      if (element.hasModifier()) {
37653        openArray("modifier");
37654        for (CodeableConcept e : element.getModifier()) 
37655          composeCodeableConcept(null, e);
37656        closeArray();
37657      };
37658      if (element.hasProvider()) {
37659        composeReference("provider", element.getProvider());
37660      }
37661      if (element.hasQuantity()) {
37662        composeQuantity("quantity", element.getQuantity());
37663      }
37664      if (element.hasUnitPrice()) {
37665        composeMoney("unitPrice", element.getUnitPrice());
37666      }
37667      if (element.hasFacility()) {
37668        composeReference("facility", element.getFacility());
37669      }
37670      if (element.hasDiagnosis()) {
37671        openArray("diagnosis");
37672        for (CoverageEligibilityRequest.DiagnosisComponent e : element.getDiagnosis()) 
37673          composeCoverageEligibilityRequestDiagnosisComponent(null, e);
37674        closeArray();
37675      };
37676      if (element.hasDetail()) {
37677        openArray("detail");
37678        for (Reference e : element.getDetail()) 
37679          composeReference(null, e);
37680        closeArray();
37681      };
37682  }
37683
37684  protected void composeCoverageEligibilityRequestDiagnosisComponent(String name, CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
37685    if (element != null) {
37686      open(name);
37687      composeCoverageEligibilityRequestDiagnosisComponentInner(element);
37688      close();
37689    }
37690  }
37691
37692  protected void composeCoverageEligibilityRequestDiagnosisComponentInner(CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
37693      composeBackbone(element);
37694      if (element.hasDiagnosis()) {
37695        composeType("diagnosis", element.getDiagnosis());
37696      }
37697  }
37698
37699  protected void composeCoverageEligibilityResponse(String name, CoverageEligibilityResponse element) throws IOException {
37700    if (element != null) {
37701      prop("resourceType", name);
37702      composeCoverageEligibilityResponseInner(element);
37703    }
37704  }
37705
37706  protected void composeCoverageEligibilityResponseInner(CoverageEligibilityResponse element) throws IOException {
37707      composeDomainResourceElements(element);
37708      if (element.hasIdentifier()) {
37709        openArray("identifier");
37710        for (Identifier e : element.getIdentifier()) 
37711          composeIdentifier(null, e);
37712        closeArray();
37713      };
37714      if (element.hasStatusElement()) {
37715        composeEnumerationCore("status", element.getStatusElement(), new CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory(), false);
37716        composeEnumerationExtras("status", element.getStatusElement(), new CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory(), false);
37717      }
37718      if (element.hasPurpose()) {
37719        openArray("purpose");
37720        for (Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose> e : element.getPurpose()) 
37721          composeEnumerationCore(null, e, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), true);
37722        closeArray();
37723        if (anyHasExtras(element.getPurpose())) {
37724          openArray("_purpose");
37725          for (Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose> e : element.getPurpose()) 
37726            composeEnumerationExtras(null, e, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), true);
37727          closeArray();
37728        }
37729      };
37730      if (element.hasPatient()) {
37731        composeReference("patient", element.getPatient());
37732      }
37733      if (element.hasServiced()) {
37734        composeType("serviced", element.getServiced());
37735      }
37736      if (element.hasCreatedElement()) {
37737        composeDateTimeCore("created", element.getCreatedElement(), false);
37738        composeDateTimeExtras("created", element.getCreatedElement(), false);
37739      }
37740      if (element.hasRequestor()) {
37741        composeReference("requestor", element.getRequestor());
37742      }
37743      if (element.hasRequest()) {
37744        composeReference("request", element.getRequest());
37745      }
37746      if (element.hasOutcomeElement()) {
37747        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
37748        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
37749      }
37750      if (element.hasDispositionElement()) {
37751        composeStringCore("disposition", element.getDispositionElement(), false);
37752        composeStringExtras("disposition", element.getDispositionElement(), false);
37753      }
37754      if (element.hasInsurer()) {
37755        composeReference("insurer", element.getInsurer());
37756      }
37757      if (element.hasInsurance()) {
37758        openArray("insurance");
37759        for (CoverageEligibilityResponse.InsuranceComponent e : element.getInsurance()) 
37760          composeCoverageEligibilityResponseInsuranceComponent(null, e);
37761        closeArray();
37762      };
37763      if (element.hasPreAuthRefElement()) {
37764        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
37765        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
37766      }
37767      if (element.hasForm()) {
37768        composeCodeableConcept("form", element.getForm());
37769      }
37770      if (element.hasError()) {
37771        openArray("error");
37772        for (CoverageEligibilityResponse.ErrorsComponent e : element.getError()) 
37773          composeCoverageEligibilityResponseErrorsComponent(null, e);
37774        closeArray();
37775      };
37776  }
37777
37778  protected void composeCoverageEligibilityResponseInsuranceComponent(String name, CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
37779    if (element != null) {
37780      open(name);
37781      composeCoverageEligibilityResponseInsuranceComponentInner(element);
37782      close();
37783    }
37784  }
37785
37786  protected void composeCoverageEligibilityResponseInsuranceComponentInner(CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
37787      composeBackbone(element);
37788      if (element.hasCoverage()) {
37789        composeReference("coverage", element.getCoverage());
37790      }
37791      if (element.hasInforceElement()) {
37792        composeBooleanCore("inforce", element.getInforceElement(), false);
37793        composeBooleanExtras("inforce", element.getInforceElement(), false);
37794      }
37795      if (element.hasBenefitPeriod()) {
37796        composePeriod("benefitPeriod", element.getBenefitPeriod());
37797      }
37798      if (element.hasItem()) {
37799        openArray("item");
37800        for (CoverageEligibilityResponse.ItemsComponent e : element.getItem()) 
37801          composeCoverageEligibilityResponseItemsComponent(null, e);
37802        closeArray();
37803      };
37804  }
37805
37806  protected void composeCoverageEligibilityResponseItemsComponent(String name, CoverageEligibilityResponse.ItemsComponent element) throws IOException {
37807    if (element != null) {
37808      open(name);
37809      composeCoverageEligibilityResponseItemsComponentInner(element);
37810      close();
37811    }
37812  }
37813
37814  protected void composeCoverageEligibilityResponseItemsComponentInner(CoverageEligibilityResponse.ItemsComponent element) throws IOException {
37815      composeBackbone(element);
37816      if (element.hasCategory()) {
37817        composeCodeableConcept("category", element.getCategory());
37818      }
37819      if (element.hasProductOrService()) {
37820        composeCodeableConcept("productOrService", element.getProductOrService());
37821      }
37822      if (element.hasModifier()) {
37823        openArray("modifier");
37824        for (CodeableConcept e : element.getModifier()) 
37825          composeCodeableConcept(null, e);
37826        closeArray();
37827      };
37828      if (element.hasProvider()) {
37829        composeReference("provider", element.getProvider());
37830      }
37831      if (element.hasExcludedElement()) {
37832        composeBooleanCore("excluded", element.getExcludedElement(), false);
37833        composeBooleanExtras("excluded", element.getExcludedElement(), false);
37834      }
37835      if (element.hasNameElement()) {
37836        composeStringCore("name", element.getNameElement(), false);
37837        composeStringExtras("name", element.getNameElement(), false);
37838      }
37839      if (element.hasDescriptionElement()) {
37840        composeStringCore("description", element.getDescriptionElement(), false);
37841        composeStringExtras("description", element.getDescriptionElement(), false);
37842      }
37843      if (element.hasNetwork()) {
37844        composeCodeableConcept("network", element.getNetwork());
37845      }
37846      if (element.hasUnit()) {
37847        composeCodeableConcept("unit", element.getUnit());
37848      }
37849      if (element.hasTerm()) {
37850        composeCodeableConcept("term", element.getTerm());
37851      }
37852      if (element.hasBenefit()) {
37853        openArray("benefit");
37854        for (CoverageEligibilityResponse.BenefitComponent e : element.getBenefit()) 
37855          composeCoverageEligibilityResponseBenefitComponent(null, e);
37856        closeArray();
37857      };
37858      if (element.hasAuthorizationRequiredElement()) {
37859        composeBooleanCore("authorizationRequired", element.getAuthorizationRequiredElement(), false);
37860        composeBooleanExtras("authorizationRequired", element.getAuthorizationRequiredElement(), false);
37861      }
37862      if (element.hasAuthorizationSupporting()) {
37863        openArray("authorizationSupporting");
37864        for (CodeableConcept e : element.getAuthorizationSupporting()) 
37865          composeCodeableConcept(null, e);
37866        closeArray();
37867      };
37868      if (element.hasAuthorizationUrlElement()) {
37869        composeUriCore("authorizationUrl", element.getAuthorizationUrlElement(), false);
37870        composeUriExtras("authorizationUrl", element.getAuthorizationUrlElement(), false);
37871      }
37872  }
37873
37874  protected void composeCoverageEligibilityResponseBenefitComponent(String name, CoverageEligibilityResponse.BenefitComponent element) throws IOException {
37875    if (element != null) {
37876      open(name);
37877      composeCoverageEligibilityResponseBenefitComponentInner(element);
37878      close();
37879    }
37880  }
37881
37882  protected void composeCoverageEligibilityResponseBenefitComponentInner(CoverageEligibilityResponse.BenefitComponent element) throws IOException {
37883      composeBackbone(element);
37884      if (element.hasType()) {
37885        composeCodeableConcept("type", element.getType());
37886      }
37887      if (element.hasAllowed()) {
37888        composeType("allowed", element.getAllowed());
37889      }
37890      if (element.hasUsed()) {
37891        composeType("used", element.getUsed());
37892      }
37893  }
37894
37895  protected void composeCoverageEligibilityResponseErrorsComponent(String name, CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
37896    if (element != null) {
37897      open(name);
37898      composeCoverageEligibilityResponseErrorsComponentInner(element);
37899      close();
37900    }
37901  }
37902
37903  protected void composeCoverageEligibilityResponseErrorsComponentInner(CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
37904      composeBackbone(element);
37905      if (element.hasCode()) {
37906        composeCodeableConcept("code", element.getCode());
37907      }
37908  }
37909
37910  protected void composeDetectedIssue(String name, DetectedIssue element) throws IOException {
37911    if (element != null) {
37912      prop("resourceType", name);
37913      composeDetectedIssueInner(element);
37914    }
37915  }
37916
37917  protected void composeDetectedIssueInner(DetectedIssue element) throws IOException {
37918      composeDomainResourceElements(element);
37919      if (element.hasIdentifier()) {
37920        openArray("identifier");
37921        for (Identifier e : element.getIdentifier()) 
37922          composeIdentifier(null, e);
37923        closeArray();
37924      };
37925      if (element.hasStatusElement()) {
37926        composeEnumerationCore("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
37927        composeEnumerationExtras("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
37928      }
37929      if (element.hasCode()) {
37930        composeCodeableConcept("code", element.getCode());
37931      }
37932      if (element.hasSeverityElement()) {
37933        composeEnumerationCore("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
37934        composeEnumerationExtras("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
37935      }
37936      if (element.hasPatient()) {
37937        composeReference("patient", element.getPatient());
37938      }
37939      if (element.hasIdentified()) {
37940        composeType("identified", element.getIdentified());
37941      }
37942      if (element.hasAuthor()) {
37943        composeReference("author", element.getAuthor());
37944      }
37945      if (element.hasImplicated()) {
37946        openArray("implicated");
37947        for (Reference e : element.getImplicated()) 
37948          composeReference(null, e);
37949        closeArray();
37950      };
37951      if (element.hasEvidence()) {
37952        openArray("evidence");
37953        for (DetectedIssue.DetectedIssueEvidenceComponent e : element.getEvidence()) 
37954          composeDetectedIssueDetectedIssueEvidenceComponent(null, e);
37955        closeArray();
37956      };
37957      if (element.hasDetailElement()) {
37958        composeStringCore("detail", element.getDetailElement(), false);
37959        composeStringExtras("detail", element.getDetailElement(), false);
37960      }
37961      if (element.hasReferenceElement()) {
37962        composeUriCore("reference", element.getReferenceElement(), false);
37963        composeUriExtras("reference", element.getReferenceElement(), false);
37964      }
37965      if (element.hasMitigation()) {
37966        openArray("mitigation");
37967        for (DetectedIssue.DetectedIssueMitigationComponent e : element.getMitigation()) 
37968          composeDetectedIssueDetectedIssueMitigationComponent(null, e);
37969        closeArray();
37970      };
37971  }
37972
37973  protected void composeDetectedIssueDetectedIssueEvidenceComponent(String name, DetectedIssue.DetectedIssueEvidenceComponent element) throws IOException {
37974    if (element != null) {
37975      open(name);
37976      composeDetectedIssueDetectedIssueEvidenceComponentInner(element);
37977      close();
37978    }
37979  }
37980
37981  protected void composeDetectedIssueDetectedIssueEvidenceComponentInner(DetectedIssue.DetectedIssueEvidenceComponent element) throws IOException {
37982      composeBackbone(element);
37983      if (element.hasCode()) {
37984        openArray("code");
37985        for (CodeableConcept e : element.getCode()) 
37986          composeCodeableConcept(null, e);
37987        closeArray();
37988      };
37989      if (element.hasDetail()) {
37990        openArray("detail");
37991        for (Reference e : element.getDetail()) 
37992          composeReference(null, e);
37993        closeArray();
37994      };
37995  }
37996
37997  protected void composeDetectedIssueDetectedIssueMitigationComponent(String name, DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
37998    if (element != null) {
37999      open(name);
38000      composeDetectedIssueDetectedIssueMitigationComponentInner(element);
38001      close();
38002    }
38003  }
38004
38005  protected void composeDetectedIssueDetectedIssueMitigationComponentInner(DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
38006      composeBackbone(element);
38007      if (element.hasAction()) {
38008        composeCodeableConcept("action", element.getAction());
38009      }
38010      if (element.hasDateElement()) {
38011        composeDateTimeCore("date", element.getDateElement(), false);
38012        composeDateTimeExtras("date", element.getDateElement(), false);
38013      }
38014      if (element.hasAuthor()) {
38015        composeReference("author", element.getAuthor());
38016      }
38017  }
38018
38019  protected void composeDevice(String name, Device element) throws IOException {
38020    if (element != null) {
38021      prop("resourceType", name);
38022      composeDeviceInner(element);
38023    }
38024  }
38025
38026  protected void composeDeviceInner(Device element) throws IOException {
38027      composeDomainResourceElements(element);
38028      if (element.hasIdentifier()) {
38029        openArray("identifier");
38030        for (Identifier e : element.getIdentifier()) 
38031          composeIdentifier(null, e);
38032        closeArray();
38033      };
38034      if (element.hasDefinition()) {
38035        composeReference("definition", element.getDefinition());
38036      }
38037      if (element.hasUdiCarrier()) {
38038        openArray("udiCarrier");
38039        for (Device.DeviceUdiCarrierComponent e : element.getUdiCarrier()) 
38040          composeDeviceDeviceUdiCarrierComponent(null, e);
38041        closeArray();
38042      };
38043      if (element.hasStatusElement()) {
38044        composeEnumerationCore("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
38045        composeEnumerationExtras("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
38046      }
38047      if (element.hasStatusReason()) {
38048        openArray("statusReason");
38049        for (CodeableConcept e : element.getStatusReason()) 
38050          composeCodeableConcept(null, e);
38051        closeArray();
38052      };
38053      if (element.hasDistinctIdentifierElement()) {
38054        composeStringCore("distinctIdentifier", element.getDistinctIdentifierElement(), false);
38055        composeStringExtras("distinctIdentifier", element.getDistinctIdentifierElement(), false);
38056      }
38057      if (element.hasManufacturerElement()) {
38058        composeStringCore("manufacturer", element.getManufacturerElement(), false);
38059        composeStringExtras("manufacturer", element.getManufacturerElement(), false);
38060      }
38061      if (element.hasManufactureDateElement()) {
38062        composeDateTimeCore("manufactureDate", element.getManufactureDateElement(), false);
38063        composeDateTimeExtras("manufactureDate", element.getManufactureDateElement(), false);
38064      }
38065      if (element.hasExpirationDateElement()) {
38066        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
38067        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
38068      }
38069      if (element.hasLotNumberElement()) {
38070        composeStringCore("lotNumber", element.getLotNumberElement(), false);
38071        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
38072      }
38073      if (element.hasSerialNumberElement()) {
38074        composeStringCore("serialNumber", element.getSerialNumberElement(), false);
38075        composeStringExtras("serialNumber", element.getSerialNumberElement(), false);
38076      }
38077      if (element.hasDeviceName()) {
38078        openArray("deviceName");
38079        for (Device.DeviceDeviceNameComponent e : element.getDeviceName()) 
38080          composeDeviceDeviceDeviceNameComponent(null, e);
38081        closeArray();
38082      };
38083      if (element.hasModelNumberElement()) {
38084        composeStringCore("modelNumber", element.getModelNumberElement(), false);
38085        composeStringExtras("modelNumber", element.getModelNumberElement(), false);
38086      }
38087      if (element.hasPartNumberElement()) {
38088        composeStringCore("partNumber", element.getPartNumberElement(), false);
38089        composeStringExtras("partNumber", element.getPartNumberElement(), false);
38090      }
38091      if (element.hasType()) {
38092        composeCodeableConcept("type", element.getType());
38093      }
38094      if (element.hasSpecialization()) {
38095        openArray("specialization");
38096        for (Device.DeviceSpecializationComponent e : element.getSpecialization()) 
38097          composeDeviceDeviceSpecializationComponent(null, e);
38098        closeArray();
38099      };
38100      if (element.hasVersion()) {
38101        openArray("version");
38102        for (Device.DeviceVersionComponent e : element.getVersion()) 
38103          composeDeviceDeviceVersionComponent(null, e);
38104        closeArray();
38105      };
38106      if (element.hasProperty()) {
38107        openArray("property");
38108        for (Device.DevicePropertyComponent e : element.getProperty()) 
38109          composeDeviceDevicePropertyComponent(null, e);
38110        closeArray();
38111      };
38112      if (element.hasPatient()) {
38113        composeReference("patient", element.getPatient());
38114      }
38115      if (element.hasOwner()) {
38116        composeReference("owner", element.getOwner());
38117      }
38118      if (element.hasContact()) {
38119        openArray("contact");
38120        for (ContactPoint e : element.getContact()) 
38121          composeContactPoint(null, e);
38122        closeArray();
38123      };
38124      if (element.hasLocation()) {
38125        composeReference("location", element.getLocation());
38126      }
38127      if (element.hasUrlElement()) {
38128        composeUriCore("url", element.getUrlElement(), false);
38129        composeUriExtras("url", element.getUrlElement(), false);
38130      }
38131      if (element.hasNote()) {
38132        openArray("note");
38133        for (Annotation e : element.getNote()) 
38134          composeAnnotation(null, e);
38135        closeArray();
38136      };
38137      if (element.hasSafety()) {
38138        openArray("safety");
38139        for (CodeableConcept e : element.getSafety()) 
38140          composeCodeableConcept(null, e);
38141        closeArray();
38142      };
38143      if (element.hasParent()) {
38144        composeReference("parent", element.getParent());
38145      }
38146  }
38147
38148  protected void composeDeviceDeviceUdiCarrierComponent(String name, Device.DeviceUdiCarrierComponent element) throws IOException {
38149    if (element != null) {
38150      open(name);
38151      composeDeviceDeviceUdiCarrierComponentInner(element);
38152      close();
38153    }
38154  }
38155
38156  protected void composeDeviceDeviceUdiCarrierComponentInner(Device.DeviceUdiCarrierComponent element) throws IOException {
38157      composeBackbone(element);
38158      if (element.hasDeviceIdentifierElement()) {
38159        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
38160        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
38161      }
38162      if (element.hasIssuerElement()) {
38163        composeUriCore("issuer", element.getIssuerElement(), false);
38164        composeUriExtras("issuer", element.getIssuerElement(), false);
38165      }
38166      if (element.hasJurisdictionElement()) {
38167        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
38168        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
38169      }
38170      if (element.hasCarrierAIDCElement()) {
38171        composeBase64BinaryCore("carrierAIDC", element.getCarrierAIDCElement(), false);
38172        composeBase64BinaryExtras("carrierAIDC", element.getCarrierAIDCElement(), false);
38173      }
38174      if (element.hasCarrierHRFElement()) {
38175        composeStringCore("carrierHRF", element.getCarrierHRFElement(), false);
38176        composeStringExtras("carrierHRF", element.getCarrierHRFElement(), false);
38177      }
38178      if (element.hasEntryTypeElement()) {
38179        composeEnumerationCore("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
38180        composeEnumerationExtras("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
38181      }
38182  }
38183
38184  protected void composeDeviceDeviceDeviceNameComponent(String name, Device.DeviceDeviceNameComponent element) throws IOException {
38185    if (element != null) {
38186      open(name);
38187      composeDeviceDeviceDeviceNameComponentInner(element);
38188      close();
38189    }
38190  }
38191
38192  protected void composeDeviceDeviceDeviceNameComponentInner(Device.DeviceDeviceNameComponent element) throws IOException {
38193      composeBackbone(element);
38194      if (element.hasNameElement()) {
38195        composeStringCore("name", element.getNameElement(), false);
38196        composeStringExtras("name", element.getNameElement(), false);
38197      }
38198      if (element.hasTypeElement()) {
38199        composeEnumerationCore("type", element.getTypeElement(), new Device.DeviceNameTypeEnumFactory(), false);
38200        composeEnumerationExtras("type", element.getTypeElement(), new Device.DeviceNameTypeEnumFactory(), false);
38201      }
38202  }
38203
38204  protected void composeDeviceDeviceSpecializationComponent(String name, Device.DeviceSpecializationComponent element) throws IOException {
38205    if (element != null) {
38206      open(name);
38207      composeDeviceDeviceSpecializationComponentInner(element);
38208      close();
38209    }
38210  }
38211
38212  protected void composeDeviceDeviceSpecializationComponentInner(Device.DeviceSpecializationComponent element) throws IOException {
38213      composeBackbone(element);
38214      if (element.hasSystemType()) {
38215        composeCodeableConcept("systemType", element.getSystemType());
38216      }
38217      if (element.hasVersionElement()) {
38218        composeStringCore("version", element.getVersionElement(), false);
38219        composeStringExtras("version", element.getVersionElement(), false);
38220      }
38221  }
38222
38223  protected void composeDeviceDeviceVersionComponent(String name, Device.DeviceVersionComponent element) throws IOException {
38224    if (element != null) {
38225      open(name);
38226      composeDeviceDeviceVersionComponentInner(element);
38227      close();
38228    }
38229  }
38230
38231  protected void composeDeviceDeviceVersionComponentInner(Device.DeviceVersionComponent element) throws IOException {
38232      composeBackbone(element);
38233      if (element.hasType()) {
38234        composeCodeableConcept("type", element.getType());
38235      }
38236      if (element.hasComponent()) {
38237        composeIdentifier("component", element.getComponent());
38238      }
38239      if (element.hasValueElement()) {
38240        composeStringCore("value", element.getValueElement(), false);
38241        composeStringExtras("value", element.getValueElement(), false);
38242      }
38243  }
38244
38245  protected void composeDeviceDevicePropertyComponent(String name, Device.DevicePropertyComponent element) throws IOException {
38246    if (element != null) {
38247      open(name);
38248      composeDeviceDevicePropertyComponentInner(element);
38249      close();
38250    }
38251  }
38252
38253  protected void composeDeviceDevicePropertyComponentInner(Device.DevicePropertyComponent element) throws IOException {
38254      composeBackbone(element);
38255      if (element.hasType()) {
38256        composeCodeableConcept("type", element.getType());
38257      }
38258      if (element.hasValueQuantity()) {
38259        openArray("valueQuantity");
38260        for (Quantity e : element.getValueQuantity()) 
38261          composeQuantity(null, e);
38262        closeArray();
38263      };
38264      if (element.hasValueCode()) {
38265        openArray("valueCode");
38266        for (CodeableConcept e : element.getValueCode()) 
38267          composeCodeableConcept(null, e);
38268        closeArray();
38269      };
38270  }
38271
38272  protected void composeDeviceDefinition(String name, DeviceDefinition element) throws IOException {
38273    if (element != null) {
38274      prop("resourceType", name);
38275      composeDeviceDefinitionInner(element);
38276    }
38277  }
38278
38279  protected void composeDeviceDefinitionInner(DeviceDefinition element) throws IOException {
38280      composeDomainResourceElements(element);
38281      if (element.hasIdentifier()) {
38282        openArray("identifier");
38283        for (Identifier e : element.getIdentifier()) 
38284          composeIdentifier(null, e);
38285        closeArray();
38286      };
38287      if (element.hasUdiDeviceIdentifier()) {
38288        openArray("udiDeviceIdentifier");
38289        for (DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent e : element.getUdiDeviceIdentifier()) 
38290          composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(null, e);
38291        closeArray();
38292      };
38293      if (element.hasManufacturer()) {
38294        composeType("manufacturer", element.getManufacturer());
38295      }
38296      if (element.hasDeviceName()) {
38297        openArray("deviceName");
38298        for (DeviceDefinition.DeviceDefinitionDeviceNameComponent e : element.getDeviceName()) 
38299          composeDeviceDefinitionDeviceDefinitionDeviceNameComponent(null, e);
38300        closeArray();
38301      };
38302      if (element.hasModelNumberElement()) {
38303        composeStringCore("modelNumber", element.getModelNumberElement(), false);
38304        composeStringExtras("modelNumber", element.getModelNumberElement(), false);
38305      }
38306      if (element.hasType()) {
38307        composeCodeableConcept("type", element.getType());
38308      }
38309      if (element.hasSpecialization()) {
38310        openArray("specialization");
38311        for (DeviceDefinition.DeviceDefinitionSpecializationComponent e : element.getSpecialization()) 
38312          composeDeviceDefinitionDeviceDefinitionSpecializationComponent(null, e);
38313        closeArray();
38314      };
38315      if (element.hasVersion()) {
38316        openArray("version");
38317        for (StringType e : element.getVersion()) 
38318          composeStringCore(null, e, true);
38319        closeArray();
38320        if (anyHasExtras(element.getVersion())) {
38321          openArray("_version");
38322          for (StringType e : element.getVersion()) 
38323            composeStringExtras(null, e, true);
38324          closeArray();
38325        }
38326      };
38327      if (element.hasSafety()) {
38328        openArray("safety");
38329        for (CodeableConcept e : element.getSafety()) 
38330          composeCodeableConcept(null, e);
38331        closeArray();
38332      };
38333      if (element.hasShelfLifeStorage()) {
38334        openArray("shelfLifeStorage");
38335        for (ProductShelfLife e : element.getShelfLifeStorage()) 
38336          composeProductShelfLife(null, e);
38337        closeArray();
38338      };
38339      if (element.hasPhysicalCharacteristics()) {
38340        composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
38341      }
38342      if (element.hasLanguageCode()) {
38343        openArray("languageCode");
38344        for (CodeableConcept e : element.getLanguageCode()) 
38345          composeCodeableConcept(null, e);
38346        closeArray();
38347      };
38348      if (element.hasCapability()) {
38349        openArray("capability");
38350        for (DeviceDefinition.DeviceDefinitionCapabilityComponent e : element.getCapability()) 
38351          composeDeviceDefinitionDeviceDefinitionCapabilityComponent(null, e);
38352        closeArray();
38353      };
38354      if (element.hasProperty()) {
38355        openArray("property");
38356        for (DeviceDefinition.DeviceDefinitionPropertyComponent e : element.getProperty()) 
38357          composeDeviceDefinitionDeviceDefinitionPropertyComponent(null, e);
38358        closeArray();
38359      };
38360      if (element.hasOwner()) {
38361        composeReference("owner", element.getOwner());
38362      }
38363      if (element.hasContact()) {
38364        openArray("contact");
38365        for (ContactPoint e : element.getContact()) 
38366          composeContactPoint(null, e);
38367        closeArray();
38368      };
38369      if (element.hasUrlElement()) {
38370        composeUriCore("url", element.getUrlElement(), false);
38371        composeUriExtras("url", element.getUrlElement(), false);
38372      }
38373      if (element.hasOnlineInformationElement()) {
38374        composeUriCore("onlineInformation", element.getOnlineInformationElement(), false);
38375        composeUriExtras("onlineInformation", element.getOnlineInformationElement(), false);
38376      }
38377      if (element.hasNote()) {
38378        openArray("note");
38379        for (Annotation e : element.getNote()) 
38380          composeAnnotation(null, e);
38381        closeArray();
38382      };
38383      if (element.hasQuantity()) {
38384        composeQuantity("quantity", element.getQuantity());
38385      }
38386      if (element.hasParentDevice()) {
38387        composeReference("parentDevice", element.getParentDevice());
38388      }
38389      if (element.hasMaterial()) {
38390        openArray("material");
38391        for (DeviceDefinition.DeviceDefinitionMaterialComponent e : element.getMaterial()) 
38392          composeDeviceDefinitionDeviceDefinitionMaterialComponent(null, e);
38393        closeArray();
38394      };
38395  }
38396
38397  protected void composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(String name, DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
38398    if (element != null) {
38399      open(name);
38400      composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentInner(element);
38401      close();
38402    }
38403  }
38404
38405  protected void composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentInner(DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
38406      composeBackbone(element);
38407      if (element.hasDeviceIdentifierElement()) {
38408        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
38409        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
38410      }
38411      if (element.hasIssuerElement()) {
38412        composeUriCore("issuer", element.getIssuerElement(), false);
38413        composeUriExtras("issuer", element.getIssuerElement(), false);
38414      }
38415      if (element.hasJurisdictionElement()) {
38416        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
38417        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
38418      }
38419  }
38420
38421  protected void composeDeviceDefinitionDeviceDefinitionDeviceNameComponent(String name, DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
38422    if (element != null) {
38423      open(name);
38424      composeDeviceDefinitionDeviceDefinitionDeviceNameComponentInner(element);
38425      close();
38426    }
38427  }
38428
38429  protected void composeDeviceDefinitionDeviceDefinitionDeviceNameComponentInner(DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
38430      composeBackbone(element);
38431      if (element.hasNameElement()) {
38432        composeStringCore("name", element.getNameElement(), false);
38433        composeStringExtras("name", element.getNameElement(), false);
38434      }
38435      if (element.hasTypeElement()) {
38436        composeEnumerationCore("type", element.getTypeElement(), new DeviceDefinition.DeviceNameTypeEnumFactory(), false);
38437        composeEnumerationExtras("type", element.getTypeElement(), new DeviceDefinition.DeviceNameTypeEnumFactory(), false);
38438      }
38439  }
38440
38441  protected void composeDeviceDefinitionDeviceDefinitionSpecializationComponent(String name, DeviceDefinition.DeviceDefinitionSpecializationComponent element) throws IOException {
38442    if (element != null) {
38443      open(name);
38444      composeDeviceDefinitionDeviceDefinitionSpecializationComponentInner(element);
38445      close();
38446    }
38447  }
38448
38449  protected void composeDeviceDefinitionDeviceDefinitionSpecializationComponentInner(DeviceDefinition.DeviceDefinitionSpecializationComponent element) throws IOException {
38450      composeBackbone(element);
38451      if (element.hasSystemTypeElement()) {
38452        composeStringCore("systemType", element.getSystemTypeElement(), false);
38453        composeStringExtras("systemType", element.getSystemTypeElement(), false);
38454      }
38455      if (element.hasVersionElement()) {
38456        composeStringCore("version", element.getVersionElement(), false);
38457        composeStringExtras("version", element.getVersionElement(), false);
38458      }
38459  }
38460
38461  protected void composeDeviceDefinitionDeviceDefinitionCapabilityComponent(String name, DeviceDefinition.DeviceDefinitionCapabilityComponent element) throws IOException {
38462    if (element != null) {
38463      open(name);
38464      composeDeviceDefinitionDeviceDefinitionCapabilityComponentInner(element);
38465      close();
38466    }
38467  }
38468
38469  protected void composeDeviceDefinitionDeviceDefinitionCapabilityComponentInner(DeviceDefinition.DeviceDefinitionCapabilityComponent element) throws IOException {
38470      composeBackbone(element);
38471      if (element.hasType()) {
38472        composeCodeableConcept("type", element.getType());
38473      }
38474      if (element.hasDescription()) {
38475        openArray("description");
38476        for (CodeableConcept e : element.getDescription()) 
38477          composeCodeableConcept(null, e);
38478        closeArray();
38479      };
38480  }
38481
38482  protected void composeDeviceDefinitionDeviceDefinitionPropertyComponent(String name, DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
38483    if (element != null) {
38484      open(name);
38485      composeDeviceDefinitionDeviceDefinitionPropertyComponentInner(element);
38486      close();
38487    }
38488  }
38489
38490  protected void composeDeviceDefinitionDeviceDefinitionPropertyComponentInner(DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
38491      composeBackbone(element);
38492      if (element.hasType()) {
38493        composeCodeableConcept("type", element.getType());
38494      }
38495      if (element.hasValueQuantity()) {
38496        openArray("valueQuantity");
38497        for (Quantity e : element.getValueQuantity()) 
38498          composeQuantity(null, e);
38499        closeArray();
38500      };
38501      if (element.hasValueCode()) {
38502        openArray("valueCode");
38503        for (CodeableConcept e : element.getValueCode()) 
38504          composeCodeableConcept(null, e);
38505        closeArray();
38506      };
38507  }
38508
38509  protected void composeDeviceDefinitionDeviceDefinitionMaterialComponent(String name, DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
38510    if (element != null) {
38511      open(name);
38512      composeDeviceDefinitionDeviceDefinitionMaterialComponentInner(element);
38513      close();
38514    }
38515  }
38516
38517  protected void composeDeviceDefinitionDeviceDefinitionMaterialComponentInner(DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
38518      composeBackbone(element);
38519      if (element.hasSubstance()) {
38520        composeCodeableConcept("substance", element.getSubstance());
38521      }
38522      if (element.hasAlternateElement()) {
38523        composeBooleanCore("alternate", element.getAlternateElement(), false);
38524        composeBooleanExtras("alternate", element.getAlternateElement(), false);
38525      }
38526      if (element.hasAllergenicIndicatorElement()) {
38527        composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
38528        composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
38529      }
38530  }
38531
38532  protected void composeDeviceMetric(String name, DeviceMetric element) throws IOException {
38533    if (element != null) {
38534      prop("resourceType", name);
38535      composeDeviceMetricInner(element);
38536    }
38537  }
38538
38539  protected void composeDeviceMetricInner(DeviceMetric element) throws IOException {
38540      composeDomainResourceElements(element);
38541      if (element.hasIdentifier()) {
38542        openArray("identifier");
38543        for (Identifier e : element.getIdentifier()) 
38544          composeIdentifier(null, e);
38545        closeArray();
38546      };
38547      if (element.hasType()) {
38548        composeCodeableConcept("type", element.getType());
38549      }
38550      if (element.hasUnit()) {
38551        composeCodeableConcept("unit", element.getUnit());
38552      }
38553      if (element.hasSource()) {
38554        composeReference("source", element.getSource());
38555      }
38556      if (element.hasParent()) {
38557        composeReference("parent", element.getParent());
38558      }
38559      if (element.hasOperationalStatusElement()) {
38560        composeEnumerationCore("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
38561        composeEnumerationExtras("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
38562      }
38563      if (element.hasColorElement()) {
38564        composeEnumerationCore("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
38565        composeEnumerationExtras("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
38566      }
38567      if (element.hasCategoryElement()) {
38568        composeEnumerationCore("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
38569        composeEnumerationExtras("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
38570      }
38571      if (element.hasMeasurementPeriod()) {
38572        composeTiming("measurementPeriod", element.getMeasurementPeriod());
38573      }
38574      if (element.hasCalibration()) {
38575        openArray("calibration");
38576        for (DeviceMetric.DeviceMetricCalibrationComponent e : element.getCalibration()) 
38577          composeDeviceMetricDeviceMetricCalibrationComponent(null, e);
38578        closeArray();
38579      };
38580  }
38581
38582  protected void composeDeviceMetricDeviceMetricCalibrationComponent(String name, DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
38583    if (element != null) {
38584      open(name);
38585      composeDeviceMetricDeviceMetricCalibrationComponentInner(element);
38586      close();
38587    }
38588  }
38589
38590  protected void composeDeviceMetricDeviceMetricCalibrationComponentInner(DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
38591      composeBackbone(element);
38592      if (element.hasTypeElement()) {
38593        composeEnumerationCore("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
38594        composeEnumerationExtras("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
38595      }
38596      if (element.hasStateElement()) {
38597        composeEnumerationCore("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
38598        composeEnumerationExtras("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
38599      }
38600      if (element.hasTimeElement()) {
38601        composeInstantCore("time", element.getTimeElement(), false);
38602        composeInstantExtras("time", element.getTimeElement(), false);
38603      }
38604  }
38605
38606  protected void composeDeviceRequest(String name, DeviceRequest element) throws IOException {
38607    if (element != null) {
38608      prop("resourceType", name);
38609      composeDeviceRequestInner(element);
38610    }
38611  }
38612
38613  protected void composeDeviceRequestInner(DeviceRequest element) throws IOException {
38614      composeDomainResourceElements(element);
38615      if (element.hasIdentifier()) {
38616        openArray("identifier");
38617        for (Identifier e : element.getIdentifier()) 
38618          composeIdentifier(null, e);
38619        closeArray();
38620      };
38621      if (element.hasInstantiatesCanonical()) {
38622        openArray("instantiatesCanonical");
38623        for (CanonicalType e : element.getInstantiatesCanonical()) 
38624          composeCanonicalCore(null, e, true);
38625        closeArray();
38626        if (anyHasExtras(element.getInstantiatesCanonical())) {
38627          openArray("_instantiatesCanonical");
38628          for (CanonicalType e : element.getInstantiatesCanonical()) 
38629            composeCanonicalExtras(null, e, true);
38630          closeArray();
38631        }
38632      };
38633      if (element.hasInstantiatesUri()) {
38634        openArray("instantiatesUri");
38635        for (UriType e : element.getInstantiatesUri()) 
38636          composeUriCore(null, e, true);
38637        closeArray();
38638        if (anyHasExtras(element.getInstantiatesUri())) {
38639          openArray("_instantiatesUri");
38640          for (UriType e : element.getInstantiatesUri()) 
38641            composeUriExtras(null, e, true);
38642          closeArray();
38643        }
38644      };
38645      if (element.hasBasedOn()) {
38646        openArray("basedOn");
38647        for (Reference e : element.getBasedOn()) 
38648          composeReference(null, e);
38649        closeArray();
38650      };
38651      if (element.hasPriorRequest()) {
38652        openArray("priorRequest");
38653        for (Reference e : element.getPriorRequest()) 
38654          composeReference(null, e);
38655        closeArray();
38656      };
38657      if (element.hasGroupIdentifier()) {
38658        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
38659      }
38660      if (element.hasStatusElement()) {
38661        composeEnumerationCore("status", element.getStatusElement(), new DeviceRequest.DeviceRequestStatusEnumFactory(), false);
38662        composeEnumerationExtras("status", element.getStatusElement(), new DeviceRequest.DeviceRequestStatusEnumFactory(), false);
38663      }
38664      if (element.hasIntentElement()) {
38665        composeEnumerationCore("intent", element.getIntentElement(), new DeviceRequest.RequestIntentEnumFactory(), false);
38666        composeEnumerationExtras("intent", element.getIntentElement(), new DeviceRequest.RequestIntentEnumFactory(), false);
38667      }
38668      if (element.hasPriorityElement()) {
38669        composeEnumerationCore("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory(), false);
38670        composeEnumerationExtras("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory(), false);
38671      }
38672      if (element.hasCode()) {
38673        composeType("code", element.getCode());
38674      }
38675      if (element.hasParameter()) {
38676        openArray("parameter");
38677        for (DeviceRequest.DeviceRequestParameterComponent e : element.getParameter()) 
38678          composeDeviceRequestDeviceRequestParameterComponent(null, e);
38679        closeArray();
38680      };
38681      if (element.hasSubject()) {
38682        composeReference("subject", element.getSubject());
38683      }
38684      if (element.hasEncounter()) {
38685        composeReference("encounter", element.getEncounter());
38686      }
38687      if (element.hasOccurrence()) {
38688        composeType("occurrence", element.getOccurrence());
38689      }
38690      if (element.hasAuthoredOnElement()) {
38691        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
38692        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
38693      }
38694      if (element.hasRequester()) {
38695        composeReference("requester", element.getRequester());
38696      }
38697      if (element.hasPerformerType()) {
38698        composeCodeableConcept("performerType", element.getPerformerType());
38699      }
38700      if (element.hasPerformer()) {
38701        composeReference("performer", element.getPerformer());
38702      }
38703      if (element.hasReasonCode()) {
38704        openArray("reasonCode");
38705        for (CodeableConcept e : element.getReasonCode()) 
38706          composeCodeableConcept(null, e);
38707        closeArray();
38708      };
38709      if (element.hasReasonReference()) {
38710        openArray("reasonReference");
38711        for (Reference e : element.getReasonReference()) 
38712          composeReference(null, e);
38713        closeArray();
38714      };
38715      if (element.hasInsurance()) {
38716        openArray("insurance");
38717        for (Reference e : element.getInsurance()) 
38718          composeReference(null, e);
38719        closeArray();
38720      };
38721      if (element.hasSupportingInfo()) {
38722        openArray("supportingInfo");
38723        for (Reference e : element.getSupportingInfo()) 
38724          composeReference(null, e);
38725        closeArray();
38726      };
38727      if (element.hasNote()) {
38728        openArray("note");
38729        for (Annotation e : element.getNote()) 
38730          composeAnnotation(null, e);
38731        closeArray();
38732      };
38733      if (element.hasRelevantHistory()) {
38734        openArray("relevantHistory");
38735        for (Reference e : element.getRelevantHistory()) 
38736          composeReference(null, e);
38737        closeArray();
38738      };
38739  }
38740
38741  protected void composeDeviceRequestDeviceRequestParameterComponent(String name, DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
38742    if (element != null) {
38743      open(name);
38744      composeDeviceRequestDeviceRequestParameterComponentInner(element);
38745      close();
38746    }
38747  }
38748
38749  protected void composeDeviceRequestDeviceRequestParameterComponentInner(DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
38750      composeBackbone(element);
38751      if (element.hasCode()) {
38752        composeCodeableConcept("code", element.getCode());
38753      }
38754      if (element.hasValue()) {
38755        composeType("value", element.getValue());
38756      }
38757  }
38758
38759  protected void composeDeviceUseStatement(String name, DeviceUseStatement element) throws IOException {
38760    if (element != null) {
38761      prop("resourceType", name);
38762      composeDeviceUseStatementInner(element);
38763    }
38764  }
38765
38766  protected void composeDeviceUseStatementInner(DeviceUseStatement element) throws IOException {
38767      composeDomainResourceElements(element);
38768      if (element.hasIdentifier()) {
38769        openArray("identifier");
38770        for (Identifier e : element.getIdentifier()) 
38771          composeIdentifier(null, e);
38772        closeArray();
38773      };
38774      if (element.hasBasedOn()) {
38775        openArray("basedOn");
38776        for (Reference e : element.getBasedOn()) 
38777          composeReference(null, e);
38778        closeArray();
38779      };
38780      if (element.hasStatusElement()) {
38781        composeEnumerationCore("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
38782        composeEnumerationExtras("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
38783      }
38784      if (element.hasSubject()) {
38785        composeReference("subject", element.getSubject());
38786      }
38787      if (element.hasDerivedFrom()) {
38788        openArray("derivedFrom");
38789        for (Reference e : element.getDerivedFrom()) 
38790          composeReference(null, e);
38791        closeArray();
38792      };
38793      if (element.hasTiming()) {
38794        composeType("timing", element.getTiming());
38795      }
38796      if (element.hasRecordedOnElement()) {
38797        composeDateTimeCore("recordedOn", element.getRecordedOnElement(), false);
38798        composeDateTimeExtras("recordedOn", element.getRecordedOnElement(), false);
38799      }
38800      if (element.hasSource()) {
38801        composeReference("source", element.getSource());
38802      }
38803      if (element.hasDevice()) {
38804        composeReference("device", element.getDevice());
38805      }
38806      if (element.hasReasonCode()) {
38807        openArray("reasonCode");
38808        for (CodeableConcept e : element.getReasonCode()) 
38809          composeCodeableConcept(null, e);
38810        closeArray();
38811      };
38812      if (element.hasReasonReference()) {
38813        openArray("reasonReference");
38814        for (Reference e : element.getReasonReference()) 
38815          composeReference(null, e);
38816        closeArray();
38817      };
38818      if (element.hasBodySite()) {
38819        composeCodeableConcept("bodySite", element.getBodySite());
38820      }
38821      if (element.hasNote()) {
38822        openArray("note");
38823        for (Annotation e : element.getNote()) 
38824          composeAnnotation(null, e);
38825        closeArray();
38826      };
38827  }
38828
38829  protected void composeDiagnosticReport(String name, DiagnosticReport element) throws IOException {
38830    if (element != null) {
38831      prop("resourceType", name);
38832      composeDiagnosticReportInner(element);
38833    }
38834  }
38835
38836  protected void composeDiagnosticReportInner(DiagnosticReport element) throws IOException {
38837      composeDomainResourceElements(element);
38838      if (element.hasIdentifier()) {
38839        openArray("identifier");
38840        for (Identifier e : element.getIdentifier()) 
38841          composeIdentifier(null, e);
38842        closeArray();
38843      };
38844      if (element.hasBasedOn()) {
38845        openArray("basedOn");
38846        for (Reference e : element.getBasedOn()) 
38847          composeReference(null, e);
38848        closeArray();
38849      };
38850      if (element.hasStatusElement()) {
38851        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
38852        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
38853      }
38854      if (element.hasCategory()) {
38855        openArray("category");
38856        for (CodeableConcept e : element.getCategory()) 
38857          composeCodeableConcept(null, e);
38858        closeArray();
38859      };
38860      if (element.hasCode()) {
38861        composeCodeableConcept("code", element.getCode());
38862      }
38863      if (element.hasSubject()) {
38864        composeReference("subject", element.getSubject());
38865      }
38866      if (element.hasEncounter()) {
38867        composeReference("encounter", element.getEncounter());
38868      }
38869      if (element.hasEffective()) {
38870        composeType("effective", element.getEffective());
38871      }
38872      if (element.hasIssuedElement()) {
38873        composeInstantCore("issued", element.getIssuedElement(), false);
38874        composeInstantExtras("issued", element.getIssuedElement(), false);
38875      }
38876      if (element.hasPerformer()) {
38877        openArray("performer");
38878        for (Reference e : element.getPerformer()) 
38879          composeReference(null, e);
38880        closeArray();
38881      };
38882      if (element.hasResultsInterpreter()) {
38883        openArray("resultsInterpreter");
38884        for (Reference e : element.getResultsInterpreter()) 
38885          composeReference(null, e);
38886        closeArray();
38887      };
38888      if (element.hasSpecimen()) {
38889        openArray("specimen");
38890        for (Reference e : element.getSpecimen()) 
38891          composeReference(null, e);
38892        closeArray();
38893      };
38894      if (element.hasResult()) {
38895        openArray("result");
38896        for (Reference e : element.getResult()) 
38897          composeReference(null, e);
38898        closeArray();
38899      };
38900      if (element.hasImagingStudy()) {
38901        openArray("imagingStudy");
38902        for (Reference e : element.getImagingStudy()) 
38903          composeReference(null, e);
38904        closeArray();
38905      };
38906      if (element.hasMedia()) {
38907        openArray("media");
38908        for (DiagnosticReport.DiagnosticReportMediaComponent e : element.getMedia()) 
38909          composeDiagnosticReportDiagnosticReportMediaComponent(null, e);
38910        closeArray();
38911      };
38912      if (element.hasConclusionElement()) {
38913        composeStringCore("conclusion", element.getConclusionElement(), false);
38914        composeStringExtras("conclusion", element.getConclusionElement(), false);
38915      }
38916      if (element.hasConclusionCode()) {
38917        openArray("conclusionCode");
38918        for (CodeableConcept e : element.getConclusionCode()) 
38919          composeCodeableConcept(null, e);
38920        closeArray();
38921      };
38922      if (element.hasPresentedForm()) {
38923        openArray("presentedForm");
38924        for (Attachment e : element.getPresentedForm()) 
38925          composeAttachment(null, e);
38926        closeArray();
38927      };
38928  }
38929
38930  protected void composeDiagnosticReportDiagnosticReportMediaComponent(String name, DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
38931    if (element != null) {
38932      open(name);
38933      composeDiagnosticReportDiagnosticReportMediaComponentInner(element);
38934      close();
38935    }
38936  }
38937
38938  protected void composeDiagnosticReportDiagnosticReportMediaComponentInner(DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
38939      composeBackbone(element);
38940      if (element.hasCommentElement()) {
38941        composeStringCore("comment", element.getCommentElement(), false);
38942        composeStringExtras("comment", element.getCommentElement(), false);
38943      }
38944      if (element.hasLink()) {
38945        composeReference("link", element.getLink());
38946      }
38947  }
38948
38949  protected void composeDocumentManifest(String name, DocumentManifest element) throws IOException {
38950    if (element != null) {
38951      prop("resourceType", name);
38952      composeDocumentManifestInner(element);
38953    }
38954  }
38955
38956  protected void composeDocumentManifestInner(DocumentManifest element) throws IOException {
38957      composeDomainResourceElements(element);
38958      if (element.hasMasterIdentifier()) {
38959        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
38960      }
38961      if (element.hasIdentifier()) {
38962        openArray("identifier");
38963        for (Identifier e : element.getIdentifier()) 
38964          composeIdentifier(null, e);
38965        closeArray();
38966      };
38967      if (element.hasStatusElement()) {
38968        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
38969        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
38970      }
38971      if (element.hasType()) {
38972        composeCodeableConcept("type", element.getType());
38973      }
38974      if (element.hasSubject()) {
38975        composeReference("subject", element.getSubject());
38976      }
38977      if (element.hasCreatedElement()) {
38978        composeDateTimeCore("created", element.getCreatedElement(), false);
38979        composeDateTimeExtras("created", element.getCreatedElement(), false);
38980      }
38981      if (element.hasAuthor()) {
38982        openArray("author");
38983        for (Reference e : element.getAuthor()) 
38984          composeReference(null, e);
38985        closeArray();
38986      };
38987      if (element.hasRecipient()) {
38988        openArray("recipient");
38989        for (Reference e : element.getRecipient()) 
38990          composeReference(null, e);
38991        closeArray();
38992      };
38993      if (element.hasSourceElement()) {
38994        composeUriCore("source", element.getSourceElement(), false);
38995        composeUriExtras("source", element.getSourceElement(), false);
38996      }
38997      if (element.hasDescriptionElement()) {
38998        composeStringCore("description", element.getDescriptionElement(), false);
38999        composeStringExtras("description", element.getDescriptionElement(), false);
39000      }
39001      if (element.hasContent()) {
39002        openArray("content");
39003        for (Reference e : element.getContent()) 
39004          composeReference(null, e);
39005        closeArray();
39006      };
39007      if (element.hasRelated()) {
39008        openArray("related");
39009        for (DocumentManifest.DocumentManifestRelatedComponent e : element.getRelated()) 
39010          composeDocumentManifestDocumentManifestRelatedComponent(null, e);
39011        closeArray();
39012      };
39013  }
39014
39015  protected void composeDocumentManifestDocumentManifestRelatedComponent(String name, DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
39016    if (element != null) {
39017      open(name);
39018      composeDocumentManifestDocumentManifestRelatedComponentInner(element);
39019      close();
39020    }
39021  }
39022
39023  protected void composeDocumentManifestDocumentManifestRelatedComponentInner(DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
39024      composeBackbone(element);
39025      if (element.hasIdentifier()) {
39026        composeIdentifier("identifier", element.getIdentifier());
39027      }
39028      if (element.hasRef()) {
39029        composeReference("ref", element.getRef());
39030      }
39031  }
39032
39033  protected void composeDocumentReference(String name, DocumentReference element) throws IOException {
39034    if (element != null) {
39035      prop("resourceType", name);
39036      composeDocumentReferenceInner(element);
39037    }
39038  }
39039
39040  protected void composeDocumentReferenceInner(DocumentReference element) throws IOException {
39041      composeDomainResourceElements(element);
39042      if (element.hasMasterIdentifier()) {
39043        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
39044      }
39045      if (element.hasIdentifier()) {
39046        openArray("identifier");
39047        for (Identifier e : element.getIdentifier()) 
39048          composeIdentifier(null, e);
39049        closeArray();
39050      };
39051      if (element.hasStatusElement()) {
39052        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
39053        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
39054      }
39055      if (element.hasDocStatusElement()) {
39056        composeEnumerationCore("docStatus", element.getDocStatusElement(), new DocumentReference.ReferredDocumentStatusEnumFactory(), false);
39057        composeEnumerationExtras("docStatus", element.getDocStatusElement(), new DocumentReference.ReferredDocumentStatusEnumFactory(), false);
39058      }
39059      if (element.hasType()) {
39060        composeCodeableConcept("type", element.getType());
39061      }
39062      if (element.hasCategory()) {
39063        openArray("category");
39064        for (CodeableConcept e : element.getCategory()) 
39065          composeCodeableConcept(null, e);
39066        closeArray();
39067      };
39068      if (element.hasSubject()) {
39069        composeReference("subject", element.getSubject());
39070      }
39071      if (element.hasDateElement()) {
39072        composeInstantCore("date", element.getDateElement(), false);
39073        composeInstantExtras("date", element.getDateElement(), false);
39074      }
39075      if (element.hasAuthor()) {
39076        openArray("author");
39077        for (Reference e : element.getAuthor()) 
39078          composeReference(null, e);
39079        closeArray();
39080      };
39081      if (element.hasAuthenticator()) {
39082        composeReference("authenticator", element.getAuthenticator());
39083      }
39084      if (element.hasCustodian()) {
39085        composeReference("custodian", element.getCustodian());
39086      }
39087      if (element.hasRelatesTo()) {
39088        openArray("relatesTo");
39089        for (DocumentReference.DocumentReferenceRelatesToComponent e : element.getRelatesTo()) 
39090          composeDocumentReferenceDocumentReferenceRelatesToComponent(null, e);
39091        closeArray();
39092      };
39093      if (element.hasDescriptionElement()) {
39094        composeStringCore("description", element.getDescriptionElement(), false);
39095        composeStringExtras("description", element.getDescriptionElement(), false);
39096      }
39097      if (element.hasSecurityLabel()) {
39098        openArray("securityLabel");
39099        for (CodeableConcept e : element.getSecurityLabel()) 
39100          composeCodeableConcept(null, e);
39101        closeArray();
39102      };
39103      if (element.hasContent()) {
39104        openArray("content");
39105        for (DocumentReference.DocumentReferenceContentComponent e : element.getContent()) 
39106          composeDocumentReferenceDocumentReferenceContentComponent(null, e);
39107        closeArray();
39108      };
39109      if (element.hasContext()) {
39110        composeDocumentReferenceDocumentReferenceContextComponent("context", element.getContext());
39111      }
39112  }
39113
39114  protected void composeDocumentReferenceDocumentReferenceRelatesToComponent(String name, DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
39115    if (element != null) {
39116      open(name);
39117      composeDocumentReferenceDocumentReferenceRelatesToComponentInner(element);
39118      close();
39119    }
39120  }
39121
39122  protected void composeDocumentReferenceDocumentReferenceRelatesToComponentInner(DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
39123      composeBackbone(element);
39124      if (element.hasCodeElement()) {
39125        composeEnumerationCore("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
39126        composeEnumerationExtras("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
39127      }
39128      if (element.hasTarget()) {
39129        composeReference("target", element.getTarget());
39130      }
39131  }
39132
39133  protected void composeDocumentReferenceDocumentReferenceContentComponent(String name, DocumentReference.DocumentReferenceContentComponent element) throws IOException {
39134    if (element != null) {
39135      open(name);
39136      composeDocumentReferenceDocumentReferenceContentComponentInner(element);
39137      close();
39138    }
39139  }
39140
39141  protected void composeDocumentReferenceDocumentReferenceContentComponentInner(DocumentReference.DocumentReferenceContentComponent element) throws IOException {
39142      composeBackbone(element);
39143      if (element.hasAttachment()) {
39144        composeAttachment("attachment", element.getAttachment());
39145      }
39146      if (element.hasFormat()) {
39147        composeCoding("format", element.getFormat());
39148      }
39149  }
39150
39151  protected void composeDocumentReferenceDocumentReferenceContextComponent(String name, DocumentReference.DocumentReferenceContextComponent element) throws IOException {
39152    if (element != null) {
39153      open(name);
39154      composeDocumentReferenceDocumentReferenceContextComponentInner(element);
39155      close();
39156    }
39157  }
39158
39159  protected void composeDocumentReferenceDocumentReferenceContextComponentInner(DocumentReference.DocumentReferenceContextComponent element) throws IOException {
39160      composeBackbone(element);
39161      if (element.hasEncounter()) {
39162        openArray("encounter");
39163        for (Reference e : element.getEncounter()) 
39164          composeReference(null, e);
39165        closeArray();
39166      };
39167      if (element.hasEvent()) {
39168        openArray("event");
39169        for (CodeableConcept e : element.getEvent()) 
39170          composeCodeableConcept(null, e);
39171        closeArray();
39172      };
39173      if (element.hasPeriod()) {
39174        composePeriod("period", element.getPeriod());
39175      }
39176      if (element.hasFacilityType()) {
39177        composeCodeableConcept("facilityType", element.getFacilityType());
39178      }
39179      if (element.hasPracticeSetting()) {
39180        composeCodeableConcept("practiceSetting", element.getPracticeSetting());
39181      }
39182      if (element.hasSourcePatientInfo()) {
39183        composeReference("sourcePatientInfo", element.getSourcePatientInfo());
39184      }
39185      if (element.hasRelated()) {
39186        openArray("related");
39187        for (Reference e : element.getRelated()) 
39188          composeReference(null, e);
39189        closeArray();
39190      };
39191  }
39192
39193  protected void composeEffectEvidenceSynthesis(String name, EffectEvidenceSynthesis element) throws IOException {
39194    if (element != null) {
39195      prop("resourceType", name);
39196      composeEffectEvidenceSynthesisInner(element);
39197    }
39198  }
39199
39200  protected void composeEffectEvidenceSynthesisInner(EffectEvidenceSynthesis element) throws IOException {
39201      composeDomainResourceElements(element);
39202      if (element.hasUrlElement()) {
39203        composeUriCore("url", element.getUrlElement(), false);
39204        composeUriExtras("url", element.getUrlElement(), false);
39205      }
39206      if (element.hasIdentifier()) {
39207        openArray("identifier");
39208        for (Identifier e : element.getIdentifier()) 
39209          composeIdentifier(null, e);
39210        closeArray();
39211      };
39212      if (element.hasVersionElement()) {
39213        composeStringCore("version", element.getVersionElement(), false);
39214        composeStringExtras("version", element.getVersionElement(), false);
39215      }
39216      if (element.hasNameElement()) {
39217        composeStringCore("name", element.getNameElement(), false);
39218        composeStringExtras("name", element.getNameElement(), false);
39219      }
39220      if (element.hasTitleElement()) {
39221        composeStringCore("title", element.getTitleElement(), false);
39222        composeStringExtras("title", element.getTitleElement(), false);
39223      }
39224      if (element.hasStatusElement()) {
39225        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39226        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39227      }
39228      if (element.hasDateElement()) {
39229        composeDateTimeCore("date", element.getDateElement(), false);
39230        composeDateTimeExtras("date", element.getDateElement(), false);
39231      }
39232      if (element.hasPublisherElement()) {
39233        composeStringCore("publisher", element.getPublisherElement(), false);
39234        composeStringExtras("publisher", element.getPublisherElement(), false);
39235      }
39236      if (element.hasContact()) {
39237        openArray("contact");
39238        for (ContactDetail e : element.getContact()) 
39239          composeContactDetail(null, e);
39240        closeArray();
39241      };
39242      if (element.hasDescriptionElement()) {
39243        composeMarkdownCore("description", element.getDescriptionElement(), false);
39244        composeMarkdownExtras("description", element.getDescriptionElement(), false);
39245      }
39246      if (element.hasNote()) {
39247        openArray("note");
39248        for (Annotation e : element.getNote()) 
39249          composeAnnotation(null, e);
39250        closeArray();
39251      };
39252      if (element.hasUseContext()) {
39253        openArray("useContext");
39254        for (UsageContext e : element.getUseContext()) 
39255          composeUsageContext(null, e);
39256        closeArray();
39257      };
39258      if (element.hasJurisdiction()) {
39259        openArray("jurisdiction");
39260        for (CodeableConcept e : element.getJurisdiction()) 
39261          composeCodeableConcept(null, e);
39262        closeArray();
39263      };
39264      if (element.hasCopyrightElement()) {
39265        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
39266        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
39267      }
39268      if (element.hasApprovalDateElement()) {
39269        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
39270        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
39271      }
39272      if (element.hasLastReviewDateElement()) {
39273        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
39274        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
39275      }
39276      if (element.hasEffectivePeriod()) {
39277        composePeriod("effectivePeriod", element.getEffectivePeriod());
39278      }
39279      if (element.hasTopic()) {
39280        openArray("topic");
39281        for (CodeableConcept e : element.getTopic()) 
39282          composeCodeableConcept(null, e);
39283        closeArray();
39284      };
39285      if (element.hasAuthor()) {
39286        openArray("author");
39287        for (ContactDetail e : element.getAuthor()) 
39288          composeContactDetail(null, e);
39289        closeArray();
39290      };
39291      if (element.hasEditor()) {
39292        openArray("editor");
39293        for (ContactDetail e : element.getEditor()) 
39294          composeContactDetail(null, e);
39295        closeArray();
39296      };
39297      if (element.hasReviewer()) {
39298        openArray("reviewer");
39299        for (ContactDetail e : element.getReviewer()) 
39300          composeContactDetail(null, e);
39301        closeArray();
39302      };
39303      if (element.hasEndorser()) {
39304        openArray("endorser");
39305        for (ContactDetail e : element.getEndorser()) 
39306          composeContactDetail(null, e);
39307        closeArray();
39308      };
39309      if (element.hasRelatedArtifact()) {
39310        openArray("relatedArtifact");
39311        for (RelatedArtifact e : element.getRelatedArtifact()) 
39312          composeRelatedArtifact(null, e);
39313        closeArray();
39314      };
39315      if (element.hasSynthesisType()) {
39316        composeCodeableConcept("synthesisType", element.getSynthesisType());
39317      }
39318      if (element.hasStudyType()) {
39319        composeCodeableConcept("studyType", element.getStudyType());
39320      }
39321      if (element.hasPopulation()) {
39322        composeReference("population", element.getPopulation());
39323      }
39324      if (element.hasExposure()) {
39325        composeReference("exposure", element.getExposure());
39326      }
39327      if (element.hasExposureAlternative()) {
39328        composeReference("exposureAlternative", element.getExposureAlternative());
39329      }
39330      if (element.hasOutcome()) {
39331        composeReference("outcome", element.getOutcome());
39332      }
39333      if (element.hasSampleSize()) {
39334        composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent("sampleSize", element.getSampleSize());
39335      }
39336      if (element.hasResultsByExposure()) {
39337        openArray("resultsByExposure");
39338        for (EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent e : element.getResultsByExposure()) 
39339          composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(null, e);
39340        closeArray();
39341      };
39342      if (element.hasEffectEstimate()) {
39343        openArray("effectEstimate");
39344        for (EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent e : element.getEffectEstimate()) 
39345          composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(null, e);
39346        closeArray();
39347      };
39348      if (element.hasCertainty()) {
39349        openArray("certainty");
39350        for (EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent e : element.getCertainty()) 
39351          composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(null, e);
39352        closeArray();
39353      };
39354  }
39355
39356  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent element) throws IOException {
39357    if (element != null) {
39358      open(name);
39359      composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentInner(element);
39360      close();
39361    }
39362  }
39363
39364  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisSampleSizeComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisSampleSizeComponent element) throws IOException {
39365      composeBackbone(element);
39366      if (element.hasDescriptionElement()) {
39367        composeStringCore("description", element.getDescriptionElement(), false);
39368        composeStringExtras("description", element.getDescriptionElement(), false);
39369      }
39370      if (element.hasNumberOfStudiesElement()) {
39371        composeIntegerCore("numberOfStudies", element.getNumberOfStudiesElement(), false);
39372        composeIntegerExtras("numberOfStudies", element.getNumberOfStudiesElement(), false);
39373      }
39374      if (element.hasNumberOfParticipantsElement()) {
39375        composeIntegerCore("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
39376        composeIntegerExtras("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
39377      }
39378  }
39379
39380  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent element) throws IOException {
39381    if (element != null) {
39382      open(name);
39383      composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentInner(element);
39384      close();
39385    }
39386  }
39387
39388  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisResultsByExposureComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisResultsByExposureComponent element) throws IOException {
39389      composeBackbone(element);
39390      if (element.hasDescriptionElement()) {
39391        composeStringCore("description", element.getDescriptionElement(), false);
39392        composeStringExtras("description", element.getDescriptionElement(), false);
39393      }
39394      if (element.hasExposureStateElement()) {
39395        composeEnumerationCore("exposureState", element.getExposureStateElement(), new EffectEvidenceSynthesis.ExposureStateEnumFactory(), false);
39396        composeEnumerationExtras("exposureState", element.getExposureStateElement(), new EffectEvidenceSynthesis.ExposureStateEnumFactory(), false);
39397      }
39398      if (element.hasVariantState()) {
39399        composeCodeableConcept("variantState", element.getVariantState());
39400      }
39401      if (element.hasRiskEvidenceSynthesis()) {
39402        composeReference("riskEvidenceSynthesis", element.getRiskEvidenceSynthesis());
39403      }
39404  }
39405
39406  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent element) throws IOException {
39407    if (element != null) {
39408      open(name);
39409      composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentInner(element);
39410      close();
39411    }
39412  }
39413
39414  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimateComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimateComponent element) throws IOException {
39415      composeBackbone(element);
39416      if (element.hasDescriptionElement()) {
39417        composeStringCore("description", element.getDescriptionElement(), false);
39418        composeStringExtras("description", element.getDescriptionElement(), false);
39419      }
39420      if (element.hasType()) {
39421        composeCodeableConcept("type", element.getType());
39422      }
39423      if (element.hasVariantState()) {
39424        composeCodeableConcept("variantState", element.getVariantState());
39425      }
39426      if (element.hasValueElement()) {
39427        composeDecimalCore("value", element.getValueElement(), false);
39428        composeDecimalExtras("value", element.getValueElement(), false);
39429      }
39430      if (element.hasUnitOfMeasure()) {
39431        composeCodeableConcept("unitOfMeasure", element.getUnitOfMeasure());
39432      }
39433      if (element.hasPrecisionEstimate()) {
39434        openArray("precisionEstimate");
39435        for (EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent e : element.getPrecisionEstimate()) 
39436          composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(null, e);
39437        closeArray();
39438      };
39439  }
39440
39441  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent element) throws IOException {
39442    if (element != null) {
39443      open(name);
39444      composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentInner(element);
39445      close();
39446    }
39447  }
39448
39449  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisEffectEstimatePrecisionEstimateComponent element) throws IOException {
39450      composeBackbone(element);
39451      if (element.hasType()) {
39452        composeCodeableConcept("type", element.getType());
39453      }
39454      if (element.hasLevelElement()) {
39455        composeDecimalCore("level", element.getLevelElement(), false);
39456        composeDecimalExtras("level", element.getLevelElement(), false);
39457      }
39458      if (element.hasFromElement()) {
39459        composeDecimalCore("from", element.getFromElement(), false);
39460        composeDecimalExtras("from", element.getFromElement(), false);
39461      }
39462      if (element.hasToElement()) {
39463        composeDecimalCore("to", element.getToElement(), false);
39464        composeDecimalExtras("to", element.getToElement(), false);
39465      }
39466  }
39467
39468  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent element) throws IOException {
39469    if (element != null) {
39470      open(name);
39471      composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentInner(element);
39472      close();
39473    }
39474  }
39475
39476  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyComponent element) throws IOException {
39477      composeBackbone(element);
39478      if (element.hasRating()) {
39479        openArray("rating");
39480        for (CodeableConcept e : element.getRating()) 
39481          composeCodeableConcept(null, e);
39482        closeArray();
39483      };
39484      if (element.hasNote()) {
39485        openArray("note");
39486        for (Annotation e : element.getNote()) 
39487          composeAnnotation(null, e);
39488        closeArray();
39489      };
39490      if (element.hasCertaintySubcomponent()) {
39491        openArray("certaintySubcomponent");
39492        for (EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent e : element.getCertaintySubcomponent()) 
39493          composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(null, e);
39494        closeArray();
39495      };
39496  }
39497
39498  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent(String name, EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent element) throws IOException {
39499    if (element != null) {
39500      open(name);
39501      composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentInner(element);
39502      close();
39503    }
39504  }
39505
39506  protected void composeEffectEvidenceSynthesisEffectEvidenceSynthesisCertaintyCertaintySubcomponentComponentInner(EffectEvidenceSynthesis.EffectEvidenceSynthesisCertaintyCertaintySubcomponentComponent element) throws IOException {
39507      composeBackbone(element);
39508      if (element.hasType()) {
39509        composeCodeableConcept("type", element.getType());
39510      }
39511      if (element.hasRating()) {
39512        openArray("rating");
39513        for (CodeableConcept e : element.getRating()) 
39514          composeCodeableConcept(null, e);
39515        closeArray();
39516      };
39517      if (element.hasNote()) {
39518        openArray("note");
39519        for (Annotation e : element.getNote()) 
39520          composeAnnotation(null, e);
39521        closeArray();
39522      };
39523  }
39524
39525  protected void composeEncounter(String name, Encounter element) throws IOException {
39526    if (element != null) {
39527      prop("resourceType", name);
39528      composeEncounterInner(element);
39529    }
39530  }
39531
39532  protected void composeEncounterInner(Encounter element) throws IOException {
39533      composeDomainResourceElements(element);
39534      if (element.hasIdentifier()) {
39535        openArray("identifier");
39536        for (Identifier e : element.getIdentifier()) 
39537          composeIdentifier(null, e);
39538        closeArray();
39539      };
39540      if (element.hasStatusElement()) {
39541        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
39542        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
39543      }
39544      if (element.hasStatusHistory()) {
39545        openArray("statusHistory");
39546        for (Encounter.StatusHistoryComponent e : element.getStatusHistory()) 
39547          composeEncounterStatusHistoryComponent(null, e);
39548        closeArray();
39549      };
39550      if (element.hasClass_()) {
39551        composeCoding("class", element.getClass_());
39552      }
39553      if (element.hasClassHistory()) {
39554        openArray("classHistory");
39555        for (Encounter.ClassHistoryComponent e : element.getClassHistory()) 
39556          composeEncounterClassHistoryComponent(null, e);
39557        closeArray();
39558      };
39559      if (element.hasType()) {
39560        openArray("type");
39561        for (CodeableConcept e : element.getType()) 
39562          composeCodeableConcept(null, e);
39563        closeArray();
39564      };
39565      if (element.hasServiceType()) {
39566        composeCodeableConcept("serviceType", element.getServiceType());
39567      }
39568      if (element.hasPriority()) {
39569        composeCodeableConcept("priority", element.getPriority());
39570      }
39571      if (element.hasSubject()) {
39572        composeReference("subject", element.getSubject());
39573      }
39574      if (element.hasEpisodeOfCare()) {
39575        openArray("episodeOfCare");
39576        for (Reference e : element.getEpisodeOfCare()) 
39577          composeReference(null, e);
39578        closeArray();
39579      };
39580      if (element.hasBasedOn()) {
39581        openArray("basedOn");
39582        for (Reference e : element.getBasedOn()) 
39583          composeReference(null, e);
39584        closeArray();
39585      };
39586      if (element.hasParticipant()) {
39587        openArray("participant");
39588        for (Encounter.EncounterParticipantComponent e : element.getParticipant()) 
39589          composeEncounterEncounterParticipantComponent(null, e);
39590        closeArray();
39591      };
39592      if (element.hasAppointment()) {
39593        openArray("appointment");
39594        for (Reference e : element.getAppointment()) 
39595          composeReference(null, e);
39596        closeArray();
39597      };
39598      if (element.hasPeriod()) {
39599        composePeriod("period", element.getPeriod());
39600      }
39601      if (element.hasLength()) {
39602        composeDuration("length", element.getLength());
39603      }
39604      if (element.hasReasonCode()) {
39605        openArray("reasonCode");
39606        for (CodeableConcept e : element.getReasonCode()) 
39607          composeCodeableConcept(null, e);
39608        closeArray();
39609      };
39610      if (element.hasReasonReference()) {
39611        openArray("reasonReference");
39612        for (Reference e : element.getReasonReference()) 
39613          composeReference(null, e);
39614        closeArray();
39615      };
39616      if (element.hasDiagnosis()) {
39617        openArray("diagnosis");
39618        for (Encounter.DiagnosisComponent e : element.getDiagnosis()) 
39619          composeEncounterDiagnosisComponent(null, e);
39620        closeArray();
39621      };
39622      if (element.hasAccount()) {
39623        openArray("account");
39624        for (Reference e : element.getAccount()) 
39625          composeReference(null, e);
39626        closeArray();
39627      };
39628      if (element.hasHospitalization()) {
39629        composeEncounterEncounterHospitalizationComponent("hospitalization", element.getHospitalization());
39630      }
39631      if (element.hasLocation()) {
39632        openArray("location");
39633        for (Encounter.EncounterLocationComponent e : element.getLocation()) 
39634          composeEncounterEncounterLocationComponent(null, e);
39635        closeArray();
39636      };
39637      if (element.hasServiceProvider()) {
39638        composeReference("serviceProvider", element.getServiceProvider());
39639      }
39640      if (element.hasPartOf()) {
39641        composeReference("partOf", element.getPartOf());
39642      }
39643  }
39644
39645  protected void composeEncounterStatusHistoryComponent(String name, Encounter.StatusHistoryComponent element) throws IOException {
39646    if (element != null) {
39647      open(name);
39648      composeEncounterStatusHistoryComponentInner(element);
39649      close();
39650    }
39651  }
39652
39653  protected void composeEncounterStatusHistoryComponentInner(Encounter.StatusHistoryComponent element) throws IOException {
39654      composeBackbone(element);
39655      if (element.hasStatusElement()) {
39656        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
39657        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
39658      }
39659      if (element.hasPeriod()) {
39660        composePeriod("period", element.getPeriod());
39661      }
39662  }
39663
39664  protected void composeEncounterClassHistoryComponent(String name, Encounter.ClassHistoryComponent element) throws IOException {
39665    if (element != null) {
39666      open(name);
39667      composeEncounterClassHistoryComponentInner(element);
39668      close();
39669    }
39670  }
39671
39672  protected void composeEncounterClassHistoryComponentInner(Encounter.ClassHistoryComponent element) throws IOException {
39673      composeBackbone(element);
39674      if (element.hasClass_()) {
39675        composeCoding("class", element.getClass_());
39676      }
39677      if (element.hasPeriod()) {
39678        composePeriod("period", element.getPeriod());
39679      }
39680  }
39681
39682  protected void composeEncounterEncounterParticipantComponent(String name, Encounter.EncounterParticipantComponent element) throws IOException {
39683    if (element != null) {
39684      open(name);
39685      composeEncounterEncounterParticipantComponentInner(element);
39686      close();
39687    }
39688  }
39689
39690  protected void composeEncounterEncounterParticipantComponentInner(Encounter.EncounterParticipantComponent element) throws IOException {
39691      composeBackbone(element);
39692      if (element.hasType()) {
39693        openArray("type");
39694        for (CodeableConcept e : element.getType()) 
39695          composeCodeableConcept(null, e);
39696        closeArray();
39697      };
39698      if (element.hasPeriod()) {
39699        composePeriod("period", element.getPeriod());
39700      }
39701      if (element.hasIndividual()) {
39702        composeReference("individual", element.getIndividual());
39703      }
39704  }
39705
39706  protected void composeEncounterDiagnosisComponent(String name, Encounter.DiagnosisComponent element) throws IOException {
39707    if (element != null) {
39708      open(name);
39709      composeEncounterDiagnosisComponentInner(element);
39710      close();
39711    }
39712  }
39713
39714  protected void composeEncounterDiagnosisComponentInner(Encounter.DiagnosisComponent element) throws IOException {
39715      composeBackbone(element);
39716      if (element.hasCondition()) {
39717        composeReference("condition", element.getCondition());
39718      }
39719      if (element.hasUse()) {
39720        composeCodeableConcept("use", element.getUse());
39721      }
39722      if (element.hasRankElement()) {
39723        composePositiveIntCore("rank", element.getRankElement(), false);
39724        composePositiveIntExtras("rank", element.getRankElement(), false);
39725      }
39726  }
39727
39728  protected void composeEncounterEncounterHospitalizationComponent(String name, Encounter.EncounterHospitalizationComponent element) throws IOException {
39729    if (element != null) {
39730      open(name);
39731      composeEncounterEncounterHospitalizationComponentInner(element);
39732      close();
39733    }
39734  }
39735
39736  protected void composeEncounterEncounterHospitalizationComponentInner(Encounter.EncounterHospitalizationComponent element) throws IOException {
39737      composeBackbone(element);
39738      if (element.hasPreAdmissionIdentifier()) {
39739        composeIdentifier("preAdmissionIdentifier", element.getPreAdmissionIdentifier());
39740      }
39741      if (element.hasOrigin()) {
39742        composeReference("origin", element.getOrigin());
39743      }
39744      if (element.hasAdmitSource()) {
39745        composeCodeableConcept("admitSource", element.getAdmitSource());
39746      }
39747      if (element.hasReAdmission()) {
39748        composeCodeableConcept("reAdmission", element.getReAdmission());
39749      }
39750      if (element.hasDietPreference()) {
39751        openArray("dietPreference");
39752        for (CodeableConcept e : element.getDietPreference()) 
39753          composeCodeableConcept(null, e);
39754        closeArray();
39755      };
39756      if (element.hasSpecialCourtesy()) {
39757        openArray("specialCourtesy");
39758        for (CodeableConcept e : element.getSpecialCourtesy()) 
39759          composeCodeableConcept(null, e);
39760        closeArray();
39761      };
39762      if (element.hasSpecialArrangement()) {
39763        openArray("specialArrangement");
39764        for (CodeableConcept e : element.getSpecialArrangement()) 
39765          composeCodeableConcept(null, e);
39766        closeArray();
39767      };
39768      if (element.hasDestination()) {
39769        composeReference("destination", element.getDestination());
39770      }
39771      if (element.hasDischargeDisposition()) {
39772        composeCodeableConcept("dischargeDisposition", element.getDischargeDisposition());
39773      }
39774  }
39775
39776  protected void composeEncounterEncounterLocationComponent(String name, Encounter.EncounterLocationComponent element) throws IOException {
39777    if (element != null) {
39778      open(name);
39779      composeEncounterEncounterLocationComponentInner(element);
39780      close();
39781    }
39782  }
39783
39784  protected void composeEncounterEncounterLocationComponentInner(Encounter.EncounterLocationComponent element) throws IOException {
39785      composeBackbone(element);
39786      if (element.hasLocation()) {
39787        composeReference("location", element.getLocation());
39788      }
39789      if (element.hasStatusElement()) {
39790        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
39791        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
39792      }
39793      if (element.hasPhysicalType()) {
39794        composeCodeableConcept("physicalType", element.getPhysicalType());
39795      }
39796      if (element.hasPeriod()) {
39797        composePeriod("period", element.getPeriod());
39798      }
39799  }
39800
39801  protected void composeEndpoint(String name, Endpoint element) throws IOException {
39802    if (element != null) {
39803      prop("resourceType", name);
39804      composeEndpointInner(element);
39805    }
39806  }
39807
39808  protected void composeEndpointInner(Endpoint element) throws IOException {
39809      composeDomainResourceElements(element);
39810      if (element.hasIdentifier()) {
39811        openArray("identifier");
39812        for (Identifier e : element.getIdentifier()) 
39813          composeIdentifier(null, e);
39814        closeArray();
39815      };
39816      if (element.hasStatusElement()) {
39817        composeEnumerationCore("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
39818        composeEnumerationExtras("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
39819      }
39820      if (element.hasConnectionType()) {
39821        composeCoding("connectionType", element.getConnectionType());
39822      }
39823      if (element.hasNameElement()) {
39824        composeStringCore("name", element.getNameElement(), false);
39825        composeStringExtras("name", element.getNameElement(), false);
39826      }
39827      if (element.hasManagingOrganization()) {
39828        composeReference("managingOrganization", element.getManagingOrganization());
39829      }
39830      if (element.hasContact()) {
39831        openArray("contact");
39832        for (ContactPoint e : element.getContact()) 
39833          composeContactPoint(null, e);
39834        closeArray();
39835      };
39836      if (element.hasPeriod()) {
39837        composePeriod("period", element.getPeriod());
39838      }
39839      if (element.hasPayloadType()) {
39840        openArray("payloadType");
39841        for (CodeableConcept e : element.getPayloadType()) 
39842          composeCodeableConcept(null, e);
39843        closeArray();
39844      };
39845      if (element.hasPayloadMimeType()) {
39846        openArray("payloadMimeType");
39847        for (CodeType e : element.getPayloadMimeType()) 
39848          composeCodeCore(null, e, true);
39849        closeArray();
39850        if (anyHasExtras(element.getPayloadMimeType())) {
39851          openArray("_payloadMimeType");
39852          for (CodeType e : element.getPayloadMimeType()) 
39853            composeCodeExtras(null, e, true);
39854          closeArray();
39855        }
39856      };
39857      if (element.hasAddressElement()) {
39858        composeUrlCore("address", element.getAddressElement(), false);
39859        composeUrlExtras("address", element.getAddressElement(), false);
39860      }
39861      if (element.hasHeader()) {
39862        openArray("header");
39863        for (StringType e : element.getHeader()) 
39864          composeStringCore(null, e, true);
39865        closeArray();
39866        if (anyHasExtras(element.getHeader())) {
39867          openArray("_header");
39868          for (StringType e : element.getHeader()) 
39869            composeStringExtras(null, e, true);
39870          closeArray();
39871        }
39872      };
39873  }
39874
39875  protected void composeEnrollmentRequest(String name, EnrollmentRequest element) throws IOException {
39876    if (element != null) {
39877      prop("resourceType", name);
39878      composeEnrollmentRequestInner(element);
39879    }
39880  }
39881
39882  protected void composeEnrollmentRequestInner(EnrollmentRequest element) throws IOException {
39883      composeDomainResourceElements(element);
39884      if (element.hasIdentifier()) {
39885        openArray("identifier");
39886        for (Identifier e : element.getIdentifier()) 
39887          composeIdentifier(null, e);
39888        closeArray();
39889      };
39890      if (element.hasStatusElement()) {
39891        composeEnumerationCore("status", element.getStatusElement(), new EnrollmentRequest.EnrollmentRequestStatusEnumFactory(), false);
39892        composeEnumerationExtras("status", element.getStatusElement(), new EnrollmentRequest.EnrollmentRequestStatusEnumFactory(), false);
39893      }
39894      if (element.hasCreatedElement()) {
39895        composeDateTimeCore("created", element.getCreatedElement(), false);
39896        composeDateTimeExtras("created", element.getCreatedElement(), false);
39897      }
39898      if (element.hasInsurer()) {
39899        composeReference("insurer", element.getInsurer());
39900      }
39901      if (element.hasProvider()) {
39902        composeReference("provider", element.getProvider());
39903      }
39904      if (element.hasCandidate()) {
39905        composeReference("candidate", element.getCandidate());
39906      }
39907      if (element.hasCoverage()) {
39908        composeReference("coverage", element.getCoverage());
39909      }
39910  }
39911
39912  protected void composeEnrollmentResponse(String name, EnrollmentResponse element) throws IOException {
39913    if (element != null) {
39914      prop("resourceType", name);
39915      composeEnrollmentResponseInner(element);
39916    }
39917  }
39918
39919  protected void composeEnrollmentResponseInner(EnrollmentResponse element) throws IOException {
39920      composeDomainResourceElements(element);
39921      if (element.hasIdentifier()) {
39922        openArray("identifier");
39923        for (Identifier e : element.getIdentifier()) 
39924          composeIdentifier(null, e);
39925        closeArray();
39926      };
39927      if (element.hasStatusElement()) {
39928        composeEnumerationCore("status", element.getStatusElement(), new EnrollmentResponse.EnrollmentResponseStatusEnumFactory(), false);
39929        composeEnumerationExtras("status", element.getStatusElement(), new EnrollmentResponse.EnrollmentResponseStatusEnumFactory(), false);
39930      }
39931      if (element.hasRequest()) {
39932        composeReference("request", element.getRequest());
39933      }
39934      if (element.hasOutcomeElement()) {
39935        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
39936        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
39937      }
39938      if (element.hasDispositionElement()) {
39939        composeStringCore("disposition", element.getDispositionElement(), false);
39940        composeStringExtras("disposition", element.getDispositionElement(), false);
39941      }
39942      if (element.hasCreatedElement()) {
39943        composeDateTimeCore("created", element.getCreatedElement(), false);
39944        composeDateTimeExtras("created", element.getCreatedElement(), false);
39945      }
39946      if (element.hasOrganization()) {
39947        composeReference("organization", element.getOrganization());
39948      }
39949      if (element.hasRequestProvider()) {
39950        composeReference("requestProvider", element.getRequestProvider());
39951      }
39952  }
39953
39954  protected void composeEpisodeOfCare(String name, EpisodeOfCare element) throws IOException {
39955    if (element != null) {
39956      prop("resourceType", name);
39957      composeEpisodeOfCareInner(element);
39958    }
39959  }
39960
39961  protected void composeEpisodeOfCareInner(EpisodeOfCare element) throws IOException {
39962      composeDomainResourceElements(element);
39963      if (element.hasIdentifier()) {
39964        openArray("identifier");
39965        for (Identifier e : element.getIdentifier()) 
39966          composeIdentifier(null, e);
39967        closeArray();
39968      };
39969      if (element.hasStatusElement()) {
39970        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
39971        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
39972      }
39973      if (element.hasStatusHistory()) {
39974        openArray("statusHistory");
39975        for (EpisodeOfCare.EpisodeOfCareStatusHistoryComponent e : element.getStatusHistory()) 
39976          composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(null, e);
39977        closeArray();
39978      };
39979      if (element.hasType()) {
39980        openArray("type");
39981        for (CodeableConcept e : element.getType()) 
39982          composeCodeableConcept(null, e);
39983        closeArray();
39984      };
39985      if (element.hasDiagnosis()) {
39986        openArray("diagnosis");
39987        for (EpisodeOfCare.DiagnosisComponent e : element.getDiagnosis()) 
39988          composeEpisodeOfCareDiagnosisComponent(null, e);
39989        closeArray();
39990      };
39991      if (element.hasPatient()) {
39992        composeReference("patient", element.getPatient());
39993      }
39994      if (element.hasManagingOrganization()) {
39995        composeReference("managingOrganization", element.getManagingOrganization());
39996      }
39997      if (element.hasPeriod()) {
39998        composePeriod("period", element.getPeriod());
39999      }
40000      if (element.hasReferralRequest()) {
40001        openArray("referralRequest");
40002        for (Reference e : element.getReferralRequest()) 
40003          composeReference(null, e);
40004        closeArray();
40005      };
40006      if (element.hasCareManager()) {
40007        composeReference("careManager", element.getCareManager());
40008      }
40009      if (element.hasTeam()) {
40010        openArray("team");
40011        for (Reference e : element.getTeam()) 
40012          composeReference(null, e);
40013        closeArray();
40014      };
40015      if (element.hasAccount()) {
40016        openArray("account");
40017        for (Reference e : element.getAccount()) 
40018          composeReference(null, e);
40019        closeArray();
40020      };
40021  }
40022
40023  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(String name, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
40024    if (element != null) {
40025      open(name);
40026      composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(element);
40027      close();
40028    }
40029  }
40030
40031  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
40032      composeBackbone(element);
40033      if (element.hasStatusElement()) {
40034        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
40035        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
40036      }
40037      if (element.hasPeriod()) {
40038        composePeriod("period", element.getPeriod());
40039      }
40040  }
40041
40042  protected void composeEpisodeOfCareDiagnosisComponent(String name, EpisodeOfCare.DiagnosisComponent element) throws IOException {
40043    if (element != null) {
40044      open(name);
40045      composeEpisodeOfCareDiagnosisComponentInner(element);
40046      close();
40047    }
40048  }
40049
40050  protected void composeEpisodeOfCareDiagnosisComponentInner(EpisodeOfCare.DiagnosisComponent element) throws IOException {
40051      composeBackbone(element);
40052      if (element.hasCondition()) {
40053        composeReference("condition", element.getCondition());
40054      }
40055      if (element.hasRole()) {
40056        composeCodeableConcept("role", element.getRole());
40057      }
40058      if (element.hasRankElement()) {
40059        composePositiveIntCore("rank", element.getRankElement(), false);
40060        composePositiveIntExtras("rank", element.getRankElement(), false);
40061      }
40062  }
40063
40064  protected void composeEventDefinition(String name, EventDefinition element) throws IOException {
40065    if (element != null) {
40066      prop("resourceType", name);
40067      composeEventDefinitionInner(element);
40068    }
40069  }
40070
40071  protected void composeEventDefinitionInner(EventDefinition element) throws IOException {
40072      composeDomainResourceElements(element);
40073      if (element.hasUrlElement()) {
40074        composeUriCore("url", element.getUrlElement(), false);
40075        composeUriExtras("url", element.getUrlElement(), false);
40076      }
40077      if (element.hasIdentifier()) {
40078        openArray("identifier");
40079        for (Identifier e : element.getIdentifier()) 
40080          composeIdentifier(null, e);
40081        closeArray();
40082      };
40083      if (element.hasVersionElement()) {
40084        composeStringCore("version", element.getVersionElement(), false);
40085        composeStringExtras("version", element.getVersionElement(), false);
40086      }
40087      if (element.hasNameElement()) {
40088        composeStringCore("name", element.getNameElement(), false);
40089        composeStringExtras("name", element.getNameElement(), false);
40090      }
40091      if (element.hasTitleElement()) {
40092        composeStringCore("title", element.getTitleElement(), false);
40093        composeStringExtras("title", element.getTitleElement(), false);
40094      }
40095      if (element.hasSubtitleElement()) {
40096        composeStringCore("subtitle", element.getSubtitleElement(), false);
40097        composeStringExtras("subtitle", element.getSubtitleElement(), false);
40098      }
40099      if (element.hasStatusElement()) {
40100        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40101        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40102      }
40103      if (element.hasExperimentalElement()) {
40104        composeBooleanCore("experimental", element.getExperimentalElement(), false);
40105        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
40106      }
40107      if (element.hasSubject()) {
40108        composeType("subject", element.getSubject());
40109      }
40110      if (element.hasDateElement()) {
40111        composeDateTimeCore("date", element.getDateElement(), false);
40112        composeDateTimeExtras("date", element.getDateElement(), false);
40113      }
40114      if (element.hasPublisherElement()) {
40115        composeStringCore("publisher", element.getPublisherElement(), false);
40116        composeStringExtras("publisher", element.getPublisherElement(), false);
40117      }
40118      if (element.hasContact()) {
40119        openArray("contact");
40120        for (ContactDetail e : element.getContact()) 
40121          composeContactDetail(null, e);
40122        closeArray();
40123      };
40124      if (element.hasDescriptionElement()) {
40125        composeMarkdownCore("description", element.getDescriptionElement(), false);
40126        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40127      }
40128      if (element.hasUseContext()) {
40129        openArray("useContext");
40130        for (UsageContext e : element.getUseContext()) 
40131          composeUsageContext(null, e);
40132        closeArray();
40133      };
40134      if (element.hasJurisdiction()) {
40135        openArray("jurisdiction");
40136        for (CodeableConcept e : element.getJurisdiction()) 
40137          composeCodeableConcept(null, e);
40138        closeArray();
40139      };
40140      if (element.hasPurposeElement()) {
40141        composeMarkdownCore("purpose", element.getPurposeElement(), false);
40142        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
40143      }
40144      if (element.hasUsageElement()) {
40145        composeStringCore("usage", element.getUsageElement(), false);
40146        composeStringExtras("usage", element.getUsageElement(), false);
40147      }
40148      if (element.hasCopyrightElement()) {
40149        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
40150        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
40151      }
40152      if (element.hasApprovalDateElement()) {
40153        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
40154        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
40155      }
40156      if (element.hasLastReviewDateElement()) {
40157        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
40158        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
40159      }
40160      if (element.hasEffectivePeriod()) {
40161        composePeriod("effectivePeriod", element.getEffectivePeriod());
40162      }
40163      if (element.hasTopic()) {
40164        openArray("topic");
40165        for (CodeableConcept e : element.getTopic()) 
40166          composeCodeableConcept(null, e);
40167        closeArray();
40168      };
40169      if (element.hasAuthor()) {
40170        openArray("author");
40171        for (ContactDetail e : element.getAuthor()) 
40172          composeContactDetail(null, e);
40173        closeArray();
40174      };
40175      if (element.hasEditor()) {
40176        openArray("editor");
40177        for (ContactDetail e : element.getEditor()) 
40178          composeContactDetail(null, e);
40179        closeArray();
40180      };
40181      if (element.hasReviewer()) {
40182        openArray("reviewer");
40183        for (ContactDetail e : element.getReviewer()) 
40184          composeContactDetail(null, e);
40185        closeArray();
40186      };
40187      if (element.hasEndorser()) {
40188        openArray("endorser");
40189        for (ContactDetail e : element.getEndorser()) 
40190          composeContactDetail(null, e);
40191        closeArray();
40192      };
40193      if (element.hasRelatedArtifact()) {
40194        openArray("relatedArtifact");
40195        for (RelatedArtifact e : element.getRelatedArtifact()) 
40196          composeRelatedArtifact(null, e);
40197        closeArray();
40198      };
40199      if (element.hasTrigger()) {
40200        openArray("trigger");
40201        for (TriggerDefinition e : element.getTrigger()) 
40202          composeTriggerDefinition(null, e);
40203        closeArray();
40204      };
40205  }
40206
40207  protected void composeEvidence(String name, Evidence element) throws IOException {
40208    if (element != null) {
40209      prop("resourceType", name);
40210      composeEvidenceInner(element);
40211    }
40212  }
40213
40214  protected void composeEvidenceInner(Evidence element) throws IOException {
40215      composeDomainResourceElements(element);
40216      if (element.hasUrlElement()) {
40217        composeUriCore("url", element.getUrlElement(), false);
40218        composeUriExtras("url", element.getUrlElement(), false);
40219      }
40220      if (element.hasIdentifier()) {
40221        openArray("identifier");
40222        for (Identifier e : element.getIdentifier()) 
40223          composeIdentifier(null, e);
40224        closeArray();
40225      };
40226      if (element.hasVersionElement()) {
40227        composeStringCore("version", element.getVersionElement(), false);
40228        composeStringExtras("version", element.getVersionElement(), false);
40229      }
40230      if (element.hasNameElement()) {
40231        composeStringCore("name", element.getNameElement(), false);
40232        composeStringExtras("name", element.getNameElement(), false);
40233      }
40234      if (element.hasTitleElement()) {
40235        composeStringCore("title", element.getTitleElement(), false);
40236        composeStringExtras("title", element.getTitleElement(), false);
40237      }
40238      if (element.hasShortTitleElement()) {
40239        composeStringCore("shortTitle", element.getShortTitleElement(), false);
40240        composeStringExtras("shortTitle", element.getShortTitleElement(), false);
40241      }
40242      if (element.hasSubtitleElement()) {
40243        composeStringCore("subtitle", element.getSubtitleElement(), false);
40244        composeStringExtras("subtitle", element.getSubtitleElement(), false);
40245      }
40246      if (element.hasStatusElement()) {
40247        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40248        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40249      }
40250      if (element.hasDateElement()) {
40251        composeDateTimeCore("date", element.getDateElement(), false);
40252        composeDateTimeExtras("date", element.getDateElement(), false);
40253      }
40254      if (element.hasPublisherElement()) {
40255        composeStringCore("publisher", element.getPublisherElement(), false);
40256        composeStringExtras("publisher", element.getPublisherElement(), false);
40257      }
40258      if (element.hasContact()) {
40259        openArray("contact");
40260        for (ContactDetail e : element.getContact()) 
40261          composeContactDetail(null, e);
40262        closeArray();
40263      };
40264      if (element.hasDescriptionElement()) {
40265        composeMarkdownCore("description", element.getDescriptionElement(), false);
40266        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40267      }
40268      if (element.hasNote()) {
40269        openArray("note");
40270        for (Annotation e : element.getNote()) 
40271          composeAnnotation(null, e);
40272        closeArray();
40273      };
40274      if (element.hasUseContext()) {
40275        openArray("useContext");
40276        for (UsageContext e : element.getUseContext()) 
40277          composeUsageContext(null, e);
40278        closeArray();
40279      };
40280      if (element.hasJurisdiction()) {
40281        openArray("jurisdiction");
40282        for (CodeableConcept e : element.getJurisdiction()) 
40283          composeCodeableConcept(null, e);
40284        closeArray();
40285      };
40286      if (element.hasCopyrightElement()) {
40287        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
40288        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
40289      }
40290      if (element.hasApprovalDateElement()) {
40291        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
40292        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
40293      }
40294      if (element.hasLastReviewDateElement()) {
40295        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
40296        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
40297      }
40298      if (element.hasEffectivePeriod()) {
40299        composePeriod("effectivePeriod", element.getEffectivePeriod());
40300      }
40301      if (element.hasTopic()) {
40302        openArray("topic");
40303        for (CodeableConcept e : element.getTopic()) 
40304          composeCodeableConcept(null, e);
40305        closeArray();
40306      };
40307      if (element.hasAuthor()) {
40308        openArray("author");
40309        for (ContactDetail e : element.getAuthor()) 
40310          composeContactDetail(null, e);
40311        closeArray();
40312      };
40313      if (element.hasEditor()) {
40314        openArray("editor");
40315        for (ContactDetail e : element.getEditor()) 
40316          composeContactDetail(null, e);
40317        closeArray();
40318      };
40319      if (element.hasReviewer()) {
40320        openArray("reviewer");
40321        for (ContactDetail e : element.getReviewer()) 
40322          composeContactDetail(null, e);
40323        closeArray();
40324      };
40325      if (element.hasEndorser()) {
40326        openArray("endorser");
40327        for (ContactDetail e : element.getEndorser()) 
40328          composeContactDetail(null, e);
40329        closeArray();
40330      };
40331      if (element.hasRelatedArtifact()) {
40332        openArray("relatedArtifact");
40333        for (RelatedArtifact e : element.getRelatedArtifact()) 
40334          composeRelatedArtifact(null, e);
40335        closeArray();
40336      };
40337      if (element.hasExposureBackground()) {
40338        composeReference("exposureBackground", element.getExposureBackground());
40339      }
40340      if (element.hasExposureVariant()) {
40341        openArray("exposureVariant");
40342        for (Reference e : element.getExposureVariant()) 
40343          composeReference(null, e);
40344        closeArray();
40345      };
40346      if (element.hasOutcome()) {
40347        openArray("outcome");
40348        for (Reference e : element.getOutcome()) 
40349          composeReference(null, e);
40350        closeArray();
40351      };
40352  }
40353
40354  protected void composeEvidenceVariable(String name, EvidenceVariable element) throws IOException {
40355    if (element != null) {
40356      prop("resourceType", name);
40357      composeEvidenceVariableInner(element);
40358    }
40359  }
40360
40361  protected void composeEvidenceVariableInner(EvidenceVariable element) throws IOException {
40362      composeDomainResourceElements(element);
40363      if (element.hasUrlElement()) {
40364        composeUriCore("url", element.getUrlElement(), false);
40365        composeUriExtras("url", element.getUrlElement(), false);
40366      }
40367      if (element.hasIdentifier()) {
40368        openArray("identifier");
40369        for (Identifier e : element.getIdentifier()) 
40370          composeIdentifier(null, e);
40371        closeArray();
40372      };
40373      if (element.hasVersionElement()) {
40374        composeStringCore("version", element.getVersionElement(), false);
40375        composeStringExtras("version", element.getVersionElement(), false);
40376      }
40377      if (element.hasNameElement()) {
40378        composeStringCore("name", element.getNameElement(), false);
40379        composeStringExtras("name", element.getNameElement(), false);
40380      }
40381      if (element.hasTitleElement()) {
40382        composeStringCore("title", element.getTitleElement(), false);
40383        composeStringExtras("title", element.getTitleElement(), false);
40384      }
40385      if (element.hasShortTitleElement()) {
40386        composeStringCore("shortTitle", element.getShortTitleElement(), false);
40387        composeStringExtras("shortTitle", element.getShortTitleElement(), false);
40388      }
40389      if (element.hasSubtitleElement()) {
40390        composeStringCore("subtitle", element.getSubtitleElement(), false);
40391        composeStringExtras("subtitle", element.getSubtitleElement(), false);
40392      }
40393      if (element.hasStatusElement()) {
40394        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40395        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40396      }
40397      if (element.hasDateElement()) {
40398        composeDateTimeCore("date", element.getDateElement(), false);
40399        composeDateTimeExtras("date", element.getDateElement(), false);
40400      }
40401      if (element.hasPublisherElement()) {
40402        composeStringCore("publisher", element.getPublisherElement(), false);
40403        composeStringExtras("publisher", element.getPublisherElement(), false);
40404      }
40405      if (element.hasContact()) {
40406        openArray("contact");
40407        for (ContactDetail e : element.getContact()) 
40408          composeContactDetail(null, e);
40409        closeArray();
40410      };
40411      if (element.hasDescriptionElement()) {
40412        composeMarkdownCore("description", element.getDescriptionElement(), false);
40413        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40414      }
40415      if (element.hasNote()) {
40416        openArray("note");
40417        for (Annotation e : element.getNote()) 
40418          composeAnnotation(null, e);
40419        closeArray();
40420      };
40421      if (element.hasUseContext()) {
40422        openArray("useContext");
40423        for (UsageContext e : element.getUseContext()) 
40424          composeUsageContext(null, e);
40425        closeArray();
40426      };
40427      if (element.hasJurisdiction()) {
40428        openArray("jurisdiction");
40429        for (CodeableConcept e : element.getJurisdiction()) 
40430          composeCodeableConcept(null, e);
40431        closeArray();
40432      };
40433      if (element.hasCopyrightElement()) {
40434        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
40435        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
40436      }
40437      if (element.hasApprovalDateElement()) {
40438        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
40439        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
40440      }
40441      if (element.hasLastReviewDateElement()) {
40442        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
40443        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
40444      }
40445      if (element.hasEffectivePeriod()) {
40446        composePeriod("effectivePeriod", element.getEffectivePeriod());
40447      }
40448      if (element.hasTopic()) {
40449        openArray("topic");
40450        for (CodeableConcept e : element.getTopic()) 
40451          composeCodeableConcept(null, e);
40452        closeArray();
40453      };
40454      if (element.hasAuthor()) {
40455        openArray("author");
40456        for (ContactDetail e : element.getAuthor()) 
40457          composeContactDetail(null, e);
40458        closeArray();
40459      };
40460      if (element.hasEditor()) {
40461        openArray("editor");
40462        for (ContactDetail e : element.getEditor()) 
40463          composeContactDetail(null, e);
40464        closeArray();
40465      };
40466      if (element.hasReviewer()) {
40467        openArray("reviewer");
40468        for (ContactDetail e : element.getReviewer()) 
40469          composeContactDetail(null, e);
40470        closeArray();
40471      };
40472      if (element.hasEndorser()) {
40473        openArray("endorser");
40474        for (ContactDetail e : element.getEndorser()) 
40475          composeContactDetail(null, e);
40476        closeArray();
40477      };
40478      if (element.hasRelatedArtifact()) {
40479        openArray("relatedArtifact");
40480        for (RelatedArtifact e : element.getRelatedArtifact()) 
40481          composeRelatedArtifact(null, e);
40482        closeArray();
40483      };
40484      if (element.hasTypeElement()) {
40485        composeEnumerationCore("type", element.getTypeElement(), new EvidenceVariable.EvidenceVariableTypeEnumFactory(), false);
40486        composeEnumerationExtras("type", element.getTypeElement(), new EvidenceVariable.EvidenceVariableTypeEnumFactory(), false);
40487      }
40488      if (element.hasCharacteristic()) {
40489        openArray("characteristic");
40490        for (EvidenceVariable.EvidenceVariableCharacteristicComponent e : element.getCharacteristic()) 
40491          composeEvidenceVariableEvidenceVariableCharacteristicComponent(null, e);
40492        closeArray();
40493      };
40494  }
40495
40496  protected void composeEvidenceVariableEvidenceVariableCharacteristicComponent(String name, EvidenceVariable.EvidenceVariableCharacteristicComponent element) throws IOException {
40497    if (element != null) {
40498      open(name);
40499      composeEvidenceVariableEvidenceVariableCharacteristicComponentInner(element);
40500      close();
40501    }
40502  }
40503
40504  protected void composeEvidenceVariableEvidenceVariableCharacteristicComponentInner(EvidenceVariable.EvidenceVariableCharacteristicComponent element) throws IOException {
40505      composeBackbone(element);
40506      if (element.hasDescriptionElement()) {
40507        composeStringCore("description", element.getDescriptionElement(), false);
40508        composeStringExtras("description", element.getDescriptionElement(), false);
40509      }
40510      if (element.hasDefinition()) {
40511        composeType("definition", element.getDefinition());
40512      }
40513      if (element.hasUsageContext()) {
40514        openArray("usageContext");
40515        for (UsageContext e : element.getUsageContext()) 
40516          composeUsageContext(null, e);
40517        closeArray();
40518      };
40519      if (element.hasExcludeElement()) {
40520        composeBooleanCore("exclude", element.getExcludeElement(), false);
40521        composeBooleanExtras("exclude", element.getExcludeElement(), false);
40522      }
40523      if (element.hasParticipantEffective()) {
40524        composeType("participantEffective", element.getParticipantEffective());
40525      }
40526      if (element.hasTimeFromStart()) {
40527        composeDuration("timeFromStart", element.getTimeFromStart());
40528      }
40529      if (element.hasGroupMeasureElement()) {
40530        composeEnumerationCore("groupMeasure", element.getGroupMeasureElement(), new EvidenceVariable.GroupMeasureEnumFactory(), false);
40531        composeEnumerationExtras("groupMeasure", element.getGroupMeasureElement(), new EvidenceVariable.GroupMeasureEnumFactory(), false);
40532      }
40533  }
40534
40535  protected void composeExampleScenario(String name, ExampleScenario element) throws IOException {
40536    if (element != null) {
40537      prop("resourceType", name);
40538      composeExampleScenarioInner(element);
40539    }
40540  }
40541
40542  protected void composeExampleScenarioInner(ExampleScenario element) throws IOException {
40543      composeDomainResourceElements(element);
40544      if (element.hasUrlElement()) {
40545        composeUriCore("url", element.getUrlElement(), false);
40546        composeUriExtras("url", element.getUrlElement(), false);
40547      }
40548      if (element.hasIdentifier()) {
40549        openArray("identifier");
40550        for (Identifier e : element.getIdentifier()) 
40551          composeIdentifier(null, e);
40552        closeArray();
40553      };
40554      if (element.hasVersionElement()) {
40555        composeStringCore("version", element.getVersionElement(), false);
40556        composeStringExtras("version", element.getVersionElement(), false);
40557      }
40558      if (element.hasNameElement()) {
40559        composeStringCore("name", element.getNameElement(), false);
40560        composeStringExtras("name", element.getNameElement(), false);
40561      }
40562      if (element.hasStatusElement()) {
40563        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40564        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40565      }
40566      if (element.hasExperimentalElement()) {
40567        composeBooleanCore("experimental", element.getExperimentalElement(), false);
40568        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
40569      }
40570      if (element.hasDateElement()) {
40571        composeDateTimeCore("date", element.getDateElement(), false);
40572        composeDateTimeExtras("date", element.getDateElement(), false);
40573      }
40574      if (element.hasPublisherElement()) {
40575        composeStringCore("publisher", element.getPublisherElement(), false);
40576        composeStringExtras("publisher", element.getPublisherElement(), false);
40577      }
40578      if (element.hasContact()) {
40579        openArray("contact");
40580        for (ContactDetail e : element.getContact()) 
40581          composeContactDetail(null, e);
40582        closeArray();
40583      };
40584      if (element.hasUseContext()) {
40585        openArray("useContext");
40586        for (UsageContext e : element.getUseContext()) 
40587          composeUsageContext(null, e);
40588        closeArray();
40589      };
40590      if (element.hasJurisdiction()) {
40591        openArray("jurisdiction");
40592        for (CodeableConcept e : element.getJurisdiction()) 
40593          composeCodeableConcept(null, e);
40594        closeArray();
40595      };
40596      if (element.hasCopyrightElement()) {
40597        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
40598        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
40599      }
40600      if (element.hasPurposeElement()) {
40601        composeMarkdownCore("purpose", element.getPurposeElement(), false);
40602        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
40603      }
40604      if (element.hasActor()) {
40605        openArray("actor");
40606        for (ExampleScenario.ExampleScenarioActorComponent e : element.getActor()) 
40607          composeExampleScenarioExampleScenarioActorComponent(null, e);
40608        closeArray();
40609      };
40610      if (element.hasInstance()) {
40611        openArray("instance");
40612        for (ExampleScenario.ExampleScenarioInstanceComponent e : element.getInstance()) 
40613          composeExampleScenarioExampleScenarioInstanceComponent(null, e);
40614        closeArray();
40615      };
40616      if (element.hasProcess()) {
40617        openArray("process");
40618        for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess()) 
40619          composeExampleScenarioExampleScenarioProcessComponent(null, e);
40620        closeArray();
40621      };
40622      if (element.hasWorkflow()) {
40623        openArray("workflow");
40624        for (CanonicalType e : element.getWorkflow()) 
40625          composeCanonicalCore(null, e, true);
40626        closeArray();
40627        if (anyHasExtras(element.getWorkflow())) {
40628          openArray("_workflow");
40629          for (CanonicalType e : element.getWorkflow()) 
40630            composeCanonicalExtras(null, e, true);
40631          closeArray();
40632        }
40633      };
40634  }
40635
40636  protected void composeExampleScenarioExampleScenarioActorComponent(String name, ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
40637    if (element != null) {
40638      open(name);
40639      composeExampleScenarioExampleScenarioActorComponentInner(element);
40640      close();
40641    }
40642  }
40643
40644  protected void composeExampleScenarioExampleScenarioActorComponentInner(ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
40645      composeBackbone(element);
40646      if (element.hasActorIdElement()) {
40647        composeStringCore("actorId", element.getActorIdElement(), false);
40648        composeStringExtras("actorId", element.getActorIdElement(), false);
40649      }
40650      if (element.hasTypeElement()) {
40651        composeEnumerationCore("type", element.getTypeElement(), new ExampleScenario.ExampleScenarioActorTypeEnumFactory(), false);
40652        composeEnumerationExtras("type", element.getTypeElement(), new ExampleScenario.ExampleScenarioActorTypeEnumFactory(), false);
40653      }
40654      if (element.hasNameElement()) {
40655        composeStringCore("name", element.getNameElement(), false);
40656        composeStringExtras("name", element.getNameElement(), false);
40657      }
40658      if (element.hasDescriptionElement()) {
40659        composeMarkdownCore("description", element.getDescriptionElement(), false);
40660        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40661      }
40662  }
40663
40664  protected void composeExampleScenarioExampleScenarioInstanceComponent(String name, ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
40665    if (element != null) {
40666      open(name);
40667      composeExampleScenarioExampleScenarioInstanceComponentInner(element);
40668      close();
40669    }
40670  }
40671
40672  protected void composeExampleScenarioExampleScenarioInstanceComponentInner(ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
40673      composeBackbone(element);
40674      if (element.hasResourceIdElement()) {
40675        composeStringCore("resourceId", element.getResourceIdElement(), false);
40676        composeStringExtras("resourceId", element.getResourceIdElement(), false);
40677      }
40678      if (element.hasResourceTypeElement()) {
40679        composeEnumerationCore("resourceType", element.getResourceTypeElement(), new ExampleScenario.FHIRResourceTypeEnumFactory(), false);
40680        composeEnumerationExtras("resourceType", element.getResourceTypeElement(), new ExampleScenario.FHIRResourceTypeEnumFactory(), false);
40681      }
40682      if (element.hasNameElement()) {
40683        composeStringCore("name", element.getNameElement(), false);
40684        composeStringExtras("name", element.getNameElement(), false);
40685      }
40686      if (element.hasDescriptionElement()) {
40687        composeMarkdownCore("description", element.getDescriptionElement(), false);
40688        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40689      }
40690      if (element.hasVersion()) {
40691        openArray("version");
40692        for (ExampleScenario.ExampleScenarioInstanceVersionComponent e : element.getVersion()) 
40693          composeExampleScenarioExampleScenarioInstanceVersionComponent(null, e);
40694        closeArray();
40695      };
40696      if (element.hasContainedInstance()) {
40697        openArray("containedInstance");
40698        for (ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent e : element.getContainedInstance()) 
40699          composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent(null, e);
40700        closeArray();
40701      };
40702  }
40703
40704  protected void composeExampleScenarioExampleScenarioInstanceVersionComponent(String name, ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
40705    if (element != null) {
40706      open(name);
40707      composeExampleScenarioExampleScenarioInstanceVersionComponentInner(element);
40708      close();
40709    }
40710  }
40711
40712  protected void composeExampleScenarioExampleScenarioInstanceVersionComponentInner(ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
40713      composeBackbone(element);
40714      if (element.hasVersionIdElement()) {
40715        composeStringCore("versionId", element.getVersionIdElement(), false);
40716        composeStringExtras("versionId", element.getVersionIdElement(), false);
40717      }
40718      if (element.hasDescriptionElement()) {
40719        composeMarkdownCore("description", element.getDescriptionElement(), false);
40720        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40721      }
40722  }
40723
40724  protected void composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent(String name, ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
40725    if (element != null) {
40726      open(name);
40727      composeExampleScenarioExampleScenarioInstanceContainedInstanceComponentInner(element);
40728      close();
40729    }
40730  }
40731
40732  protected void composeExampleScenarioExampleScenarioInstanceContainedInstanceComponentInner(ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
40733      composeBackbone(element);
40734      if (element.hasResourceIdElement()) {
40735        composeStringCore("resourceId", element.getResourceIdElement(), false);
40736        composeStringExtras("resourceId", element.getResourceIdElement(), false);
40737      }
40738      if (element.hasVersionIdElement()) {
40739        composeStringCore("versionId", element.getVersionIdElement(), false);
40740        composeStringExtras("versionId", element.getVersionIdElement(), false);
40741      }
40742  }
40743
40744  protected void composeExampleScenarioExampleScenarioProcessComponent(String name, ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
40745    if (element != null) {
40746      open(name);
40747      composeExampleScenarioExampleScenarioProcessComponentInner(element);
40748      close();
40749    }
40750  }
40751
40752  protected void composeExampleScenarioExampleScenarioProcessComponentInner(ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
40753      composeBackbone(element);
40754      if (element.hasTitleElement()) {
40755        composeStringCore("title", element.getTitleElement(), false);
40756        composeStringExtras("title", element.getTitleElement(), false);
40757      }
40758      if (element.hasDescriptionElement()) {
40759        composeMarkdownCore("description", element.getDescriptionElement(), false);
40760        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40761      }
40762      if (element.hasPreConditionsElement()) {
40763        composeMarkdownCore("preConditions", element.getPreConditionsElement(), false);
40764        composeMarkdownExtras("preConditions", element.getPreConditionsElement(), false);
40765      }
40766      if (element.hasPostConditionsElement()) {
40767        composeMarkdownCore("postConditions", element.getPostConditionsElement(), false);
40768        composeMarkdownExtras("postConditions", element.getPostConditionsElement(), false);
40769      }
40770      if (element.hasStep()) {
40771        openArray("step");
40772        for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep()) 
40773          composeExampleScenarioExampleScenarioProcessStepComponent(null, e);
40774        closeArray();
40775      };
40776  }
40777
40778  protected void composeExampleScenarioExampleScenarioProcessStepComponent(String name, ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
40779    if (element != null) {
40780      open(name);
40781      composeExampleScenarioExampleScenarioProcessStepComponentInner(element);
40782      close();
40783    }
40784  }
40785
40786  protected void composeExampleScenarioExampleScenarioProcessStepComponentInner(ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
40787      composeBackbone(element);
40788      if (element.hasProcess()) {
40789        openArray("process");
40790        for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess()) 
40791          composeExampleScenarioExampleScenarioProcessComponent(null, e);
40792        closeArray();
40793      };
40794      if (element.hasPauseElement()) {
40795        composeBooleanCore("pause", element.getPauseElement(), false);
40796        composeBooleanExtras("pause", element.getPauseElement(), false);
40797      }
40798      if (element.hasOperation()) {
40799        composeExampleScenarioExampleScenarioProcessStepOperationComponent("operation", element.getOperation());
40800      }
40801      if (element.hasAlternative()) {
40802        openArray("alternative");
40803        for (ExampleScenario.ExampleScenarioProcessStepAlternativeComponent e : element.getAlternative()) 
40804          composeExampleScenarioExampleScenarioProcessStepAlternativeComponent(null, e);
40805        closeArray();
40806      };
40807  }
40808
40809  protected void composeExampleScenarioExampleScenarioProcessStepOperationComponent(String name, ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
40810    if (element != null) {
40811      open(name);
40812      composeExampleScenarioExampleScenarioProcessStepOperationComponentInner(element);
40813      close();
40814    }
40815  }
40816
40817  protected void composeExampleScenarioExampleScenarioProcessStepOperationComponentInner(ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
40818      composeBackbone(element);
40819      if (element.hasNumberElement()) {
40820        composeStringCore("number", element.getNumberElement(), false);
40821        composeStringExtras("number", element.getNumberElement(), false);
40822      }
40823      if (element.hasTypeElement()) {
40824        composeStringCore("type", element.getTypeElement(), false);
40825        composeStringExtras("type", element.getTypeElement(), false);
40826      }
40827      if (element.hasNameElement()) {
40828        composeStringCore("name", element.getNameElement(), false);
40829        composeStringExtras("name", element.getNameElement(), false);
40830      }
40831      if (element.hasInitiatorElement()) {
40832        composeStringCore("initiator", element.getInitiatorElement(), false);
40833        composeStringExtras("initiator", element.getInitiatorElement(), false);
40834      }
40835      if (element.hasReceiverElement()) {
40836        composeStringCore("receiver", element.getReceiverElement(), false);
40837        composeStringExtras("receiver", element.getReceiverElement(), false);
40838      }
40839      if (element.hasDescriptionElement()) {
40840        composeMarkdownCore("description", element.getDescriptionElement(), false);
40841        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40842      }
40843      if (element.hasInitiatorActiveElement()) {
40844        composeBooleanCore("initiatorActive", element.getInitiatorActiveElement(), false);
40845        composeBooleanExtras("initiatorActive", element.getInitiatorActiveElement(), false);
40846      }
40847      if (element.hasReceiverActiveElement()) {
40848        composeBooleanCore("receiverActive", element.getReceiverActiveElement(), false);
40849        composeBooleanExtras("receiverActive", element.getReceiverActiveElement(), false);
40850      }
40851      if (element.hasRequest()) {
40852        composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent("request", element.getRequest());
40853      }
40854      if (element.hasResponse()) {
40855        composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent("response", element.getResponse());
40856      }
40857  }
40858
40859  protected void composeExampleScenarioExampleScenarioProcessStepAlternativeComponent(String name, ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
40860    if (element != null) {
40861      open(name);
40862      composeExampleScenarioExampleScenarioProcessStepAlternativeComponentInner(element);
40863      close();
40864    }
40865  }
40866
40867  protected void composeExampleScenarioExampleScenarioProcessStepAlternativeComponentInner(ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
40868      composeBackbone(element);
40869      if (element.hasTitleElement()) {
40870        composeStringCore("title", element.getTitleElement(), false);
40871        composeStringExtras("title", element.getTitleElement(), false);
40872      }
40873      if (element.hasDescriptionElement()) {
40874        composeMarkdownCore("description", element.getDescriptionElement(), false);
40875        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40876      }
40877      if (element.hasStep()) {
40878        openArray("step");
40879        for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep()) 
40880          composeExampleScenarioExampleScenarioProcessStepComponent(null, e);
40881        closeArray();
40882      };
40883  }
40884
40885  protected void composeExplanationOfBenefit(String name, ExplanationOfBenefit element) throws IOException {
40886    if (element != null) {
40887      prop("resourceType", name);
40888      composeExplanationOfBenefitInner(element);
40889    }
40890  }
40891
40892  protected void composeExplanationOfBenefitInner(ExplanationOfBenefit element) throws IOException {
40893      composeDomainResourceElements(element);
40894      if (element.hasIdentifier()) {
40895        openArray("identifier");
40896        for (Identifier e : element.getIdentifier()) 
40897          composeIdentifier(null, e);
40898        closeArray();
40899      };
40900      if (element.hasStatusElement()) {
40901        composeEnumerationCore("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
40902        composeEnumerationExtras("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
40903      }
40904      if (element.hasType()) {
40905        composeCodeableConcept("type", element.getType());
40906      }
40907      if (element.hasSubType()) {
40908        composeCodeableConcept("subType", element.getSubType());
40909      }
40910      if (element.hasUseElement()) {
40911        composeEnumerationCore("use", element.getUseElement(), new ExplanationOfBenefit.UseEnumFactory(), false);
40912        composeEnumerationExtras("use", element.getUseElement(), new ExplanationOfBenefit.UseEnumFactory(), false);
40913      }
40914      if (element.hasPatient()) {
40915        composeReference("patient", element.getPatient());
40916      }
40917      if (element.hasBillablePeriod()) {
40918        composePeriod("billablePeriod", element.getBillablePeriod());
40919      }
40920      if (element.hasCreatedElement()) {
40921        composeDateTimeCore("created", element.getCreatedElement(), false);
40922        composeDateTimeExtras("created", element.getCreatedElement(), false);
40923      }
40924      if (element.hasEnterer()) {
40925        composeReference("enterer", element.getEnterer());
40926      }
40927      if (element.hasInsurer()) {
40928        composeReference("insurer", element.getInsurer());
40929      }
40930      if (element.hasProvider()) {
40931        composeReference("provider", element.getProvider());
40932      }
40933      if (element.hasPriority()) {
40934        composeCodeableConcept("priority", element.getPriority());
40935      }
40936      if (element.hasFundsReserveRequested()) {
40937        composeCodeableConcept("fundsReserveRequested", element.getFundsReserveRequested());
40938      }
40939      if (element.hasFundsReserve()) {
40940        composeCodeableConcept("fundsReserve", element.getFundsReserve());
40941      }
40942      if (element.hasRelated()) {
40943        openArray("related");
40944        for (ExplanationOfBenefit.RelatedClaimComponent e : element.getRelated()) 
40945          composeExplanationOfBenefitRelatedClaimComponent(null, e);
40946        closeArray();
40947      };
40948      if (element.hasPrescription()) {
40949        composeReference("prescription", element.getPrescription());
40950      }
40951      if (element.hasOriginalPrescription()) {
40952        composeReference("originalPrescription", element.getOriginalPrescription());
40953      }
40954      if (element.hasPayee()) {
40955        composeExplanationOfBenefitPayeeComponent("payee", element.getPayee());
40956      }
40957      if (element.hasReferral()) {
40958        composeReference("referral", element.getReferral());
40959      }
40960      if (element.hasFacility()) {
40961        composeReference("facility", element.getFacility());
40962      }
40963      if (element.hasClaim()) {
40964        composeReference("claim", element.getClaim());
40965      }
40966      if (element.hasClaimResponse()) {
40967        composeReference("claimResponse", element.getClaimResponse());
40968      }
40969      if (element.hasOutcomeElement()) {
40970        composeEnumerationCore("outcome", element.getOutcomeElement(), new ExplanationOfBenefit.RemittanceOutcomeEnumFactory(), false);
40971        composeEnumerationExtras("outcome", element.getOutcomeElement(), new ExplanationOfBenefit.RemittanceOutcomeEnumFactory(), false);
40972      }
40973      if (element.hasDispositionElement()) {
40974        composeStringCore("disposition", element.getDispositionElement(), false);
40975        composeStringExtras("disposition", element.getDispositionElement(), false);
40976      }
40977      if (element.hasPreAuthRef()) {
40978        openArray("preAuthRef");
40979        for (StringType e : element.getPreAuthRef()) 
40980          composeStringCore(null, e, true);
40981        closeArray();
40982        if (anyHasExtras(element.getPreAuthRef())) {
40983          openArray("_preAuthRef");
40984          for (StringType e : element.getPreAuthRef()) 
40985            composeStringExtras(null, e, true);
40986        closeArray();
40987        }
40988      };
40989      if (element.hasPreAuthRefPeriod()) {
40990        openArray("preAuthRefPeriod");
40991        for (Period e : element.getPreAuthRefPeriod()) 
40992          composePeriod(null, e);
40993        closeArray();
40994      };
40995      if (element.hasCareTeam()) {
40996        openArray("careTeam");
40997        for (ExplanationOfBenefit.CareTeamComponent e : element.getCareTeam()) 
40998          composeExplanationOfBenefitCareTeamComponent(null, e);
40999        closeArray();
41000      };
41001      if (element.hasSupportingInfo()) {
41002        openArray("supportingInfo");
41003        for (ExplanationOfBenefit.SupportingInformationComponent e : element.getSupportingInfo()) 
41004          composeExplanationOfBenefitSupportingInformationComponent(null, e);
41005        closeArray();
41006      };
41007      if (element.hasDiagnosis()) {
41008        openArray("diagnosis");
41009        for (ExplanationOfBenefit.DiagnosisComponent e : element.getDiagnosis()) 
41010          composeExplanationOfBenefitDiagnosisComponent(null, e);
41011        closeArray();
41012      };
41013      if (element.hasProcedure()) {
41014        openArray("procedure");
41015        for (ExplanationOfBenefit.ProcedureComponent e : element.getProcedure()) 
41016          composeExplanationOfBenefitProcedureComponent(null, e);
41017        closeArray();
41018      };
41019      if (element.hasPrecedenceElement()) {
41020        composePositiveIntCore("precedence", element.getPrecedenceElement(), false);
41021        composePositiveIntExtras("precedence", element.getPrecedenceElement(), false);
41022      }
41023      if (element.hasInsurance()) {
41024        openArray("insurance");
41025        for (ExplanationOfBenefit.InsuranceComponent e : element.getInsurance()) 
41026          composeExplanationOfBenefitInsuranceComponent(null, e);
41027        closeArray();
41028      };
41029      if (element.hasAccident()) {
41030        composeExplanationOfBenefitAccidentComponent("accident", element.getAccident());
41031      }
41032      if (element.hasItem()) {
41033        openArray("item");
41034        for (ExplanationOfBenefit.ItemComponent e : element.getItem()) 
41035          composeExplanationOfBenefitItemComponent(null, e);
41036        closeArray();
41037      };
41038      if (element.hasAddItem()) {
41039        openArray("addItem");
41040        for (ExplanationOfBenefit.AddedItemComponent e : element.getAddItem()) 
41041          composeExplanationOfBenefitAddedItemComponent(null, e);
41042        closeArray();
41043      };
41044      if (element.hasAdjudication()) {
41045        openArray("adjudication");
41046        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
41047          composeExplanationOfBenefitAdjudicationComponent(null, e);
41048        closeArray();
41049      };
41050      if (element.hasTotal()) {
41051        openArray("total");
41052        for (ExplanationOfBenefit.TotalComponent e : element.getTotal()) 
41053          composeExplanationOfBenefitTotalComponent(null, e);
41054        closeArray();
41055      };
41056      if (element.hasPayment()) {
41057        composeExplanationOfBenefitPaymentComponent("payment", element.getPayment());
41058      }
41059      if (element.hasFormCode()) {
41060        composeCodeableConcept("formCode", element.getFormCode());
41061      }
41062      if (element.hasForm()) {
41063        composeAttachment("form", element.getForm());
41064      }
41065      if (element.hasProcessNote()) {
41066        openArray("processNote");
41067        for (ExplanationOfBenefit.NoteComponent e : element.getProcessNote()) 
41068          composeExplanationOfBenefitNoteComponent(null, e);
41069        closeArray();
41070      };
41071      if (element.hasBenefitPeriod()) {
41072        composePeriod("benefitPeriod", element.getBenefitPeriod());
41073      }
41074      if (element.hasBenefitBalance()) {
41075        openArray("benefitBalance");
41076        for (ExplanationOfBenefit.BenefitBalanceComponent e : element.getBenefitBalance()) 
41077          composeExplanationOfBenefitBenefitBalanceComponent(null, e);
41078        closeArray();
41079      };
41080  }
41081
41082  protected void composeExplanationOfBenefitRelatedClaimComponent(String name, ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
41083    if (element != null) {
41084      open(name);
41085      composeExplanationOfBenefitRelatedClaimComponentInner(element);
41086      close();
41087    }
41088  }
41089
41090  protected void composeExplanationOfBenefitRelatedClaimComponentInner(ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
41091      composeBackbone(element);
41092      if (element.hasClaim()) {
41093        composeReference("claim", element.getClaim());
41094      }
41095      if (element.hasRelationship()) {
41096        composeCodeableConcept("relationship", element.getRelationship());
41097      }
41098      if (element.hasReference()) {
41099        composeIdentifier("reference", element.getReference());
41100      }
41101  }
41102
41103  protected void composeExplanationOfBenefitPayeeComponent(String name, ExplanationOfBenefit.PayeeComponent element) throws IOException {
41104    if (element != null) {
41105      open(name);
41106      composeExplanationOfBenefitPayeeComponentInner(element);
41107      close();
41108    }
41109  }
41110
41111  protected void composeExplanationOfBenefitPayeeComponentInner(ExplanationOfBenefit.PayeeComponent element) throws IOException {
41112      composeBackbone(element);
41113      if (element.hasType()) {
41114        composeCodeableConcept("type", element.getType());
41115      }
41116      if (element.hasParty()) {
41117        composeReference("party", element.getParty());
41118      }
41119  }
41120
41121  protected void composeExplanationOfBenefitCareTeamComponent(String name, ExplanationOfBenefit.CareTeamComponent element) throws IOException {
41122    if (element != null) {
41123      open(name);
41124      composeExplanationOfBenefitCareTeamComponentInner(element);
41125      close();
41126    }
41127  }
41128
41129  protected void composeExplanationOfBenefitCareTeamComponentInner(ExplanationOfBenefit.CareTeamComponent element) throws IOException {
41130      composeBackbone(element);
41131      if (element.hasSequenceElement()) {
41132        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41133        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41134      }
41135      if (element.hasProvider()) {
41136        composeReference("provider", element.getProvider());
41137      }
41138      if (element.hasResponsibleElement()) {
41139        composeBooleanCore("responsible", element.getResponsibleElement(), false);
41140        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
41141      }
41142      if (element.hasRole()) {
41143        composeCodeableConcept("role", element.getRole());
41144      }
41145      if (element.hasQualification()) {
41146        composeCodeableConcept("qualification", element.getQualification());
41147      }
41148  }
41149
41150  protected void composeExplanationOfBenefitSupportingInformationComponent(String name, ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
41151    if (element != null) {
41152      open(name);
41153      composeExplanationOfBenefitSupportingInformationComponentInner(element);
41154      close();
41155    }
41156  }
41157
41158  protected void composeExplanationOfBenefitSupportingInformationComponentInner(ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
41159      composeBackbone(element);
41160      if (element.hasSequenceElement()) {
41161        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41162        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41163      }
41164      if (element.hasCategory()) {
41165        composeCodeableConcept("category", element.getCategory());
41166      }
41167      if (element.hasCode()) {
41168        composeCodeableConcept("code", element.getCode());
41169      }
41170      if (element.hasTiming()) {
41171        composeType("timing", element.getTiming());
41172      }
41173      if (element.hasValue()) {
41174        composeType("value", element.getValue());
41175      }
41176      if (element.hasReason()) {
41177        composeCoding("reason", element.getReason());
41178      }
41179  }
41180
41181  protected void composeExplanationOfBenefitDiagnosisComponent(String name, ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
41182    if (element != null) {
41183      open(name);
41184      composeExplanationOfBenefitDiagnosisComponentInner(element);
41185      close();
41186    }
41187  }
41188
41189  protected void composeExplanationOfBenefitDiagnosisComponentInner(ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
41190      composeBackbone(element);
41191      if (element.hasSequenceElement()) {
41192        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41193        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41194      }
41195      if (element.hasDiagnosis()) {
41196        composeType("diagnosis", element.getDiagnosis());
41197      }
41198      if (element.hasType()) {
41199        openArray("type");
41200        for (CodeableConcept e : element.getType()) 
41201          composeCodeableConcept(null, e);
41202        closeArray();
41203      };
41204      if (element.hasOnAdmission()) {
41205        composeCodeableConcept("onAdmission", element.getOnAdmission());
41206      }
41207      if (element.hasPackageCode()) {
41208        composeCodeableConcept("packageCode", element.getPackageCode());
41209      }
41210  }
41211
41212  protected void composeExplanationOfBenefitProcedureComponent(String name, ExplanationOfBenefit.ProcedureComponent element) throws IOException {
41213    if (element != null) {
41214      open(name);
41215      composeExplanationOfBenefitProcedureComponentInner(element);
41216      close();
41217    }
41218  }
41219
41220  protected void composeExplanationOfBenefitProcedureComponentInner(ExplanationOfBenefit.ProcedureComponent element) throws IOException {
41221      composeBackbone(element);
41222      if (element.hasSequenceElement()) {
41223        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41224        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41225      }
41226      if (element.hasType()) {
41227        openArray("type");
41228        for (CodeableConcept e : element.getType()) 
41229          composeCodeableConcept(null, e);
41230        closeArray();
41231      };
41232      if (element.hasDateElement()) {
41233        composeDateTimeCore("date", element.getDateElement(), false);
41234        composeDateTimeExtras("date", element.getDateElement(), false);
41235      }
41236      if (element.hasProcedure()) {
41237        composeType("procedure", element.getProcedure());
41238      }
41239      if (element.hasUdi()) {
41240        openArray("udi");
41241        for (Reference e : element.getUdi()) 
41242          composeReference(null, e);
41243        closeArray();
41244      };
41245  }
41246
41247  protected void composeExplanationOfBenefitInsuranceComponent(String name, ExplanationOfBenefit.InsuranceComponent element) throws IOException {
41248    if (element != null) {
41249      open(name);
41250      composeExplanationOfBenefitInsuranceComponentInner(element);
41251      close();
41252    }
41253  }
41254
41255  protected void composeExplanationOfBenefitInsuranceComponentInner(ExplanationOfBenefit.InsuranceComponent element) throws IOException {
41256      composeBackbone(element);
41257      if (element.hasFocalElement()) {
41258        composeBooleanCore("focal", element.getFocalElement(), false);
41259        composeBooleanExtras("focal", element.getFocalElement(), false);
41260      }
41261      if (element.hasCoverage()) {
41262        composeReference("coverage", element.getCoverage());
41263      }
41264      if (element.hasPreAuthRef()) {
41265        openArray("preAuthRef");
41266        for (StringType e : element.getPreAuthRef()) 
41267          composeStringCore(null, e, true);
41268        closeArray();
41269        if (anyHasExtras(element.getPreAuthRef())) {
41270          openArray("_preAuthRef");
41271          for (StringType e : element.getPreAuthRef()) 
41272            composeStringExtras(null, e, true);
41273          closeArray();
41274        }
41275      };
41276  }
41277
41278  protected void composeExplanationOfBenefitAccidentComponent(String name, ExplanationOfBenefit.AccidentComponent element) throws IOException {
41279    if (element != null) {
41280      open(name);
41281      composeExplanationOfBenefitAccidentComponentInner(element);
41282      close();
41283    }
41284  }
41285
41286  protected void composeExplanationOfBenefitAccidentComponentInner(ExplanationOfBenefit.AccidentComponent element) throws IOException {
41287      composeBackbone(element);
41288      if (element.hasDateElement()) {
41289        composeDateCore("date", element.getDateElement(), false);
41290        composeDateExtras("date", element.getDateElement(), false);
41291      }
41292      if (element.hasType()) {
41293        composeCodeableConcept("type", element.getType());
41294      }
41295      if (element.hasLocation()) {
41296        composeType("location", element.getLocation());
41297      }
41298  }
41299
41300  protected void composeExplanationOfBenefitItemComponent(String name, ExplanationOfBenefit.ItemComponent element) throws IOException {
41301    if (element != null) {
41302      open(name);
41303      composeExplanationOfBenefitItemComponentInner(element);
41304      close();
41305    }
41306  }
41307
41308  protected void composeExplanationOfBenefitItemComponentInner(ExplanationOfBenefit.ItemComponent element) throws IOException {
41309      composeBackbone(element);
41310      if (element.hasSequenceElement()) {
41311        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41312        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41313      }
41314      if (element.hasCareTeamSequence()) {
41315        openArray("careTeamSequence");
41316        for (PositiveIntType e : element.getCareTeamSequence()) 
41317          composePositiveIntCore(null, e, true);
41318        closeArray();
41319        if (anyHasExtras(element.getCareTeamSequence())) {
41320          openArray("_careTeamSequence");
41321          for (PositiveIntType e : element.getCareTeamSequence()) 
41322            composePositiveIntExtras(null, e, true);
41323          closeArray();
41324        }
41325      };
41326      if (element.hasDiagnosisSequence()) {
41327        openArray("diagnosisSequence");
41328        for (PositiveIntType e : element.getDiagnosisSequence()) 
41329          composePositiveIntCore(null, e, true);
41330        closeArray();
41331        if (anyHasExtras(element.getDiagnosisSequence())) {
41332          openArray("_diagnosisSequence");
41333          for (PositiveIntType e : element.getDiagnosisSequence()) 
41334            composePositiveIntExtras(null, e, true);
41335          closeArray();
41336        }
41337      };
41338      if (element.hasProcedureSequence()) {
41339        openArray("procedureSequence");
41340        for (PositiveIntType e : element.getProcedureSequence()) 
41341          composePositiveIntCore(null, e, true);
41342        closeArray();
41343        if (anyHasExtras(element.getProcedureSequence())) {
41344          openArray("_procedureSequence");
41345          for (PositiveIntType e : element.getProcedureSequence()) 
41346            composePositiveIntExtras(null, e, true);
41347          closeArray();
41348        }
41349      };
41350      if (element.hasInformationSequence()) {
41351        openArray("informationSequence");
41352        for (PositiveIntType e : element.getInformationSequence()) 
41353          composePositiveIntCore(null, e, true);
41354        closeArray();
41355        if (anyHasExtras(element.getInformationSequence())) {
41356          openArray("_informationSequence");
41357          for (PositiveIntType e : element.getInformationSequence()) 
41358            composePositiveIntExtras(null, e, true);
41359          closeArray();
41360        }
41361      };
41362      if (element.hasRevenue()) {
41363        composeCodeableConcept("revenue", element.getRevenue());
41364      }
41365      if (element.hasCategory()) {
41366        composeCodeableConcept("category", element.getCategory());
41367      }
41368      if (element.hasProductOrService()) {
41369        composeCodeableConcept("productOrService", element.getProductOrService());
41370      }
41371      if (element.hasModifier()) {
41372        openArray("modifier");
41373        for (CodeableConcept e : element.getModifier()) 
41374          composeCodeableConcept(null, e);
41375        closeArray();
41376      };
41377      if (element.hasProgramCode()) {
41378        openArray("programCode");
41379        for (CodeableConcept e : element.getProgramCode()) 
41380          composeCodeableConcept(null, e);
41381        closeArray();
41382      };
41383      if (element.hasServiced()) {
41384        composeType("serviced", element.getServiced());
41385      }
41386      if (element.hasLocation()) {
41387        composeType("location", element.getLocation());
41388      }
41389      if (element.hasQuantity()) {
41390        composeQuantity("quantity", element.getQuantity());
41391      }
41392      if (element.hasUnitPrice()) {
41393        composeMoney("unitPrice", element.getUnitPrice());
41394      }
41395      if (element.hasFactorElement()) {
41396        composeDecimalCore("factor", element.getFactorElement(), false);
41397        composeDecimalExtras("factor", element.getFactorElement(), false);
41398      }
41399      if (element.hasNet()) {
41400        composeMoney("net", element.getNet());
41401      }
41402      if (element.hasUdi()) {
41403        openArray("udi");
41404        for (Reference e : element.getUdi()) 
41405          composeReference(null, e);
41406        closeArray();
41407      };
41408      if (element.hasBodySite()) {
41409        composeCodeableConcept("bodySite", element.getBodySite());
41410      }
41411      if (element.hasSubSite()) {
41412        openArray("subSite");
41413        for (CodeableConcept e : element.getSubSite()) 
41414          composeCodeableConcept(null, e);
41415        closeArray();
41416      };
41417      if (element.hasEncounter()) {
41418        openArray("encounter");
41419        for (Reference e : element.getEncounter()) 
41420          composeReference(null, e);
41421        closeArray();
41422      };
41423      if (element.hasNoteNumber()) {
41424        openArray("noteNumber");
41425        for (PositiveIntType e : element.getNoteNumber()) 
41426          composePositiveIntCore(null, e, true);
41427        closeArray();
41428        if (anyHasExtras(element.getNoteNumber())) {
41429          openArray("_noteNumber");
41430          for (PositiveIntType e : element.getNoteNumber()) 
41431            composePositiveIntExtras(null, e, true);
41432          closeArray();
41433        }
41434      };
41435      if (element.hasAdjudication()) {
41436        openArray("adjudication");
41437        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
41438          composeExplanationOfBenefitAdjudicationComponent(null, e);
41439        closeArray();
41440      };
41441      if (element.hasDetail()) {
41442        openArray("detail");
41443        for (ExplanationOfBenefit.DetailComponent e : element.getDetail()) 
41444          composeExplanationOfBenefitDetailComponent(null, e);
41445        closeArray();
41446      };
41447  }
41448
41449  protected void composeExplanationOfBenefitAdjudicationComponent(String name, ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
41450    if (element != null) {
41451      open(name);
41452      composeExplanationOfBenefitAdjudicationComponentInner(element);
41453      close();
41454    }
41455  }
41456
41457  protected void composeExplanationOfBenefitAdjudicationComponentInner(ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
41458      composeBackbone(element);
41459      if (element.hasCategory()) {
41460        composeCodeableConcept("category", element.getCategory());
41461      }
41462      if (element.hasReason()) {
41463        composeCodeableConcept("reason", element.getReason());
41464      }
41465      if (element.hasAmount()) {
41466        composeMoney("amount", element.getAmount());
41467      }
41468      if (element.hasValueElement()) {
41469        composeDecimalCore("value", element.getValueElement(), false);
41470        composeDecimalExtras("value", element.getValueElement(), false);
41471      }
41472  }
41473
41474  protected void composeExplanationOfBenefitDetailComponent(String name, ExplanationOfBenefit.DetailComponent element) throws IOException {
41475    if (element != null) {
41476      open(name);
41477      composeExplanationOfBenefitDetailComponentInner(element);
41478      close();
41479    }
41480  }
41481
41482  protected void composeExplanationOfBenefitDetailComponentInner(ExplanationOfBenefit.DetailComponent element) throws IOException {
41483      composeBackbone(element);
41484      if (element.hasSequenceElement()) {
41485        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41486        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41487      }
41488      if (element.hasRevenue()) {
41489        composeCodeableConcept("revenue", element.getRevenue());
41490      }
41491      if (element.hasCategory()) {
41492        composeCodeableConcept("category", element.getCategory());
41493      }
41494      if (element.hasProductOrService()) {
41495        composeCodeableConcept("productOrService", element.getProductOrService());
41496      }
41497      if (element.hasModifier()) {
41498        openArray("modifier");
41499        for (CodeableConcept e : element.getModifier()) 
41500          composeCodeableConcept(null, e);
41501        closeArray();
41502      };
41503      if (element.hasProgramCode()) {
41504        openArray("programCode");
41505        for (CodeableConcept e : element.getProgramCode()) 
41506          composeCodeableConcept(null, e);
41507        closeArray();
41508      };
41509      if (element.hasQuantity()) {
41510        composeQuantity("quantity", element.getQuantity());
41511      }
41512      if (element.hasUnitPrice()) {
41513        composeMoney("unitPrice", element.getUnitPrice());
41514      }
41515      if (element.hasFactorElement()) {
41516        composeDecimalCore("factor", element.getFactorElement(), false);
41517        composeDecimalExtras("factor", element.getFactorElement(), false);
41518      }
41519      if (element.hasNet()) {
41520        composeMoney("net", element.getNet());
41521      }
41522      if (element.hasUdi()) {
41523        openArray("udi");
41524        for (Reference e : element.getUdi()) 
41525          composeReference(null, e);
41526        closeArray();
41527      };
41528      if (element.hasNoteNumber()) {
41529        openArray("noteNumber");
41530        for (PositiveIntType e : element.getNoteNumber()) 
41531          composePositiveIntCore(null, e, true);
41532        closeArray();
41533        if (anyHasExtras(element.getNoteNumber())) {
41534          openArray("_noteNumber");
41535          for (PositiveIntType e : element.getNoteNumber()) 
41536            composePositiveIntExtras(null, e, true);
41537          closeArray();
41538        }
41539      };
41540      if (element.hasAdjudication()) {
41541        openArray("adjudication");
41542        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
41543          composeExplanationOfBenefitAdjudicationComponent(null, e);
41544        closeArray();
41545      };
41546      if (element.hasSubDetail()) {
41547        openArray("subDetail");
41548        for (ExplanationOfBenefit.SubDetailComponent e : element.getSubDetail()) 
41549          composeExplanationOfBenefitSubDetailComponent(null, e);
41550        closeArray();
41551      };
41552  }
41553
41554  protected void composeExplanationOfBenefitSubDetailComponent(String name, ExplanationOfBenefit.SubDetailComponent element) throws IOException {
41555    if (element != null) {
41556      open(name);
41557      composeExplanationOfBenefitSubDetailComponentInner(element);
41558      close();
41559    }
41560  }
41561
41562  protected void composeExplanationOfBenefitSubDetailComponentInner(ExplanationOfBenefit.SubDetailComponent element) throws IOException {
41563      composeBackbone(element);
41564      if (element.hasSequenceElement()) {
41565        composePositiveIntCore("sequence", element.getSequenceElement(), false);
41566        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
41567      }
41568      if (element.hasRevenue()) {
41569        composeCodeableConcept("revenue", element.getRevenue());
41570      }
41571      if (element.hasCategory()) {
41572        composeCodeableConcept("category", element.getCategory());
41573      }
41574      if (element.hasProductOrService()) {
41575        composeCodeableConcept("productOrService", element.getProductOrService());
41576      }
41577      if (element.hasModifier()) {
41578        openArray("modifier");
41579        for (CodeableConcept e : element.getModifier()) 
41580          composeCodeableConcept(null, e);
41581        closeArray();
41582      };
41583      if (element.hasProgramCode()) {
41584        openArray("programCode");
41585        for (CodeableConcept e : element.getProgramCode()) 
41586          composeCodeableConcept(null, e);
41587        closeArray();
41588      };
41589      if (element.hasQuantity()) {
41590        composeQuantity("quantity", element.getQuantity());
41591      }
41592      if (element.hasUnitPrice()) {
41593        composeMoney("unitPrice", element.getUnitPrice());
41594      }
41595      if (element.hasFactorElement()) {
41596        composeDecimalCore("factor", element.getFactorElement(), false);
41597        composeDecimalExtras("factor", element.getFactorElement(), false);
41598      }
41599      if (element.hasNet()) {
41600        composeMoney("net", element.getNet());
41601      }
41602      if (element.hasUdi()) {
41603        openArray("udi");
41604        for (Reference e : element.getUdi()) 
41605          composeReference(null, e);
41606        closeArray();
41607      };
41608      if (element.hasNoteNumber()) {
41609        openArray("noteNumber");
41610        for (PositiveIntType e : element.getNoteNumber()) 
41611          composePositiveIntCore(null, e, true);
41612        closeArray();
41613        if (anyHasExtras(element.getNoteNumber())) {
41614          openArray("_noteNumber");
41615          for (PositiveIntType e : element.getNoteNumber()) 
41616            composePositiveIntExtras(null, e, true);
41617          closeArray();
41618        }
41619      };
41620      if (element.hasAdjudication()) {
41621        openArray("adjudication");
41622        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
41623          composeExplanationOfBenefitAdjudicationComponent(null, e);
41624        closeArray();
41625      };
41626  }
41627
41628  protected void composeExplanationOfBenefitAddedItemComponent(String name, ExplanationOfBenefit.AddedItemComponent element) throws IOException {
41629    if (element != null) {
41630      open(name);
41631      composeExplanationOfBenefitAddedItemComponentInner(element);
41632      close();
41633    }
41634  }
41635
41636  protected void composeExplanationOfBenefitAddedItemComponentInner(ExplanationOfBenefit.AddedItemComponent element) throws IOException {
41637      composeBackbone(element);
41638      if (element.hasItemSequence()) {
41639        openArray("itemSequence");
41640        for (PositiveIntType e : element.getItemSequence()) 
41641          composePositiveIntCore(null, e, true);
41642        closeArray();
41643        if (anyHasExtras(element.getItemSequence())) {
41644          openArray("_itemSequence");
41645          for (PositiveIntType e : element.getItemSequence()) 
41646            composePositiveIntExtras(null, e, true);
41647          closeArray();
41648        }
41649      };
41650      if (element.hasDetailSequence()) {
41651        openArray("detailSequence");
41652        for (PositiveIntType e : element.getDetailSequence()) 
41653          composePositiveIntCore(null, e, true);
41654        closeArray();
41655        if (anyHasExtras(element.getDetailSequence())) {
41656          openArray("_detailSequence");
41657          for (PositiveIntType e : element.getDetailSequence()) 
41658            composePositiveIntExtras(null, e, true);
41659          closeArray();
41660        }
41661      };
41662      if (element.hasSubDetailSequence()) {
41663        openArray("subDetailSequence");
41664        for (PositiveIntType e : element.getSubDetailSequence()) 
41665          composePositiveIntCore(null, e, true);
41666        closeArray();
41667        if (anyHasExtras(element.getSubDetailSequence())) {
41668          openArray("_subDetailSequence");
41669          for (PositiveIntType e : element.getSubDetailSequence()) 
41670            composePositiveIntExtras(null, e, true);
41671          closeArray();
41672        }
41673      };
41674      if (element.hasProvider()) {
41675        openArray("provider");
41676        for (Reference e : element.getProvider()) 
41677          composeReference(null, e);
41678        closeArray();
41679      };
41680      if (element.hasProductOrService()) {
41681        composeCodeableConcept("productOrService", element.getProductOrService());
41682      }
41683      if (element.hasModifier()) {
41684        openArray("modifier");
41685        for (CodeableConcept e : element.getModifier()) 
41686          composeCodeableConcept(null, e);
41687        closeArray();
41688      };
41689      if (element.hasProgramCode()) {
41690        openArray("programCode");
41691        for (CodeableConcept e : element.getProgramCode()) 
41692          composeCodeableConcept(null, e);
41693        closeArray();
41694      };
41695      if (element.hasServiced()) {
41696        composeType("serviced", element.getServiced());
41697      }
41698      if (element.hasLocation()) {
41699        composeType("location", element.getLocation());
41700      }
41701      if (element.hasQuantity()) {
41702        composeQuantity("quantity", element.getQuantity());
41703      }
41704      if (element.hasUnitPrice()) {
41705        composeMoney("unitPrice", element.getUnitPrice());
41706      }
41707      if (element.hasFactorElement()) {
41708        composeDecimalCore("factor", element.getFactorElement(), false);
41709        composeDecimalExtras("factor", element.getFactorElement(), false);
41710      }
41711      if (element.hasNet()) {
41712        composeMoney("net", element.getNet());
41713      }
41714      if (element.hasBodySite()) {
41715        composeCodeableConcept("bodySite", element.getBodySite());
41716      }
41717      if (element.hasSubSite()) {
41718        openArray("subSite");
41719        for (CodeableConcept e : element.getSubSite()) 
41720          composeCodeableConcept(null, e);
41721        closeArray();
41722      };
41723      if (element.hasNoteNumber()) {
41724        openArray("noteNumber");
41725        for (PositiveIntType e : element.getNoteNumber()) 
41726          composePositiveIntCore(null, e, true);
41727        closeArray();
41728        if (anyHasExtras(element.getNoteNumber())) {
41729          openArray("_noteNumber");
41730          for (PositiveIntType e : element.getNoteNumber()) 
41731            composePositiveIntExtras(null, e, true);
41732          closeArray();
41733        }
41734      };
41735      if (element.hasAdjudication()) {
41736        openArray("adjudication");
41737        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
41738          composeExplanationOfBenefitAdjudicationComponent(null, e);
41739        closeArray();
41740      };
41741      if (element.hasDetail()) {
41742        openArray("detail");
41743        for (ExplanationOfBenefit.AddedItemDetailComponent e : element.getDetail()) 
41744          composeExplanationOfBenefitAddedItemDetailComponent(null, e);
41745        closeArray();
41746      };
41747  }
41748
41749  protected void composeExplanationOfBenefitAddedItemDetailComponent(String name, ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
41750    if (element != null) {
41751      open(name);
41752      composeExplanationOfBenefitAddedItemDetailComponentInner(element);
41753      close();
41754    }
41755  }
41756
41757  protected void composeExplanationOfBenefitAddedItemDetailComponentInner(ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
41758      composeBackbone(element);
41759      if (element.hasProductOrService()) {
41760        composeCodeableConcept("productOrService", element.getProductOrService());
41761      }
41762      if (element.hasModifier()) {
41763        openArray("modifier");
41764        for (CodeableConcept e : element.getModifier()) 
41765          composeCodeableConcept(null, e);
41766        closeArray();
41767      };
41768      if (element.hasQuantity()) {
41769        composeQuantity("quantity", element.getQuantity());
41770      }
41771      if (element.hasUnitPrice()) {
41772        composeMoney("unitPrice", element.getUnitPrice());
41773      }
41774      if (element.hasFactorElement()) {
41775        composeDecimalCore("factor", element.getFactorElement(), false);
41776        composeDecimalExtras("factor", element.getFactorElement(), false);
41777      }
41778      if (element.hasNet()) {
41779        composeMoney("net", element.getNet());
41780      }
41781      if (element.hasNoteNumber()) {
41782        openArray("noteNumber");
41783        for (PositiveIntType e : element.getNoteNumber()) 
41784          composePositiveIntCore(null, e, true);
41785        closeArray();
41786        if (anyHasExtras(element.getNoteNumber())) {
41787          openArray("_noteNumber");
41788          for (PositiveIntType e : element.getNoteNumber()) 
41789            composePositiveIntExtras(null, e, true);
41790          closeArray();
41791        }
41792      };
41793      if (element.hasAdjudication()) {
41794        openArray("adjudication");
41795        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
41796          composeExplanationOfBenefitAdjudicationComponent(null, e);
41797        closeArray();
41798      };
41799      if (element.hasSubDetail()) {
41800        openArray("subDetail");
41801        for (ExplanationOfBenefit.AddedItemDetailSubDetailComponent e : element.getSubDetail()) 
41802          composeExplanationOfBenefitAddedItemDetailSubDetailComponent(null, e);
41803        closeArray();
41804      };
41805  }
41806
41807  protected void composeExplanationOfBenefitAddedItemDetailSubDetailComponent(String name, ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
41808    if (element != null) {
41809      open(name);
41810      composeExplanationOfBenefitAddedItemDetailSubDetailComponentInner(element);
41811      close();
41812    }
41813  }
41814
41815  protected void composeExplanationOfBenefitAddedItemDetailSubDetailComponentInner(ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
41816      composeBackbone(element);
41817      if (element.hasProductOrService()) {
41818        composeCodeableConcept("productOrService", element.getProductOrService());
41819      }
41820      if (element.hasModifier()) {
41821        openArray("modifier");
41822        for (CodeableConcept e : element.getModifier()) 
41823          composeCodeableConcept(null, e);
41824        closeArray();
41825      };
41826      if (element.hasQuantity()) {
41827        composeQuantity("quantity", element.getQuantity());
41828      }
41829      if (element.hasUnitPrice()) {
41830        composeMoney("unitPrice", element.getUnitPrice());
41831      }
41832      if (element.hasFactorElement()) {
41833        composeDecimalCore("factor", element.getFactorElement(), false);
41834        composeDecimalExtras("factor", element.getFactorElement(), false);
41835      }
41836      if (element.hasNet()) {
41837        composeMoney("net", element.getNet());
41838      }
41839      if (element.hasNoteNumber()) {
41840        openArray("noteNumber");
41841        for (PositiveIntType e : element.getNoteNumber()) 
41842          composePositiveIntCore(null, e, true);
41843        closeArray();
41844        if (anyHasExtras(element.getNoteNumber())) {
41845          openArray("_noteNumber");
41846          for (PositiveIntType e : element.getNoteNumber()) 
41847            composePositiveIntExtras(null, e, true);
41848          closeArray();
41849        }
41850      };
41851      if (element.hasAdjudication()) {
41852        openArray("adjudication");
41853        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
41854          composeExplanationOfBenefitAdjudicationComponent(null, e);
41855        closeArray();
41856      };
41857  }
41858
41859  protected void composeExplanationOfBenefitTotalComponent(String name, ExplanationOfBenefit.TotalComponent element) throws IOException {
41860    if (element != null) {
41861      open(name);
41862      composeExplanationOfBenefitTotalComponentInner(element);
41863      close();
41864    }
41865  }
41866
41867  protected void composeExplanationOfBenefitTotalComponentInner(ExplanationOfBenefit.TotalComponent element) throws IOException {
41868      composeBackbone(element);
41869      if (element.hasCategory()) {
41870        composeCodeableConcept("category", element.getCategory());
41871      }
41872      if (element.hasAmount()) {
41873        composeMoney("amount", element.getAmount());
41874      }
41875  }
41876
41877  protected void composeExplanationOfBenefitPaymentComponent(String name, ExplanationOfBenefit.PaymentComponent element) throws IOException {
41878    if (element != null) {
41879      open(name);
41880      composeExplanationOfBenefitPaymentComponentInner(element);
41881      close();
41882    }
41883  }
41884
41885  protected void composeExplanationOfBenefitPaymentComponentInner(ExplanationOfBenefit.PaymentComponent element) throws IOException {
41886      composeBackbone(element);
41887      if (element.hasType()) {
41888        composeCodeableConcept("type", element.getType());
41889      }
41890      if (element.hasAdjustment()) {
41891        composeMoney("adjustment", element.getAdjustment());
41892      }
41893      if (element.hasAdjustmentReason()) {
41894        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
41895      }
41896      if (element.hasDateElement()) {
41897        composeDateCore("date", element.getDateElement(), false);
41898        composeDateExtras("date", element.getDateElement(), false);
41899      }
41900      if (element.hasAmount()) {
41901        composeMoney("amount", element.getAmount());
41902      }
41903      if (element.hasIdentifier()) {
41904        composeIdentifier("identifier", element.getIdentifier());
41905      }
41906  }
41907
41908  protected void composeExplanationOfBenefitNoteComponent(String name, ExplanationOfBenefit.NoteComponent element) throws IOException {
41909    if (element != null) {
41910      open(name);
41911      composeExplanationOfBenefitNoteComponentInner(element);
41912      close();
41913    }
41914  }
41915
41916  protected void composeExplanationOfBenefitNoteComponentInner(ExplanationOfBenefit.NoteComponent element) throws IOException {
41917      composeBackbone(element);
41918      if (element.hasNumberElement()) {
41919        composePositiveIntCore("number", element.getNumberElement(), false);
41920        composePositiveIntExtras("number", element.getNumberElement(), false);
41921      }
41922      if (element.hasTypeElement()) {
41923        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
41924        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
41925      }
41926      if (element.hasTextElement()) {
41927        composeStringCore("text", element.getTextElement(), false);
41928        composeStringExtras("text", element.getTextElement(), false);
41929      }
41930      if (element.hasLanguage()) {
41931        composeCodeableConcept("language", element.getLanguage());
41932      }
41933  }
41934
41935  protected void composeExplanationOfBenefitBenefitBalanceComponent(String name, ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
41936    if (element != null) {
41937      open(name);
41938      composeExplanationOfBenefitBenefitBalanceComponentInner(element);
41939      close();
41940    }
41941  }
41942
41943  protected void composeExplanationOfBenefitBenefitBalanceComponentInner(ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
41944      composeBackbone(element);
41945      if (element.hasCategory()) {
41946        composeCodeableConcept("category", element.getCategory());
41947      }
41948      if (element.hasExcludedElement()) {
41949        composeBooleanCore("excluded", element.getExcludedElement(), false);
41950        composeBooleanExtras("excluded", element.getExcludedElement(), false);
41951      }
41952      if (element.hasNameElement()) {
41953        composeStringCore("name", element.getNameElement(), false);
41954        composeStringExtras("name", element.getNameElement(), false);
41955      }
41956      if (element.hasDescriptionElement()) {
41957        composeStringCore("description", element.getDescriptionElement(), false);
41958        composeStringExtras("description", element.getDescriptionElement(), false);
41959      }
41960      if (element.hasNetwork()) {
41961        composeCodeableConcept("network", element.getNetwork());
41962      }
41963      if (element.hasUnit()) {
41964        composeCodeableConcept("unit", element.getUnit());
41965      }
41966      if (element.hasTerm()) {
41967        composeCodeableConcept("term", element.getTerm());
41968      }
41969      if (element.hasFinancial()) {
41970        openArray("financial");
41971        for (ExplanationOfBenefit.BenefitComponent e : element.getFinancial()) 
41972          composeExplanationOfBenefitBenefitComponent(null, e);
41973        closeArray();
41974      };
41975  }
41976
41977  protected void composeExplanationOfBenefitBenefitComponent(String name, ExplanationOfBenefit.BenefitComponent element) throws IOException {
41978    if (element != null) {
41979      open(name);
41980      composeExplanationOfBenefitBenefitComponentInner(element);
41981      close();
41982    }
41983  }
41984
41985  protected void composeExplanationOfBenefitBenefitComponentInner(ExplanationOfBenefit.BenefitComponent element) throws IOException {
41986      composeBackbone(element);
41987      if (element.hasType()) {
41988        composeCodeableConcept("type", element.getType());
41989      }
41990      if (element.hasAllowed()) {
41991        composeType("allowed", element.getAllowed());
41992      }
41993      if (element.hasUsed()) {
41994        composeType("used", element.getUsed());
41995      }
41996  }
41997
41998  protected void composeFamilyMemberHistory(String name, FamilyMemberHistory element) throws IOException {
41999    if (element != null) {
42000      prop("resourceType", name);
42001      composeFamilyMemberHistoryInner(element);
42002    }
42003  }
42004
42005  protected void composeFamilyMemberHistoryInner(FamilyMemberHistory element) throws IOException {
42006      composeDomainResourceElements(element);
42007      if (element.hasIdentifier()) {
42008        openArray("identifier");
42009        for (Identifier e : element.getIdentifier()) 
42010          composeIdentifier(null, e);
42011        closeArray();
42012      };
42013      if (element.hasInstantiatesCanonical()) {
42014        openArray("instantiatesCanonical");
42015        for (CanonicalType e : element.getInstantiatesCanonical()) 
42016          composeCanonicalCore(null, e, true);
42017        closeArray();
42018        if (anyHasExtras(element.getInstantiatesCanonical())) {
42019          openArray("_instantiatesCanonical");
42020          for (CanonicalType e : element.getInstantiatesCanonical()) 
42021            composeCanonicalExtras(null, e, true);
42022          closeArray();
42023        }
42024      };
42025      if (element.hasInstantiatesUri()) {
42026        openArray("instantiatesUri");
42027        for (UriType e : element.getInstantiatesUri()) 
42028          composeUriCore(null, e, true);
42029        closeArray();
42030        if (anyHasExtras(element.getInstantiatesUri())) {
42031          openArray("_instantiatesUri");
42032          for (UriType e : element.getInstantiatesUri()) 
42033            composeUriExtras(null, e, true);
42034          closeArray();
42035        }
42036      };
42037      if (element.hasStatusElement()) {
42038        composeEnumerationCore("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
42039        composeEnumerationExtras("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
42040      }
42041      if (element.hasDataAbsentReason()) {
42042        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
42043      }
42044      if (element.hasPatient()) {
42045        composeReference("patient", element.getPatient());
42046      }
42047      if (element.hasDateElement()) {
42048        composeDateTimeCore("date", element.getDateElement(), false);
42049        composeDateTimeExtras("date", element.getDateElement(), false);
42050      }
42051      if (element.hasNameElement()) {
42052        composeStringCore("name", element.getNameElement(), false);
42053        composeStringExtras("name", element.getNameElement(), false);
42054      }
42055      if (element.hasRelationship()) {
42056        composeCodeableConcept("relationship", element.getRelationship());
42057      }
42058      if (element.hasSex()) {
42059        composeCodeableConcept("sex", element.getSex());
42060      }
42061      if (element.hasBorn()) {
42062        composeType("born", element.getBorn());
42063      }
42064      if (element.hasAge()) {
42065        composeType("age", element.getAge());
42066      }
42067      if (element.hasEstimatedAgeElement()) {
42068        composeBooleanCore("estimatedAge", element.getEstimatedAgeElement(), false);
42069        composeBooleanExtras("estimatedAge", element.getEstimatedAgeElement(), false);
42070      }
42071      if (element.hasDeceased()) {
42072        composeType("deceased", element.getDeceased());
42073      }
42074      if (element.hasReasonCode()) {
42075        openArray("reasonCode");
42076        for (CodeableConcept e : element.getReasonCode()) 
42077          composeCodeableConcept(null, e);
42078        closeArray();
42079      };
42080      if (element.hasReasonReference()) {
42081        openArray("reasonReference");
42082        for (Reference e : element.getReasonReference()) 
42083          composeReference(null, e);
42084        closeArray();
42085      };
42086      if (element.hasNote()) {
42087        openArray("note");
42088        for (Annotation e : element.getNote()) 
42089          composeAnnotation(null, e);
42090        closeArray();
42091      };
42092      if (element.hasCondition()) {
42093        openArray("condition");
42094        for (FamilyMemberHistory.FamilyMemberHistoryConditionComponent e : element.getCondition()) 
42095          composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(null, e);
42096        closeArray();
42097      };
42098  }
42099
42100  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(String name, FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
42101    if (element != null) {
42102      open(name);
42103      composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(element);
42104      close();
42105    }
42106  }
42107
42108  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
42109      composeBackbone(element);
42110      if (element.hasCode()) {
42111        composeCodeableConcept("code", element.getCode());
42112      }
42113      if (element.hasOutcome()) {
42114        composeCodeableConcept("outcome", element.getOutcome());
42115      }
42116      if (element.hasContributedToDeathElement()) {
42117        composeBooleanCore("contributedToDeath", element.getContributedToDeathElement(), false);
42118        composeBooleanExtras("contributedToDeath", element.getContributedToDeathElement(), false);
42119      }
42120      if (element.hasOnset()) {
42121        composeType("onset", element.getOnset());
42122      }
42123      if (element.hasNote()) {
42124        openArray("note");
42125        for (Annotation e : element.getNote()) 
42126          composeAnnotation(null, e);
42127        closeArray();
42128      };
42129  }
42130
42131  protected void composeFlag(String name, Flag element) throws IOException {
42132    if (element != null) {
42133      prop("resourceType", name);
42134      composeFlagInner(element);
42135    }
42136  }
42137
42138  protected void composeFlagInner(Flag element) throws IOException {
42139      composeDomainResourceElements(element);
42140      if (element.hasIdentifier()) {
42141        openArray("identifier");
42142        for (Identifier e : element.getIdentifier()) 
42143          composeIdentifier(null, e);
42144        closeArray();
42145      };
42146      if (element.hasStatusElement()) {
42147        composeEnumerationCore("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
42148        composeEnumerationExtras("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
42149      }
42150      if (element.hasCategory()) {
42151        openArray("category");
42152        for (CodeableConcept e : element.getCategory()) 
42153          composeCodeableConcept(null, e);
42154        closeArray();
42155      };
42156      if (element.hasCode()) {
42157        composeCodeableConcept("code", element.getCode());
42158      }
42159      if (element.hasSubject()) {
42160        composeReference("subject", element.getSubject());
42161      }
42162      if (element.hasPeriod()) {
42163        composePeriod("period", element.getPeriod());
42164      }
42165      if (element.hasEncounter()) {
42166        composeReference("encounter", element.getEncounter());
42167      }
42168      if (element.hasAuthor()) {
42169        composeReference("author", element.getAuthor());
42170      }
42171  }
42172
42173  protected void composeGoal(String name, Goal element) throws IOException {
42174    if (element != null) {
42175      prop("resourceType", name);
42176      composeGoalInner(element);
42177    }
42178  }
42179
42180  protected void composeGoalInner(Goal element) throws IOException {
42181      composeDomainResourceElements(element);
42182      if (element.hasIdentifier()) {
42183        openArray("identifier");
42184        for (Identifier e : element.getIdentifier()) 
42185          composeIdentifier(null, e);
42186        closeArray();
42187      };
42188      if (element.hasLifecycleStatusElement()) {
42189        composeEnumerationCore("lifecycleStatus", element.getLifecycleStatusElement(), new Goal.GoalLifecycleStatusEnumFactory(), false);
42190        composeEnumerationExtras("lifecycleStatus", element.getLifecycleStatusElement(), new Goal.GoalLifecycleStatusEnumFactory(), false);
42191      }
42192      if (element.hasAchievementStatus()) {
42193        composeCodeableConcept("achievementStatus", element.getAchievementStatus());
42194      }
42195      if (element.hasCategory()) {
42196        openArray("category");
42197        for (CodeableConcept e : element.getCategory()) 
42198          composeCodeableConcept(null, e);
42199        closeArray();
42200      };
42201      if (element.hasPriority()) {
42202        composeCodeableConcept("priority", element.getPriority());
42203      }
42204      if (element.hasDescription()) {
42205        composeCodeableConcept("description", element.getDescription());
42206      }
42207      if (element.hasSubject()) {
42208        composeReference("subject", element.getSubject());
42209      }
42210      if (element.hasStart()) {
42211        composeType("start", element.getStart());
42212      }
42213      if (element.hasTarget()) {
42214        openArray("target");
42215        for (Goal.GoalTargetComponent e : element.getTarget()) 
42216          composeGoalGoalTargetComponent(null, e);
42217        closeArray();
42218      };
42219      if (element.hasStatusDateElement()) {
42220        composeDateCore("statusDate", element.getStatusDateElement(), false);
42221        composeDateExtras("statusDate", element.getStatusDateElement(), false);
42222      }
42223      if (element.hasStatusReasonElement()) {
42224        composeStringCore("statusReason", element.getStatusReasonElement(), false);
42225        composeStringExtras("statusReason", element.getStatusReasonElement(), false);
42226      }
42227      if (element.hasExpressedBy()) {
42228        composeReference("expressedBy", element.getExpressedBy());
42229      }
42230      if (element.hasAddresses()) {
42231        openArray("addresses");
42232        for (Reference e : element.getAddresses()) 
42233          composeReference(null, e);
42234        closeArray();
42235      };
42236      if (element.hasNote()) {
42237        openArray("note");
42238        for (Annotation e : element.getNote()) 
42239          composeAnnotation(null, e);
42240        closeArray();
42241      };
42242      if (element.hasOutcomeCode()) {
42243        openArray("outcomeCode");
42244        for (CodeableConcept e : element.getOutcomeCode()) 
42245          composeCodeableConcept(null, e);
42246        closeArray();
42247      };
42248      if (element.hasOutcomeReference()) {
42249        openArray("outcomeReference");
42250        for (Reference e : element.getOutcomeReference()) 
42251          composeReference(null, e);
42252        closeArray();
42253      };
42254  }
42255
42256  protected void composeGoalGoalTargetComponent(String name, Goal.GoalTargetComponent element) throws IOException {
42257    if (element != null) {
42258      open(name);
42259      composeGoalGoalTargetComponentInner(element);
42260      close();
42261    }
42262  }
42263
42264  protected void composeGoalGoalTargetComponentInner(Goal.GoalTargetComponent element) throws IOException {
42265      composeBackbone(element);
42266      if (element.hasMeasure()) {
42267        composeCodeableConcept("measure", element.getMeasure());
42268      }
42269      if (element.hasDetail()) {
42270        composeType("detail", element.getDetail());
42271      }
42272      if (element.hasDue()) {
42273        composeType("due", element.getDue());
42274      }
42275  }
42276
42277  protected void composeGraphDefinition(String name, GraphDefinition element) throws IOException {
42278    if (element != null) {
42279      prop("resourceType", name);
42280      composeGraphDefinitionInner(element);
42281    }
42282  }
42283
42284  protected void composeGraphDefinitionInner(GraphDefinition element) throws IOException {
42285      composeDomainResourceElements(element);
42286      if (element.hasUrlElement()) {
42287        composeUriCore("url", element.getUrlElement(), false);
42288        composeUriExtras("url", element.getUrlElement(), false);
42289      }
42290      if (element.hasVersionElement()) {
42291        composeStringCore("version", element.getVersionElement(), false);
42292        composeStringExtras("version", element.getVersionElement(), false);
42293      }
42294      if (element.hasNameElement()) {
42295        composeStringCore("name", element.getNameElement(), false);
42296        composeStringExtras("name", element.getNameElement(), false);
42297      }
42298      if (element.hasStatusElement()) {
42299        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42300        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42301      }
42302      if (element.hasExperimentalElement()) {
42303        composeBooleanCore("experimental", element.getExperimentalElement(), false);
42304        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
42305      }
42306      if (element.hasDateElement()) {
42307        composeDateTimeCore("date", element.getDateElement(), false);
42308        composeDateTimeExtras("date", element.getDateElement(), false);
42309      }
42310      if (element.hasPublisherElement()) {
42311        composeStringCore("publisher", element.getPublisherElement(), false);
42312        composeStringExtras("publisher", element.getPublisherElement(), false);
42313      }
42314      if (element.hasContact()) {
42315        openArray("contact");
42316        for (ContactDetail e : element.getContact()) 
42317          composeContactDetail(null, e);
42318        closeArray();
42319      };
42320      if (element.hasDescriptionElement()) {
42321        composeMarkdownCore("description", element.getDescriptionElement(), false);
42322        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42323      }
42324      if (element.hasUseContext()) {
42325        openArray("useContext");
42326        for (UsageContext e : element.getUseContext()) 
42327          composeUsageContext(null, e);
42328        closeArray();
42329      };
42330      if (element.hasJurisdiction()) {
42331        openArray("jurisdiction");
42332        for (CodeableConcept e : element.getJurisdiction()) 
42333          composeCodeableConcept(null, e);
42334        closeArray();
42335      };
42336      if (element.hasPurposeElement()) {
42337        composeMarkdownCore("purpose", element.getPurposeElement(), false);
42338        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
42339      }
42340      if (element.hasStartElement()) {
42341        composeCodeCore("start", element.getStartElement(), false);
42342        composeCodeExtras("start", element.getStartElement(), false);
42343      }
42344      if (element.hasProfileElement()) {
42345        composeCanonicalCore("profile", element.getProfileElement(), false);
42346        composeCanonicalExtras("profile", element.getProfileElement(), false);
42347      }
42348      if (element.hasLink()) {
42349        openArray("link");
42350        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
42351          composeGraphDefinitionGraphDefinitionLinkComponent(null, e);
42352        closeArray();
42353      };
42354  }
42355
42356  protected void composeGraphDefinitionGraphDefinitionLinkComponent(String name, GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
42357    if (element != null) {
42358      open(name);
42359      composeGraphDefinitionGraphDefinitionLinkComponentInner(element);
42360      close();
42361    }
42362  }
42363
42364  protected void composeGraphDefinitionGraphDefinitionLinkComponentInner(GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
42365      composeBackbone(element);
42366      if (element.hasPathElement()) {
42367        composeStringCore("path", element.getPathElement(), false);
42368        composeStringExtras("path", element.getPathElement(), false);
42369      }
42370      if (element.hasSliceNameElement()) {
42371        composeStringCore("sliceName", element.getSliceNameElement(), false);
42372        composeStringExtras("sliceName", element.getSliceNameElement(), false);
42373      }
42374      if (element.hasMinElement()) {
42375        composeIntegerCore("min", element.getMinElement(), false);
42376        composeIntegerExtras("min", element.getMinElement(), false);
42377      }
42378      if (element.hasMaxElement()) {
42379        composeStringCore("max", element.getMaxElement(), false);
42380        composeStringExtras("max", element.getMaxElement(), false);
42381      }
42382      if (element.hasDescriptionElement()) {
42383        composeStringCore("description", element.getDescriptionElement(), false);
42384        composeStringExtras("description", element.getDescriptionElement(), false);
42385      }
42386      if (element.hasTarget()) {
42387        openArray("target");
42388        for (GraphDefinition.GraphDefinitionLinkTargetComponent e : element.getTarget()) 
42389          composeGraphDefinitionGraphDefinitionLinkTargetComponent(null, e);
42390        closeArray();
42391      };
42392  }
42393
42394  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponent(String name, GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
42395    if (element != null) {
42396      open(name);
42397      composeGraphDefinitionGraphDefinitionLinkTargetComponentInner(element);
42398      close();
42399    }
42400  }
42401
42402  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponentInner(GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
42403      composeBackbone(element);
42404      if (element.hasTypeElement()) {
42405        composeCodeCore("type", element.getTypeElement(), false);
42406        composeCodeExtras("type", element.getTypeElement(), false);
42407      }
42408      if (element.hasParamsElement()) {
42409        composeStringCore("params", element.getParamsElement(), false);
42410        composeStringExtras("params", element.getParamsElement(), false);
42411      }
42412      if (element.hasProfileElement()) {
42413        composeCanonicalCore("profile", element.getProfileElement(), false);
42414        composeCanonicalExtras("profile", element.getProfileElement(), false);
42415      }
42416      if (element.hasCompartment()) {
42417        openArray("compartment");
42418        for (GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent e : element.getCompartment()) 
42419          composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(null, e);
42420        closeArray();
42421      };
42422      if (element.hasLink()) {
42423        openArray("link");
42424        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
42425          composeGraphDefinitionGraphDefinitionLinkComponent(null, e);
42426        closeArray();
42427      };
42428  }
42429
42430  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(String name, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
42431    if (element != null) {
42432      open(name);
42433      composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentInner(element);
42434      close();
42435    }
42436  }
42437
42438  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentInner(GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
42439      composeBackbone(element);
42440      if (element.hasUseElement()) {
42441        composeEnumerationCore("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(), false);
42442        composeEnumerationExtras("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(), false);
42443      }
42444      if (element.hasCodeElement()) {
42445        composeEnumerationCore("code", element.getCodeElement(), new GraphDefinition.CompartmentCodeEnumFactory(), false);
42446        composeEnumerationExtras("code", element.getCodeElement(), new GraphDefinition.CompartmentCodeEnumFactory(), false);
42447      }
42448      if (element.hasRuleElement()) {
42449        composeEnumerationCore("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
42450        composeEnumerationExtras("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
42451      }
42452      if (element.hasExpressionElement()) {
42453        composeStringCore("expression", element.getExpressionElement(), false);
42454        composeStringExtras("expression", element.getExpressionElement(), false);
42455      }
42456      if (element.hasDescriptionElement()) {
42457        composeStringCore("description", element.getDescriptionElement(), false);
42458        composeStringExtras("description", element.getDescriptionElement(), false);
42459      }
42460  }
42461
42462  protected void composeGroup(String name, Group element) throws IOException {
42463    if (element != null) {
42464      prop("resourceType", name);
42465      composeGroupInner(element);
42466    }
42467  }
42468
42469  protected void composeGroupInner(Group element) throws IOException {
42470      composeDomainResourceElements(element);
42471      if (element.hasIdentifier()) {
42472        openArray("identifier");
42473        for (Identifier e : element.getIdentifier()) 
42474          composeIdentifier(null, e);
42475        closeArray();
42476      };
42477      if (element.hasActiveElement()) {
42478        composeBooleanCore("active", element.getActiveElement(), false);
42479        composeBooleanExtras("active", element.getActiveElement(), false);
42480      }
42481      if (element.hasTypeElement()) {
42482        composeEnumerationCore("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
42483        composeEnumerationExtras("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
42484      }
42485      if (element.hasActualElement()) {
42486        composeBooleanCore("actual", element.getActualElement(), false);
42487        composeBooleanExtras("actual", element.getActualElement(), false);
42488      }
42489      if (element.hasCode()) {
42490        composeCodeableConcept("code", element.getCode());
42491      }
42492      if (element.hasNameElement()) {
42493        composeStringCore("name", element.getNameElement(), false);
42494        composeStringExtras("name", element.getNameElement(), false);
42495      }
42496      if (element.hasQuantityElement()) {
42497        composeUnsignedIntCore("quantity", element.getQuantityElement(), false);
42498        composeUnsignedIntExtras("quantity", element.getQuantityElement(), false);
42499      }
42500      if (element.hasManagingEntity()) {
42501        composeReference("managingEntity", element.getManagingEntity());
42502      }
42503      if (element.hasCharacteristic()) {
42504        openArray("characteristic");
42505        for (Group.GroupCharacteristicComponent e : element.getCharacteristic()) 
42506          composeGroupGroupCharacteristicComponent(null, e);
42507        closeArray();
42508      };
42509      if (element.hasMember()) {
42510        openArray("member");
42511        for (Group.GroupMemberComponent e : element.getMember()) 
42512          composeGroupGroupMemberComponent(null, e);
42513        closeArray();
42514      };
42515  }
42516
42517  protected void composeGroupGroupCharacteristicComponent(String name, Group.GroupCharacteristicComponent element) throws IOException {
42518    if (element != null) {
42519      open(name);
42520      composeGroupGroupCharacteristicComponentInner(element);
42521      close();
42522    }
42523  }
42524
42525  protected void composeGroupGroupCharacteristicComponentInner(Group.GroupCharacteristicComponent element) throws IOException {
42526      composeBackbone(element);
42527      if (element.hasCode()) {
42528        composeCodeableConcept("code", element.getCode());
42529      }
42530      if (element.hasValue()) {
42531        composeType("value", element.getValue());
42532      }
42533      if (element.hasExcludeElement()) {
42534        composeBooleanCore("exclude", element.getExcludeElement(), false);
42535        composeBooleanExtras("exclude", element.getExcludeElement(), false);
42536      }
42537      if (element.hasPeriod()) {
42538        composePeriod("period", element.getPeriod());
42539      }
42540  }
42541
42542  protected void composeGroupGroupMemberComponent(String name, Group.GroupMemberComponent element) throws IOException {
42543    if (element != null) {
42544      open(name);
42545      composeGroupGroupMemberComponentInner(element);
42546      close();
42547    }
42548  }
42549
42550  protected void composeGroupGroupMemberComponentInner(Group.GroupMemberComponent element) throws IOException {
42551      composeBackbone(element);
42552      if (element.hasEntity()) {
42553        composeReference("entity", element.getEntity());
42554      }
42555      if (element.hasPeriod()) {
42556        composePeriod("period", element.getPeriod());
42557      }
42558      if (element.hasInactiveElement()) {
42559        composeBooleanCore("inactive", element.getInactiveElement(), false);
42560        composeBooleanExtras("inactive", element.getInactiveElement(), false);
42561      }
42562  }
42563
42564  protected void composeGuidanceResponse(String name, GuidanceResponse element) throws IOException {
42565    if (element != null) {
42566      prop("resourceType", name);
42567      composeGuidanceResponseInner(element);
42568    }
42569  }
42570
42571  protected void composeGuidanceResponseInner(GuidanceResponse element) throws IOException {
42572      composeDomainResourceElements(element);
42573      if (element.hasRequestIdentifier()) {
42574        composeIdentifier("requestIdentifier", element.getRequestIdentifier());
42575      }
42576      if (element.hasIdentifier()) {
42577        openArray("identifier");
42578        for (Identifier e : element.getIdentifier()) 
42579          composeIdentifier(null, e);
42580        closeArray();
42581      };
42582      if (element.hasModule()) {
42583        composeType("module", element.getModule());
42584      }
42585      if (element.hasStatusElement()) {
42586        composeEnumerationCore("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
42587        composeEnumerationExtras("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
42588      }
42589      if (element.hasSubject()) {
42590        composeReference("subject", element.getSubject());
42591      }
42592      if (element.hasEncounter()) {
42593        composeReference("encounter", element.getEncounter());
42594      }
42595      if (element.hasOccurrenceDateTimeElement()) {
42596        composeDateTimeCore("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
42597        composeDateTimeExtras("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
42598      }
42599      if (element.hasPerformer()) {
42600        composeReference("performer", element.getPerformer());
42601      }
42602      if (element.hasReasonCode()) {
42603        openArray("reasonCode");
42604        for (CodeableConcept e : element.getReasonCode()) 
42605          composeCodeableConcept(null, e);
42606        closeArray();
42607      };
42608      if (element.hasReasonReference()) {
42609        openArray("reasonReference");
42610        for (Reference e : element.getReasonReference()) 
42611          composeReference(null, e);
42612        closeArray();
42613      };
42614      if (element.hasNote()) {
42615        openArray("note");
42616        for (Annotation e : element.getNote()) 
42617          composeAnnotation(null, e);
42618        closeArray();
42619      };
42620      if (element.hasEvaluationMessage()) {
42621        openArray("evaluationMessage");
42622        for (Reference e : element.getEvaluationMessage()) 
42623          composeReference(null, e);
42624        closeArray();
42625      };
42626      if (element.hasOutputParameters()) {
42627        composeReference("outputParameters", element.getOutputParameters());
42628      }
42629      if (element.hasResult()) {
42630        composeReference("result", element.getResult());
42631      }
42632      if (element.hasDataRequirement()) {
42633        openArray("dataRequirement");
42634        for (DataRequirement e : element.getDataRequirement()) 
42635          composeDataRequirement(null, e);
42636        closeArray();
42637      };
42638  }
42639
42640  protected void composeHealthcareService(String name, HealthcareService element) throws IOException {
42641    if (element != null) {
42642      prop("resourceType", name);
42643      composeHealthcareServiceInner(element);
42644    }
42645  }
42646
42647  protected void composeHealthcareServiceInner(HealthcareService element) throws IOException {
42648      composeDomainResourceElements(element);
42649      if (element.hasIdentifier()) {
42650        openArray("identifier");
42651        for (Identifier e : element.getIdentifier()) 
42652          composeIdentifier(null, e);
42653        closeArray();
42654      };
42655      if (element.hasActiveElement()) {
42656        composeBooleanCore("active", element.getActiveElement(), false);
42657        composeBooleanExtras("active", element.getActiveElement(), false);
42658      }
42659      if (element.hasProvidedBy()) {
42660        composeReference("providedBy", element.getProvidedBy());
42661      }
42662      if (element.hasCategory()) {
42663        openArray("category");
42664        for (CodeableConcept e : element.getCategory()) 
42665          composeCodeableConcept(null, e);
42666        closeArray();
42667      };
42668      if (element.hasType()) {
42669        openArray("type");
42670        for (CodeableConcept e : element.getType()) 
42671          composeCodeableConcept(null, e);
42672        closeArray();
42673      };
42674      if (element.hasSpecialty()) {
42675        openArray("specialty");
42676        for (CodeableConcept e : element.getSpecialty()) 
42677          composeCodeableConcept(null, e);
42678        closeArray();
42679      };
42680      if (element.hasLocation()) {
42681        openArray("location");
42682        for (Reference e : element.getLocation()) 
42683          composeReference(null, e);
42684        closeArray();
42685      };
42686      if (element.hasNameElement()) {
42687        composeStringCore("name", element.getNameElement(), false);
42688        composeStringExtras("name", element.getNameElement(), false);
42689      }
42690      if (element.hasCommentElement()) {
42691        composeStringCore("comment", element.getCommentElement(), false);
42692        composeStringExtras("comment", element.getCommentElement(), false);
42693      }
42694      if (element.hasExtraDetailsElement()) {
42695        composeMarkdownCore("extraDetails", element.getExtraDetailsElement(), false);
42696        composeMarkdownExtras("extraDetails", element.getExtraDetailsElement(), false);
42697      }
42698      if (element.hasPhoto()) {
42699        composeAttachment("photo", element.getPhoto());
42700      }
42701      if (element.hasTelecom()) {
42702        openArray("telecom");
42703        for (ContactPoint e : element.getTelecom()) 
42704          composeContactPoint(null, e);
42705        closeArray();
42706      };
42707      if (element.hasCoverageArea()) {
42708        openArray("coverageArea");
42709        for (Reference e : element.getCoverageArea()) 
42710          composeReference(null, e);
42711        closeArray();
42712      };
42713      if (element.hasServiceProvisionCode()) {
42714        openArray("serviceProvisionCode");
42715        for (CodeableConcept e : element.getServiceProvisionCode()) 
42716          composeCodeableConcept(null, e);
42717        closeArray();
42718      };
42719      if (element.hasEligibility()) {
42720        openArray("eligibility");
42721        for (HealthcareService.HealthcareServiceEligibilityComponent e : element.getEligibility()) 
42722          composeHealthcareServiceHealthcareServiceEligibilityComponent(null, e);
42723        closeArray();
42724      };
42725      if (element.hasProgram()) {
42726        openArray("program");
42727        for (CodeableConcept e : element.getProgram()) 
42728          composeCodeableConcept(null, e);
42729        closeArray();
42730      };
42731      if (element.hasCharacteristic()) {
42732        openArray("characteristic");
42733        for (CodeableConcept e : element.getCharacteristic()) 
42734          composeCodeableConcept(null, e);
42735        closeArray();
42736      };
42737      if (element.hasCommunication()) {
42738        openArray("communication");
42739        for (CodeableConcept e : element.getCommunication()) 
42740          composeCodeableConcept(null, e);
42741        closeArray();
42742      };
42743      if (element.hasReferralMethod()) {
42744        openArray("referralMethod");
42745        for (CodeableConcept e : element.getReferralMethod()) 
42746          composeCodeableConcept(null, e);
42747        closeArray();
42748      };
42749      if (element.hasAppointmentRequiredElement()) {
42750        composeBooleanCore("appointmentRequired", element.getAppointmentRequiredElement(), false);
42751        composeBooleanExtras("appointmentRequired", element.getAppointmentRequiredElement(), false);
42752      }
42753      if (element.hasAvailableTime()) {
42754        openArray("availableTime");
42755        for (HealthcareService.HealthcareServiceAvailableTimeComponent e : element.getAvailableTime()) 
42756          composeHealthcareServiceHealthcareServiceAvailableTimeComponent(null, e);
42757        closeArray();
42758      };
42759      if (element.hasNotAvailable()) {
42760        openArray("notAvailable");
42761        for (HealthcareService.HealthcareServiceNotAvailableComponent e : element.getNotAvailable()) 
42762          composeHealthcareServiceHealthcareServiceNotAvailableComponent(null, e);
42763        closeArray();
42764      };
42765      if (element.hasAvailabilityExceptionsElement()) {
42766        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
42767        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
42768      }
42769      if (element.hasEndpoint()) {
42770        openArray("endpoint");
42771        for (Reference e : element.getEndpoint()) 
42772          composeReference(null, e);
42773        closeArray();
42774      };
42775  }
42776
42777  protected void composeHealthcareServiceHealthcareServiceEligibilityComponent(String name, HealthcareService.HealthcareServiceEligibilityComponent element) throws IOException {
42778    if (element != null) {
42779      open(name);
42780      composeHealthcareServiceHealthcareServiceEligibilityComponentInner(element);
42781      close();
42782    }
42783  }
42784
42785  protected void composeHealthcareServiceHealthcareServiceEligibilityComponentInner(HealthcareService.HealthcareServiceEligibilityComponent element) throws IOException {
42786      composeBackbone(element);
42787      if (element.hasCode()) {
42788        composeCodeableConcept("code", element.getCode());
42789      }
42790      if (element.hasCommentElement()) {
42791        composeMarkdownCore("comment", element.getCommentElement(), false);
42792        composeMarkdownExtras("comment", element.getCommentElement(), false);
42793      }
42794  }
42795
42796  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponent(String name, HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
42797    if (element != null) {
42798      open(name);
42799      composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(element);
42800      close();
42801    }
42802  }
42803
42804  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
42805      composeBackbone(element);
42806      if (element.hasDaysOfWeek()) {
42807        openArray("daysOfWeek");
42808        for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
42809          composeEnumerationCore(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
42810        closeArray();
42811        if (anyHasExtras(element.getDaysOfWeek())) {
42812          openArray("_daysOfWeek");
42813          for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
42814            composeEnumerationExtras(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
42815          closeArray();
42816        }
42817      };
42818      if (element.hasAllDayElement()) {
42819        composeBooleanCore("allDay", element.getAllDayElement(), false);
42820        composeBooleanExtras("allDay", element.getAllDayElement(), false);
42821      }
42822      if (element.hasAvailableStartTimeElement()) {
42823        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
42824        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
42825      }
42826      if (element.hasAvailableEndTimeElement()) {
42827        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
42828        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
42829      }
42830  }
42831
42832  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponent(String name, HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
42833    if (element != null) {
42834      open(name);
42835      composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(element);
42836      close();
42837    }
42838  }
42839
42840  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
42841      composeBackbone(element);
42842      if (element.hasDescriptionElement()) {
42843        composeStringCore("description", element.getDescriptionElement(), false);
42844        composeStringExtras("description", element.getDescriptionElement(), false);
42845      }
42846      if (element.hasDuring()) {
42847        composePeriod("during", element.getDuring());
42848      }
42849  }
42850
42851  protected void composeImagingStudy(String name, ImagingStudy element) throws IOException {
42852    if (element != null) {
42853      prop("resourceType", name);
42854      composeImagingStudyInner(element);
42855    }
42856  }
42857
42858  protected void composeImagingStudyInner(ImagingStudy element) throws IOException {
42859      composeDomainResourceElements(element);
42860      if (element.hasIdentifier()) {
42861        openArray("identifier");
42862        for (Identifier e : element.getIdentifier()) 
42863          composeIdentifier(null, e);
42864        closeArray();
42865      };
42866      if (element.hasStatusElement()) {
42867        composeEnumerationCore("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(), false);
42868        composeEnumerationExtras("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(), false);
42869      }
42870      if (element.hasModality()) {
42871        openArray("modality");
42872        for (Coding e : element.getModality()) 
42873          composeCoding(null, e);
42874        closeArray();
42875      };
42876      if (element.hasSubject()) {
42877        composeReference("subject", element.getSubject());
42878      }
42879      if (element.hasEncounter()) {
42880        composeReference("encounter", element.getEncounter());
42881      }
42882      if (element.hasStartedElement()) {
42883        composeDateTimeCore("started", element.getStartedElement(), false);
42884        composeDateTimeExtras("started", element.getStartedElement(), false);
42885      }
42886      if (element.hasBasedOn()) {
42887        openArray("basedOn");
42888        for (Reference e : element.getBasedOn()) 
42889          composeReference(null, e);
42890        closeArray();
42891      };
42892      if (element.hasReferrer()) {
42893        composeReference("referrer", element.getReferrer());
42894      }
42895      if (element.hasInterpreter()) {
42896        openArray("interpreter");
42897        for (Reference e : element.getInterpreter()) 
42898          composeReference(null, e);
42899        closeArray();
42900      };
42901      if (element.hasEndpoint()) {
42902        openArray("endpoint");
42903        for (Reference e : element.getEndpoint()) 
42904          composeReference(null, e);
42905        closeArray();
42906      };
42907      if (element.hasNumberOfSeriesElement()) {
42908        composeUnsignedIntCore("numberOfSeries", element.getNumberOfSeriesElement(), false);
42909        composeUnsignedIntExtras("numberOfSeries", element.getNumberOfSeriesElement(), false);
42910      }
42911      if (element.hasNumberOfInstancesElement()) {
42912        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
42913        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
42914      }
42915      if (element.hasProcedureReference()) {
42916        composeReference("procedureReference", element.getProcedureReference());
42917      }
42918      if (element.hasProcedureCode()) {
42919        openArray("procedureCode");
42920        for (CodeableConcept e : element.getProcedureCode()) 
42921          composeCodeableConcept(null, e);
42922        closeArray();
42923      };
42924      if (element.hasLocation()) {
42925        composeReference("location", element.getLocation());
42926      }
42927      if (element.hasReasonCode()) {
42928        openArray("reasonCode");
42929        for (CodeableConcept e : element.getReasonCode()) 
42930          composeCodeableConcept(null, e);
42931        closeArray();
42932      };
42933      if (element.hasReasonReference()) {
42934        openArray("reasonReference");
42935        for (Reference e : element.getReasonReference()) 
42936          composeReference(null, e);
42937        closeArray();
42938      };
42939      if (element.hasNote()) {
42940        openArray("note");
42941        for (Annotation e : element.getNote()) 
42942          composeAnnotation(null, e);
42943        closeArray();
42944      };
42945      if (element.hasDescriptionElement()) {
42946        composeStringCore("description", element.getDescriptionElement(), false);
42947        composeStringExtras("description", element.getDescriptionElement(), false);
42948      }
42949      if (element.hasSeries()) {
42950        openArray("series");
42951        for (ImagingStudy.ImagingStudySeriesComponent e : element.getSeries()) 
42952          composeImagingStudyImagingStudySeriesComponent(null, e);
42953        closeArray();
42954      };
42955  }
42956
42957  protected void composeImagingStudyImagingStudySeriesComponent(String name, ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
42958    if (element != null) {
42959      open(name);
42960      composeImagingStudyImagingStudySeriesComponentInner(element);
42961      close();
42962    }
42963  }
42964
42965  protected void composeImagingStudyImagingStudySeriesComponentInner(ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
42966      composeBackbone(element);
42967      if (element.hasUidElement()) {
42968        composeIdCore("uid", element.getUidElement(), false);
42969        composeIdExtras("uid", element.getUidElement(), false);
42970      }
42971      if (element.hasNumberElement()) {
42972        composeUnsignedIntCore("number", element.getNumberElement(), false);
42973        composeUnsignedIntExtras("number", element.getNumberElement(), false);
42974      }
42975      if (element.hasModality()) {
42976        composeCoding("modality", element.getModality());
42977      }
42978      if (element.hasDescriptionElement()) {
42979        composeStringCore("description", element.getDescriptionElement(), false);
42980        composeStringExtras("description", element.getDescriptionElement(), false);
42981      }
42982      if (element.hasNumberOfInstancesElement()) {
42983        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
42984        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
42985      }
42986      if (element.hasEndpoint()) {
42987        openArray("endpoint");
42988        for (Reference e : element.getEndpoint()) 
42989          composeReference(null, e);
42990        closeArray();
42991      };
42992      if (element.hasBodySite()) {
42993        composeCoding("bodySite", element.getBodySite());
42994      }
42995      if (element.hasLaterality()) {
42996        composeCoding("laterality", element.getLaterality());
42997      }
42998      if (element.hasSpecimen()) {
42999        openArray("specimen");
43000        for (Reference e : element.getSpecimen()) 
43001          composeReference(null, e);
43002        closeArray();
43003      };
43004      if (element.hasStartedElement()) {
43005        composeDateTimeCore("started", element.getStartedElement(), false);
43006        composeDateTimeExtras("started", element.getStartedElement(), false);
43007      }
43008      if (element.hasPerformer()) {
43009        openArray("performer");
43010        for (ImagingStudy.ImagingStudySeriesPerformerComponent e : element.getPerformer()) 
43011          composeImagingStudyImagingStudySeriesPerformerComponent(null, e);
43012        closeArray();
43013      };
43014      if (element.hasInstance()) {
43015        openArray("instance");
43016        for (ImagingStudy.ImagingStudySeriesInstanceComponent e : element.getInstance()) 
43017          composeImagingStudyImagingStudySeriesInstanceComponent(null, e);
43018        closeArray();
43019      };
43020  }
43021
43022  protected void composeImagingStudyImagingStudySeriesPerformerComponent(String name, ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
43023    if (element != null) {
43024      open(name);
43025      composeImagingStudyImagingStudySeriesPerformerComponentInner(element);
43026      close();
43027    }
43028  }
43029
43030  protected void composeImagingStudyImagingStudySeriesPerformerComponentInner(ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
43031      composeBackbone(element);
43032      if (element.hasFunction()) {
43033        composeCodeableConcept("function", element.getFunction());
43034      }
43035      if (element.hasActor()) {
43036        composeReference("actor", element.getActor());
43037      }
43038  }
43039
43040  protected void composeImagingStudyImagingStudySeriesInstanceComponent(String name, ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
43041    if (element != null) {
43042      open(name);
43043      composeImagingStudyImagingStudySeriesInstanceComponentInner(element);
43044      close();
43045    }
43046  }
43047
43048  protected void composeImagingStudyImagingStudySeriesInstanceComponentInner(ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
43049      composeBackbone(element);
43050      if (element.hasUidElement()) {
43051        composeIdCore("uid", element.getUidElement(), false);
43052        composeIdExtras("uid", element.getUidElement(), false);
43053      }
43054      if (element.hasSopClass()) {
43055        composeCoding("sopClass", element.getSopClass());
43056      }
43057      if (element.hasNumberElement()) {
43058        composeUnsignedIntCore("number", element.getNumberElement(), false);
43059        composeUnsignedIntExtras("number", element.getNumberElement(), false);
43060      }
43061      if (element.hasTitleElement()) {
43062        composeStringCore("title", element.getTitleElement(), false);
43063        composeStringExtras("title", element.getTitleElement(), false);
43064      }
43065  }
43066
43067  protected void composeImmunization(String name, Immunization element) throws IOException {
43068    if (element != null) {
43069      prop("resourceType", name);
43070      composeImmunizationInner(element);
43071    }
43072  }
43073
43074  protected void composeImmunizationInner(Immunization element) throws IOException {
43075      composeDomainResourceElements(element);
43076      if (element.hasIdentifier()) {
43077        openArray("identifier");
43078        for (Identifier e : element.getIdentifier()) 
43079          composeIdentifier(null, e);
43080        closeArray();
43081      };
43082      if (element.hasStatusElement()) {
43083        composeEnumerationCore("status", element.getStatusElement(), new Immunization.ImmunizationStatusEnumFactory(), false);
43084        composeEnumerationExtras("status", element.getStatusElement(), new Immunization.ImmunizationStatusEnumFactory(), false);
43085      }
43086      if (element.hasStatusReason()) {
43087        composeCodeableConcept("statusReason", element.getStatusReason());
43088      }
43089      if (element.hasVaccineCode()) {
43090        composeCodeableConcept("vaccineCode", element.getVaccineCode());
43091      }
43092      if (element.hasPatient()) {
43093        composeReference("patient", element.getPatient());
43094      }
43095      if (element.hasEncounter()) {
43096        composeReference("encounter", element.getEncounter());
43097      }
43098      if (element.hasOccurrence()) {
43099        composeType("occurrence", element.getOccurrence());
43100      }
43101      if (element.hasRecordedElement()) {
43102        composeDateTimeCore("recorded", element.getRecordedElement(), false);
43103        composeDateTimeExtras("recorded", element.getRecordedElement(), false);
43104      }
43105      if (element.hasPrimarySourceElement()) {
43106        composeBooleanCore("primarySource", element.getPrimarySourceElement(), false);
43107        composeBooleanExtras("primarySource", element.getPrimarySourceElement(), false);
43108      }
43109      if (element.hasReportOrigin()) {
43110        composeCodeableConcept("reportOrigin", element.getReportOrigin());
43111      }
43112      if (element.hasLocation()) {
43113        composeReference("location", element.getLocation());
43114      }
43115      if (element.hasManufacturer()) {
43116        composeReference("manufacturer", element.getManufacturer());
43117      }
43118      if (element.hasLotNumberElement()) {
43119        composeStringCore("lotNumber", element.getLotNumberElement(), false);
43120        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
43121      }
43122      if (element.hasExpirationDateElement()) {
43123        composeDateCore("expirationDate", element.getExpirationDateElement(), false);
43124        composeDateExtras("expirationDate", element.getExpirationDateElement(), false);
43125      }
43126      if (element.hasSite()) {
43127        composeCodeableConcept("site", element.getSite());
43128      }
43129      if (element.hasRoute()) {
43130        composeCodeableConcept("route", element.getRoute());
43131      }
43132      if (element.hasDoseQuantity()) {
43133        composeQuantity("doseQuantity", element.getDoseQuantity());
43134      }
43135      if (element.hasPerformer()) {
43136        openArray("performer");
43137        for (Immunization.ImmunizationPerformerComponent e : element.getPerformer()) 
43138          composeImmunizationImmunizationPerformerComponent(null, e);
43139        closeArray();
43140      };
43141      if (element.hasNote()) {
43142        openArray("note");
43143        for (Annotation e : element.getNote()) 
43144          composeAnnotation(null, e);
43145        closeArray();
43146      };
43147      if (element.hasReasonCode()) {
43148        openArray("reasonCode");
43149        for (CodeableConcept e : element.getReasonCode()) 
43150          composeCodeableConcept(null, e);
43151        closeArray();
43152      };
43153      if (element.hasReasonReference()) {
43154        openArray("reasonReference");
43155        for (Reference e : element.getReasonReference()) 
43156          composeReference(null, e);
43157        closeArray();
43158      };
43159      if (element.hasIsSubpotentElement()) {
43160        composeBooleanCore("isSubpotent", element.getIsSubpotentElement(), false);
43161        composeBooleanExtras("isSubpotent", element.getIsSubpotentElement(), false);
43162      }
43163      if (element.hasSubpotentReason()) {
43164        openArray("subpotentReason");
43165        for (CodeableConcept e : element.getSubpotentReason()) 
43166          composeCodeableConcept(null, e);
43167        closeArray();
43168      };
43169      if (element.hasEducation()) {
43170        openArray("education");
43171        for (Immunization.ImmunizationEducationComponent e : element.getEducation()) 
43172          composeImmunizationImmunizationEducationComponent(null, e);
43173        closeArray();
43174      };
43175      if (element.hasProgramEligibility()) {
43176        openArray("programEligibility");
43177        for (CodeableConcept e : element.getProgramEligibility()) 
43178          composeCodeableConcept(null, e);
43179        closeArray();
43180      };
43181      if (element.hasFundingSource()) {
43182        composeCodeableConcept("fundingSource", element.getFundingSource());
43183      }
43184      if (element.hasReaction()) {
43185        openArray("reaction");
43186        for (Immunization.ImmunizationReactionComponent e : element.getReaction()) 
43187          composeImmunizationImmunizationReactionComponent(null, e);
43188        closeArray();
43189      };
43190      if (element.hasProtocolApplied()) {
43191        openArray("protocolApplied");
43192        for (Immunization.ImmunizationProtocolAppliedComponent e : element.getProtocolApplied()) 
43193          composeImmunizationImmunizationProtocolAppliedComponent(null, e);
43194        closeArray();
43195      };
43196  }
43197
43198  protected void composeImmunizationImmunizationPerformerComponent(String name, Immunization.ImmunizationPerformerComponent element) throws IOException {
43199    if (element != null) {
43200      open(name);
43201      composeImmunizationImmunizationPerformerComponentInner(element);
43202      close();
43203    }
43204  }
43205
43206  protected void composeImmunizationImmunizationPerformerComponentInner(Immunization.ImmunizationPerformerComponent element) throws IOException {
43207      composeBackbone(element);
43208      if (element.hasFunction()) {
43209        composeCodeableConcept("function", element.getFunction());
43210      }
43211      if (element.hasActor()) {
43212        composeReference("actor", element.getActor());
43213      }
43214  }
43215
43216  protected void composeImmunizationImmunizationEducationComponent(String name, Immunization.ImmunizationEducationComponent element) throws IOException {
43217    if (element != null) {
43218      open(name);
43219      composeImmunizationImmunizationEducationComponentInner(element);
43220      close();
43221    }
43222  }
43223
43224  protected void composeImmunizationImmunizationEducationComponentInner(Immunization.ImmunizationEducationComponent element) throws IOException {
43225      composeBackbone(element);
43226      if (element.hasDocumentTypeElement()) {
43227        composeStringCore("documentType", element.getDocumentTypeElement(), false);
43228        composeStringExtras("documentType", element.getDocumentTypeElement(), false);
43229      }
43230      if (element.hasReferenceElement()) {
43231        composeUriCore("reference", element.getReferenceElement(), false);
43232        composeUriExtras("reference", element.getReferenceElement(), false);
43233      }
43234      if (element.hasPublicationDateElement()) {
43235        composeDateTimeCore("publicationDate", element.getPublicationDateElement(), false);
43236        composeDateTimeExtras("publicationDate", element.getPublicationDateElement(), false);
43237      }
43238      if (element.hasPresentationDateElement()) {
43239        composeDateTimeCore("presentationDate", element.getPresentationDateElement(), false);
43240        composeDateTimeExtras("presentationDate", element.getPresentationDateElement(), false);
43241      }
43242  }
43243
43244  protected void composeImmunizationImmunizationReactionComponent(String name, Immunization.ImmunizationReactionComponent element) throws IOException {
43245    if (element != null) {
43246      open(name);
43247      composeImmunizationImmunizationReactionComponentInner(element);
43248      close();
43249    }
43250  }
43251
43252  protected void composeImmunizationImmunizationReactionComponentInner(Immunization.ImmunizationReactionComponent element) throws IOException {
43253      composeBackbone(element);
43254      if (element.hasDateElement()) {
43255        composeDateTimeCore("date", element.getDateElement(), false);
43256        composeDateTimeExtras("date", element.getDateElement(), false);
43257      }
43258      if (element.hasDetail()) {
43259        composeReference("detail", element.getDetail());
43260      }
43261      if (element.hasReportedElement()) {
43262        composeBooleanCore("reported", element.getReportedElement(), false);
43263        composeBooleanExtras("reported", element.getReportedElement(), false);
43264      }
43265  }
43266
43267  protected void composeImmunizationImmunizationProtocolAppliedComponent(String name, Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
43268    if (element != null) {
43269      open(name);
43270      composeImmunizationImmunizationProtocolAppliedComponentInner(element);
43271      close();
43272    }
43273  }
43274
43275  protected void composeImmunizationImmunizationProtocolAppliedComponentInner(Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
43276      composeBackbone(element);
43277      if (element.hasSeriesElement()) {
43278        composeStringCore("series", element.getSeriesElement(), false);
43279        composeStringExtras("series", element.getSeriesElement(), false);
43280      }
43281      if (element.hasAuthority()) {
43282        composeReference("authority", element.getAuthority());
43283      }
43284      if (element.hasTargetDisease()) {
43285        openArray("targetDisease");
43286        for (CodeableConcept e : element.getTargetDisease()) 
43287          composeCodeableConcept(null, e);
43288        closeArray();
43289      };
43290      if (element.hasDoseNumber()) {
43291        composeType("doseNumber", element.getDoseNumber());
43292      }
43293      if (element.hasSeriesDoses()) {
43294        composeType("seriesDoses", element.getSeriesDoses());
43295      }
43296  }
43297
43298  protected void composeImmunizationEvaluation(String name, ImmunizationEvaluation element) throws IOException {
43299    if (element != null) {
43300      prop("resourceType", name);
43301      composeImmunizationEvaluationInner(element);
43302    }
43303  }
43304
43305  protected void composeImmunizationEvaluationInner(ImmunizationEvaluation element) throws IOException {
43306      composeDomainResourceElements(element);
43307      if (element.hasIdentifier()) {
43308        openArray("identifier");
43309        for (Identifier e : element.getIdentifier()) 
43310          composeIdentifier(null, e);
43311        closeArray();
43312      };
43313      if (element.hasStatusElement()) {
43314        composeEnumerationCore("status", element.getStatusElement(), new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory(), false);
43315        composeEnumerationExtras("status", element.getStatusElement(), new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory(), false);
43316      }
43317      if (element.hasPatient()) {
43318        composeReference("patient", element.getPatient());
43319      }
43320      if (element.hasDateElement()) {
43321        composeDateTimeCore("date", element.getDateElement(), false);
43322        composeDateTimeExtras("date", element.getDateElement(), false);
43323      }
43324      if (element.hasAuthority()) {
43325        composeReference("authority", element.getAuthority());
43326      }
43327      if (element.hasTargetDisease()) {
43328        composeCodeableConcept("targetDisease", element.getTargetDisease());
43329      }
43330      if (element.hasImmunizationEvent()) {
43331        composeReference("immunizationEvent", element.getImmunizationEvent());
43332      }
43333      if (element.hasDoseStatus()) {
43334        composeCodeableConcept("doseStatus", element.getDoseStatus());
43335      }
43336      if (element.hasDoseStatusReason()) {
43337        openArray("doseStatusReason");
43338        for (CodeableConcept e : element.getDoseStatusReason()) 
43339          composeCodeableConcept(null, e);
43340        closeArray();
43341      };
43342      if (element.hasDescriptionElement()) {
43343        composeStringCore("description", element.getDescriptionElement(), false);
43344        composeStringExtras("description", element.getDescriptionElement(), false);
43345      }
43346      if (element.hasSeriesElement()) {
43347        composeStringCore("series", element.getSeriesElement(), false);
43348        composeStringExtras("series", element.getSeriesElement(), false);
43349      }
43350      if (element.hasDoseNumber()) {
43351        composeType("doseNumber", element.getDoseNumber());
43352      }
43353      if (element.hasSeriesDoses()) {
43354        composeType("seriesDoses", element.getSeriesDoses());
43355      }
43356  }
43357
43358  protected void composeImmunizationRecommendation(String name, ImmunizationRecommendation element) throws IOException {
43359    if (element != null) {
43360      prop("resourceType", name);
43361      composeImmunizationRecommendationInner(element);
43362    }
43363  }
43364
43365  protected void composeImmunizationRecommendationInner(ImmunizationRecommendation element) throws IOException {
43366      composeDomainResourceElements(element);
43367      if (element.hasIdentifier()) {
43368        openArray("identifier");
43369        for (Identifier e : element.getIdentifier()) 
43370          composeIdentifier(null, e);
43371        closeArray();
43372      };
43373      if (element.hasPatient()) {
43374        composeReference("patient", element.getPatient());
43375      }
43376      if (element.hasDateElement()) {
43377        composeDateTimeCore("date", element.getDateElement(), false);
43378        composeDateTimeExtras("date", element.getDateElement(), false);
43379      }
43380      if (element.hasAuthority()) {
43381        composeReference("authority", element.getAuthority());
43382      }
43383      if (element.hasRecommendation()) {
43384        openArray("recommendation");
43385        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent e : element.getRecommendation()) 
43386          composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(null, e);
43387        closeArray();
43388      };
43389  }
43390
43391  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
43392    if (element != null) {
43393      open(name);
43394      composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(element);
43395      close();
43396    }
43397  }
43398
43399  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
43400      composeBackbone(element);
43401      if (element.hasVaccineCode()) {
43402        openArray("vaccineCode");
43403        for (CodeableConcept e : element.getVaccineCode()) 
43404          composeCodeableConcept(null, e);
43405        closeArray();
43406      };
43407      if (element.hasTargetDisease()) {
43408        composeCodeableConcept("targetDisease", element.getTargetDisease());
43409      }
43410      if (element.hasContraindicatedVaccineCode()) {
43411        openArray("contraindicatedVaccineCode");
43412        for (CodeableConcept e : element.getContraindicatedVaccineCode()) 
43413          composeCodeableConcept(null, e);
43414        closeArray();
43415      };
43416      if (element.hasForecastStatus()) {
43417        composeCodeableConcept("forecastStatus", element.getForecastStatus());
43418      }
43419      if (element.hasForecastReason()) {
43420        openArray("forecastReason");
43421        for (CodeableConcept e : element.getForecastReason()) 
43422          composeCodeableConcept(null, e);
43423        closeArray();
43424      };
43425      if (element.hasDateCriterion()) {
43426        openArray("dateCriterion");
43427        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent e : element.getDateCriterion()) 
43428          composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(null, e);
43429        closeArray();
43430      };
43431      if (element.hasDescriptionElement()) {
43432        composeStringCore("description", element.getDescriptionElement(), false);
43433        composeStringExtras("description", element.getDescriptionElement(), false);
43434      }
43435      if (element.hasSeriesElement()) {
43436        composeStringCore("series", element.getSeriesElement(), false);
43437        composeStringExtras("series", element.getSeriesElement(), false);
43438      }
43439      if (element.hasDoseNumber()) {
43440        composeType("doseNumber", element.getDoseNumber());
43441      }
43442      if (element.hasSeriesDoses()) {
43443        composeType("seriesDoses", element.getSeriesDoses());
43444      }
43445      if (element.hasSupportingImmunization()) {
43446        openArray("supportingImmunization");
43447        for (Reference e : element.getSupportingImmunization()) 
43448          composeReference(null, e);
43449        closeArray();
43450      };
43451      if (element.hasSupportingPatientInformation()) {
43452        openArray("supportingPatientInformation");
43453        for (Reference e : element.getSupportingPatientInformation()) 
43454          composeReference(null, e);
43455        closeArray();
43456      };
43457  }
43458
43459  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
43460    if (element != null) {
43461      open(name);
43462      composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(element);
43463      close();
43464    }
43465  }
43466
43467  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
43468      composeBackbone(element);
43469      if (element.hasCode()) {
43470        composeCodeableConcept("code", element.getCode());
43471      }
43472      if (element.hasValueElement()) {
43473        composeDateTimeCore("value", element.getValueElement(), false);
43474        composeDateTimeExtras("value", element.getValueElement(), false);
43475      }
43476  }
43477
43478  protected void composeImplementationGuide(String name, ImplementationGuide element) throws IOException {
43479    if (element != null) {
43480      prop("resourceType", name);
43481      composeImplementationGuideInner(element);
43482    }
43483  }
43484
43485  protected void composeImplementationGuideInner(ImplementationGuide element) throws IOException {
43486      composeDomainResourceElements(element);
43487      if (element.hasUrlElement()) {
43488        composeUriCore("url", element.getUrlElement(), false);
43489        composeUriExtras("url", element.getUrlElement(), false);
43490      }
43491      if (element.hasVersionElement()) {
43492        composeStringCore("version", element.getVersionElement(), false);
43493        composeStringExtras("version", element.getVersionElement(), false);
43494      }
43495      if (element.hasNameElement()) {
43496        composeStringCore("name", element.getNameElement(), false);
43497        composeStringExtras("name", element.getNameElement(), false);
43498      }
43499      if (element.hasTitleElement()) {
43500        composeStringCore("title", element.getTitleElement(), false);
43501        composeStringExtras("title", element.getTitleElement(), false);
43502      }
43503      if (element.hasStatusElement()) {
43504        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43505        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43506      }
43507      if (element.hasExperimentalElement()) {
43508        composeBooleanCore("experimental", element.getExperimentalElement(), false);
43509        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
43510      }
43511      if (element.hasDateElement()) {
43512        composeDateTimeCore("date", element.getDateElement(), false);
43513        composeDateTimeExtras("date", element.getDateElement(), false);
43514      }
43515      if (element.hasPublisherElement()) {
43516        composeStringCore("publisher", element.getPublisherElement(), false);
43517        composeStringExtras("publisher", element.getPublisherElement(), false);
43518      }
43519      if (element.hasContact()) {
43520        openArray("contact");
43521        for (ContactDetail e : element.getContact()) 
43522          composeContactDetail(null, e);
43523        closeArray();
43524      };
43525      if (element.hasDescriptionElement()) {
43526        composeMarkdownCore("description", element.getDescriptionElement(), false);
43527        composeMarkdownExtras("description", element.getDescriptionElement(), false);
43528      }
43529      if (element.hasUseContext()) {
43530        openArray("useContext");
43531        for (UsageContext e : element.getUseContext()) 
43532          composeUsageContext(null, e);
43533        closeArray();
43534      };
43535      if (element.hasJurisdiction()) {
43536        openArray("jurisdiction");
43537        for (CodeableConcept e : element.getJurisdiction()) 
43538          composeCodeableConcept(null, e);
43539        closeArray();
43540      };
43541      if (element.hasCopyrightElement()) {
43542        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
43543        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
43544      }
43545      if (element.hasPackageIdElement()) {
43546        composeIdCore("packageId", element.getPackageIdElement(), false);
43547        composeIdExtras("packageId", element.getPackageIdElement(), false);
43548      }
43549      if (element.hasLicenseElement()) {
43550        composeEnumerationCore("license", element.getLicenseElement(), new ImplementationGuide.SPDXLicenseEnumFactory(), false);
43551        composeEnumerationExtras("license", element.getLicenseElement(), new ImplementationGuide.SPDXLicenseEnumFactory(), false);
43552      }
43553      if (element.hasFhirVersion()) {
43554        openArray("fhirVersion");
43555        for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
43556          composeEnumerationCore(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
43557        closeArray();
43558        if (anyHasExtras(element.getFhirVersion())) {
43559          openArray("_fhirVersion");
43560          for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
43561            composeEnumerationExtras(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
43562          closeArray();
43563        }
43564      };
43565      if (element.hasDependsOn()) {
43566        openArray("dependsOn");
43567        for (ImplementationGuide.ImplementationGuideDependsOnComponent e : element.getDependsOn()) 
43568          composeImplementationGuideImplementationGuideDependsOnComponent(null, e);
43569        closeArray();
43570      };
43571      if (element.hasGlobal()) {
43572        openArray("global");
43573        for (ImplementationGuide.ImplementationGuideGlobalComponent e : element.getGlobal()) 
43574          composeImplementationGuideImplementationGuideGlobalComponent(null, e);
43575        closeArray();
43576      };
43577      if (element.hasDefinition()) {
43578        composeImplementationGuideImplementationGuideDefinitionComponent("definition", element.getDefinition());
43579      }
43580      if (element.hasManifest()) {
43581        composeImplementationGuideImplementationGuideManifestComponent("manifest", element.getManifest());
43582      }
43583  }
43584
43585  protected void composeImplementationGuideImplementationGuideDependsOnComponent(String name, ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
43586    if (element != null) {
43587      open(name);
43588      composeImplementationGuideImplementationGuideDependsOnComponentInner(element);
43589      close();
43590    }
43591  }
43592
43593  protected void composeImplementationGuideImplementationGuideDependsOnComponentInner(ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
43594      composeBackbone(element);
43595      if (element.hasUriElement()) {
43596        composeCanonicalCore("uri", element.getUriElement(), false);
43597        composeCanonicalExtras("uri", element.getUriElement(), false);
43598      }
43599      if (element.hasPackageIdElement()) {
43600        composeIdCore("packageId", element.getPackageIdElement(), false);
43601        composeIdExtras("packageId", element.getPackageIdElement(), false);
43602      }
43603      if (element.hasVersionElement()) {
43604        composeStringCore("version", element.getVersionElement(), false);
43605        composeStringExtras("version", element.getVersionElement(), false);
43606      }
43607  }
43608
43609  protected void composeImplementationGuideImplementationGuideGlobalComponent(String name, ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
43610    if (element != null) {
43611      open(name);
43612      composeImplementationGuideImplementationGuideGlobalComponentInner(element);
43613      close();
43614    }
43615  }
43616
43617  protected void composeImplementationGuideImplementationGuideGlobalComponentInner(ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
43618      composeBackbone(element);
43619      if (element.hasTypeElement()) {
43620        composeCodeCore("type", element.getTypeElement(), false);
43621        composeCodeExtras("type", element.getTypeElement(), false);
43622      }
43623      if (element.hasProfileElement()) {
43624        composeCanonicalCore("profile", element.getProfileElement(), false);
43625        composeCanonicalExtras("profile", element.getProfileElement(), false);
43626      }
43627  }
43628
43629  protected void composeImplementationGuideImplementationGuideDefinitionComponent(String name, ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
43630    if (element != null) {
43631      open(name);
43632      composeImplementationGuideImplementationGuideDefinitionComponentInner(element);
43633      close();
43634    }
43635  }
43636
43637  protected void composeImplementationGuideImplementationGuideDefinitionComponentInner(ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
43638      composeBackbone(element);
43639      if (element.hasGrouping()) {
43640        openArray("grouping");
43641        for (ImplementationGuide.ImplementationGuideDefinitionGroupingComponent e : element.getGrouping()) 
43642          composeImplementationGuideImplementationGuideDefinitionGroupingComponent(null, e);
43643        closeArray();
43644      };
43645      if (element.hasResource()) {
43646        openArray("resource");
43647        for (ImplementationGuide.ImplementationGuideDefinitionResourceComponent e : element.getResource()) 
43648          composeImplementationGuideImplementationGuideDefinitionResourceComponent(null, e);
43649        closeArray();
43650      };
43651      if (element.hasPage()) {
43652        composeImplementationGuideImplementationGuideDefinitionPageComponent("page", element.getPage());
43653      }
43654      if (element.hasParameter()) {
43655        openArray("parameter");
43656        for (ImplementationGuide.ImplementationGuideDefinitionParameterComponent e : element.getParameter()) 
43657          composeImplementationGuideImplementationGuideDefinitionParameterComponent(null, e);
43658        closeArray();
43659      };
43660      if (element.hasTemplate()) {
43661        openArray("template");
43662        for (ImplementationGuide.ImplementationGuideDefinitionTemplateComponent e : element.getTemplate()) 
43663          composeImplementationGuideImplementationGuideDefinitionTemplateComponent(null, e);
43664        closeArray();
43665      };
43666  }
43667
43668  protected void composeImplementationGuideImplementationGuideDefinitionGroupingComponent(String name, ImplementationGuide.ImplementationGuideDefinitionGroupingComponent element) throws IOException {
43669    if (element != null) {
43670      open(name);
43671      composeImplementationGuideImplementationGuideDefinitionGroupingComponentInner(element);
43672      close();
43673    }
43674  }
43675
43676  protected void composeImplementationGuideImplementationGuideDefinitionGroupingComponentInner(ImplementationGuide.ImplementationGuideDefinitionGroupingComponent element) throws IOException {
43677      composeBackbone(element);
43678      if (element.hasNameElement()) {
43679        composeStringCore("name", element.getNameElement(), false);
43680        composeStringExtras("name", element.getNameElement(), false);
43681      }
43682      if (element.hasDescriptionElement()) {
43683        composeStringCore("description", element.getDescriptionElement(), false);
43684        composeStringExtras("description", element.getDescriptionElement(), false);
43685      }
43686  }
43687
43688  protected void composeImplementationGuideImplementationGuideDefinitionResourceComponent(String name, ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
43689    if (element != null) {
43690      open(name);
43691      composeImplementationGuideImplementationGuideDefinitionResourceComponentInner(element);
43692      close();
43693    }
43694  }
43695
43696  protected void composeImplementationGuideImplementationGuideDefinitionResourceComponentInner(ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
43697      composeBackbone(element);
43698      if (element.hasReference()) {
43699        composeReference("reference", element.getReference());
43700      }
43701      if (element.hasFhirVersion()) {
43702        openArray("fhirVersion");
43703        for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
43704          composeEnumerationCore(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
43705        closeArray();
43706        if (anyHasExtras(element.getFhirVersion())) {
43707          openArray("_fhirVersion");
43708          for (Enumeration<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
43709            composeEnumerationExtras(null, e, new Enumerations.FHIRVersionEnumFactory(), true);
43710          closeArray();
43711        }
43712      };
43713      if (element.hasNameElement()) {
43714        composeStringCore("name", element.getNameElement(), false);
43715        composeStringExtras("name", element.getNameElement(), false);
43716      }
43717      if (element.hasDescriptionElement()) {
43718        composeStringCore("description", element.getDescriptionElement(), false);
43719        composeStringExtras("description", element.getDescriptionElement(), false);
43720      }
43721      if (element.hasExample()) {
43722        composeType("example", element.getExample());
43723      }
43724      if (element.hasGroupingIdElement()) {
43725        composeIdCore("groupingId", element.getGroupingIdElement(), false);
43726        composeIdExtras("groupingId", element.getGroupingIdElement(), false);
43727      }
43728  }
43729
43730  protected void composeImplementationGuideImplementationGuideDefinitionPageComponent(String name, ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
43731    if (element != null) {
43732      open(name);
43733      composeImplementationGuideImplementationGuideDefinitionPageComponentInner(element);
43734      close();
43735    }
43736  }
43737
43738  protected void composeImplementationGuideImplementationGuideDefinitionPageComponentInner(ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
43739      composeBackbone(element);
43740      if (element.hasName()) {
43741        composeType("name", element.getName());
43742      }
43743      if (element.hasTitleElement()) {
43744        composeStringCore("title", element.getTitleElement(), false);
43745        composeStringExtras("title", element.getTitleElement(), false);
43746      }
43747      if (element.hasGenerationElement()) {
43748        composeEnumerationCore("generation", element.getGenerationElement(), new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
43749        composeEnumerationExtras("generation", element.getGenerationElement(), new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
43750      }
43751      if (element.hasPage()) {
43752        openArray("page");
43753        for (ImplementationGuide.ImplementationGuideDefinitionPageComponent e : element.getPage()) 
43754          composeImplementationGuideImplementationGuideDefinitionPageComponent(null, e);
43755        closeArray();
43756      };
43757  }
43758
43759  protected void composeImplementationGuideImplementationGuideDefinitionParameterComponent(String name, ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
43760    if (element != null) {
43761      open(name);
43762      composeImplementationGuideImplementationGuideDefinitionParameterComponentInner(element);
43763      close();
43764    }
43765  }
43766
43767  protected void composeImplementationGuideImplementationGuideDefinitionParameterComponentInner(ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
43768      composeBackbone(element);
43769      if (element.hasCodeElement()) {
43770        composeStringCore("code", element.getCodeElement(), false);
43771        composeStringExtras("code", element.getCodeElement(), false);
43772      }
43773      if (element.hasValueElement()) {
43774        composeStringCore("value", element.getValueElement(), false);
43775        composeStringExtras("value", element.getValueElement(), false);
43776      }
43777  }
43778
43779  protected void composeImplementationGuideImplementationGuideDefinitionTemplateComponent(String name, ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
43780    if (element != null) {
43781      open(name);
43782      composeImplementationGuideImplementationGuideDefinitionTemplateComponentInner(element);
43783      close();
43784    }
43785  }
43786
43787  protected void composeImplementationGuideImplementationGuideDefinitionTemplateComponentInner(ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
43788      composeBackbone(element);
43789      if (element.hasCodeElement()) {
43790        composeCodeCore("code", element.getCodeElement(), false);
43791        composeCodeExtras("code", element.getCodeElement(), false);
43792      }
43793      if (element.hasSourceElement()) {
43794        composeStringCore("source", element.getSourceElement(), false);
43795        composeStringExtras("source", element.getSourceElement(), false);
43796      }
43797      if (element.hasScopeElement()) {
43798        composeStringCore("scope", element.getScopeElement(), false);
43799        composeStringExtras("scope", element.getScopeElement(), false);
43800      }
43801  }
43802
43803  protected void composeImplementationGuideImplementationGuideManifestComponent(String name, ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
43804    if (element != null) {
43805      open(name);
43806      composeImplementationGuideImplementationGuideManifestComponentInner(element);
43807      close();
43808    }
43809  }
43810
43811  protected void composeImplementationGuideImplementationGuideManifestComponentInner(ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
43812      composeBackbone(element);
43813      if (element.hasRenderingElement()) {
43814        composeUrlCore("rendering", element.getRenderingElement(), false);
43815        composeUrlExtras("rendering", element.getRenderingElement(), false);
43816      }
43817      if (element.hasResource()) {
43818        openArray("resource");
43819        for (ImplementationGuide.ManifestResourceComponent e : element.getResource()) 
43820          composeImplementationGuideManifestResourceComponent(null, e);
43821        closeArray();
43822      };
43823      if (element.hasPage()) {
43824        openArray("page");
43825        for (ImplementationGuide.ManifestPageComponent e : element.getPage()) 
43826          composeImplementationGuideManifestPageComponent(null, e);
43827        closeArray();
43828      };
43829      if (element.hasImage()) {
43830        openArray("image");
43831        for (StringType e : element.getImage()) 
43832          composeStringCore(null, e, true);
43833        closeArray();
43834        if (anyHasExtras(element.getImage())) {
43835          openArray("_image");
43836          for (StringType e : element.getImage()) 
43837            composeStringExtras(null, e, true);
43838          closeArray();
43839        }
43840      };
43841      if (element.hasOther()) {
43842        openArray("other");
43843        for (StringType e : element.getOther()) 
43844          composeStringCore(null, e, true);
43845        closeArray();
43846        if (anyHasExtras(element.getOther())) {
43847          openArray("_other");
43848          for (StringType e : element.getOther()) 
43849            composeStringExtras(null, e, true);
43850          closeArray();
43851        }
43852      };
43853  }
43854
43855  protected void composeImplementationGuideManifestResourceComponent(String name, ImplementationGuide.ManifestResourceComponent element) throws IOException {
43856    if (element != null) {
43857      open(name);
43858      composeImplementationGuideManifestResourceComponentInner(element);
43859      close();
43860    }
43861  }
43862
43863  protected void composeImplementationGuideManifestResourceComponentInner(ImplementationGuide.ManifestResourceComponent element) throws IOException {
43864      composeBackbone(element);
43865      if (element.hasReference()) {
43866        composeReference("reference", element.getReference());
43867      }
43868      if (element.hasExample()) {
43869        composeType("example", element.getExample());
43870      }
43871      if (element.hasRelativePathElement()) {
43872        composeUrlCore("relativePath", element.getRelativePathElement(), false);
43873        composeUrlExtras("relativePath", element.getRelativePathElement(), false);
43874      }
43875  }
43876
43877  protected void composeImplementationGuideManifestPageComponent(String name, ImplementationGuide.ManifestPageComponent element) throws IOException {
43878    if (element != null) {
43879      open(name);
43880      composeImplementationGuideManifestPageComponentInner(element);
43881      close();
43882    }
43883  }
43884
43885  protected void composeImplementationGuideManifestPageComponentInner(ImplementationGuide.ManifestPageComponent element) throws IOException {
43886      composeBackbone(element);
43887      if (element.hasNameElement()) {
43888        composeStringCore("name", element.getNameElement(), false);
43889        composeStringExtras("name", element.getNameElement(), false);
43890      }
43891      if (element.hasTitleElement()) {
43892        composeStringCore("title", element.getTitleElement(), false);
43893        composeStringExtras("title", element.getTitleElement(), false);
43894      }
43895      if (element.hasAnchor()) {
43896        openArray("anchor");
43897        for (StringType e : element.getAnchor()) 
43898          composeStringCore(null, e, true);
43899        closeArray();
43900        if (anyHasExtras(element.getAnchor())) {
43901          openArray("_anchor");
43902          for (StringType e : element.getAnchor()) 
43903            composeStringExtras(null, e, true);
43904          closeArray();
43905        }
43906      };
43907  }
43908
43909  protected void composeInsurancePlan(String name, InsurancePlan element) throws IOException {
43910    if (element != null) {
43911      prop("resourceType", name);
43912      composeInsurancePlanInner(element);
43913    }
43914  }
43915
43916  protected void composeInsurancePlanInner(InsurancePlan element) throws IOException {
43917      composeDomainResourceElements(element);
43918      if (element.hasIdentifier()) {
43919        openArray("identifier");
43920        for (Identifier e : element.getIdentifier()) 
43921          composeIdentifier(null, e);
43922        closeArray();
43923      };
43924      if (element.hasStatusElement()) {
43925        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43926        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
43927      }
43928      if (element.hasType()) {
43929        openArray("type");
43930        for (CodeableConcept e : element.getType()) 
43931          composeCodeableConcept(null, e);
43932        closeArray();
43933      };
43934      if (element.hasNameElement()) {
43935        composeStringCore("name", element.getNameElement(), false);
43936        composeStringExtras("name", element.getNameElement(), false);
43937      }
43938      if (element.hasAlias()) {
43939        openArray("alias");
43940        for (StringType e : element.getAlias()) 
43941          composeStringCore(null, e, true);
43942        closeArray();
43943        if (anyHasExtras(element.getAlias())) {
43944          openArray("_alias");
43945          for (StringType e : element.getAlias()) 
43946            composeStringExtras(null, e, true);
43947          closeArray();
43948        }
43949      };
43950      if (element.hasPeriod()) {
43951        composePeriod("period", element.getPeriod());
43952      }
43953      if (element.hasOwnedBy()) {
43954        composeReference("ownedBy", element.getOwnedBy());
43955      }
43956      if (element.hasAdministeredBy()) {
43957        composeReference("administeredBy", element.getAdministeredBy());
43958      }
43959      if (element.hasCoverageArea()) {
43960        openArray("coverageArea");
43961        for (Reference e : element.getCoverageArea()) 
43962          composeReference(null, e);
43963        closeArray();
43964      };
43965      if (element.hasContact()) {
43966        openArray("contact");
43967        for (InsurancePlan.InsurancePlanContactComponent e : element.getContact()) 
43968          composeInsurancePlanInsurancePlanContactComponent(null, e);
43969        closeArray();
43970      };
43971      if (element.hasEndpoint()) {
43972        openArray("endpoint");
43973        for (Reference e : element.getEndpoint()) 
43974          composeReference(null, e);
43975        closeArray();
43976      };
43977      if (element.hasNetwork()) {
43978        openArray("network");
43979        for (Reference e : element.getNetwork()) 
43980          composeReference(null, e);
43981        closeArray();
43982      };
43983      if (element.hasCoverage()) {
43984        openArray("coverage");
43985        for (InsurancePlan.InsurancePlanCoverageComponent e : element.getCoverage()) 
43986          composeInsurancePlanInsurancePlanCoverageComponent(null, e);
43987        closeArray();
43988      };
43989      if (element.hasPlan()) {
43990        openArray("plan");
43991        for (InsurancePlan.InsurancePlanPlanComponent e : element.getPlan()) 
43992          composeInsurancePlanInsurancePlanPlanComponent(null, e);
43993        closeArray();
43994      };
43995  }
43996
43997  protected void composeInsurancePlanInsurancePlanContactComponent(String name, InsurancePlan.InsurancePlanContactComponent element) throws IOException {
43998    if (element != null) {
43999      open(name);
44000      composeInsurancePlanInsurancePlanContactComponentInner(element);
44001      close();
44002    }
44003  }
44004
44005  protected void composeInsurancePlanInsurancePlanContactComponentInner(InsurancePlan.InsurancePlanContactComponent element) throws IOException {
44006      composeBackbone(element);
44007      if (element.hasPurpose()) {
44008        composeCodeableConcept("purpose", element.getPurpose());
44009      }
44010      if (element.hasName()) {
44011        composeHumanName("name", element.getName());
44012      }
44013      if (element.hasTelecom()) {
44014        openArray("telecom");
44015        for (ContactPoint e : element.getTelecom()) 
44016          composeContactPoint(null, e);
44017        closeArray();
44018      };
44019      if (element.hasAddress()) {
44020        composeAddress("address", element.getAddress());
44021      }
44022  }
44023
44024  protected void composeInsurancePlanInsurancePlanCoverageComponent(String name, InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
44025    if (element != null) {
44026      open(name);
44027      composeInsurancePlanInsurancePlanCoverageComponentInner(element);
44028      close();
44029    }
44030  }
44031
44032  protected void composeInsurancePlanInsurancePlanCoverageComponentInner(InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
44033      composeBackbone(element);
44034      if (element.hasType()) {
44035        composeCodeableConcept("type", element.getType());
44036      }
44037      if (element.hasNetwork()) {
44038        openArray("network");
44039        for (Reference e : element.getNetwork()) 
44040          composeReference(null, e);
44041        closeArray();
44042      };
44043      if (element.hasBenefit()) {
44044        openArray("benefit");
44045        for (InsurancePlan.CoverageBenefitComponent e : element.getBenefit()) 
44046          composeInsurancePlanCoverageBenefitComponent(null, e);
44047        closeArray();
44048      };
44049  }
44050
44051  protected void composeInsurancePlanCoverageBenefitComponent(String name, InsurancePlan.CoverageBenefitComponent element) throws IOException {
44052    if (element != null) {
44053      open(name);
44054      composeInsurancePlanCoverageBenefitComponentInner(element);
44055      close();
44056    }
44057  }
44058
44059  protected void composeInsurancePlanCoverageBenefitComponentInner(InsurancePlan.CoverageBenefitComponent element) throws IOException {
44060      composeBackbone(element);
44061      if (element.hasType()) {
44062        composeCodeableConcept("type", element.getType());
44063      }
44064      if (element.hasRequirementElement()) {
44065        composeStringCore("requirement", element.getRequirementElement(), false);
44066        composeStringExtras("requirement", element.getRequirementElement(), false);
44067      }
44068      if (element.hasLimit()) {
44069        openArray("limit");
44070        for (InsurancePlan.CoverageBenefitLimitComponent e : element.getLimit()) 
44071          composeInsurancePlanCoverageBenefitLimitComponent(null, e);
44072        closeArray();
44073      };
44074  }
44075
44076  protected void composeInsurancePlanCoverageBenefitLimitComponent(String name, InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
44077    if (element != null) {
44078      open(name);
44079      composeInsurancePlanCoverageBenefitLimitComponentInner(element);
44080      close();
44081    }
44082  }
44083
44084  protected void composeInsurancePlanCoverageBenefitLimitComponentInner(InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
44085      composeBackbone(element);
44086      if (element.hasValue()) {
44087        composeQuantity("value", element.getValue());
44088      }
44089      if (element.hasCode()) {
44090        composeCodeableConcept("code", element.getCode());
44091      }
44092  }
44093
44094  protected void composeInsurancePlanInsurancePlanPlanComponent(String name, InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
44095    if (element != null) {
44096      open(name);
44097      composeInsurancePlanInsurancePlanPlanComponentInner(element);
44098      close();
44099    }
44100  }
44101
44102  protected void composeInsurancePlanInsurancePlanPlanComponentInner(InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
44103      composeBackbone(element);
44104      if (element.hasIdentifier()) {
44105        openArray("identifier");
44106        for (Identifier e : element.getIdentifier()) 
44107          composeIdentifier(null, e);
44108        closeArray();
44109      };
44110      if (element.hasType()) {
44111        composeCodeableConcept("type", element.getType());
44112      }
44113      if (element.hasCoverageArea()) {
44114        openArray("coverageArea");
44115        for (Reference e : element.getCoverageArea()) 
44116          composeReference(null, e);
44117        closeArray();
44118      };
44119      if (element.hasNetwork()) {
44120        openArray("network");
44121        for (Reference e : element.getNetwork()) 
44122          composeReference(null, e);
44123        closeArray();
44124      };
44125      if (element.hasGeneralCost()) {
44126        openArray("generalCost");
44127        for (InsurancePlan.InsurancePlanPlanGeneralCostComponent e : element.getGeneralCost()) 
44128          composeInsurancePlanInsurancePlanPlanGeneralCostComponent(null, e);
44129        closeArray();
44130      };
44131      if (element.hasSpecificCost()) {
44132        openArray("specificCost");
44133        for (InsurancePlan.InsurancePlanPlanSpecificCostComponent e : element.getSpecificCost()) 
44134          composeInsurancePlanInsurancePlanPlanSpecificCostComponent(null, e);
44135        closeArray();
44136      };
44137  }
44138
44139  protected void composeInsurancePlanInsurancePlanPlanGeneralCostComponent(String name, InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
44140    if (element != null) {
44141      open(name);
44142      composeInsurancePlanInsurancePlanPlanGeneralCostComponentInner(element);
44143      close();
44144    }
44145  }
44146
44147  protected void composeInsurancePlanInsurancePlanPlanGeneralCostComponentInner(InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
44148      composeBackbone(element);
44149      if (element.hasType()) {
44150        composeCodeableConcept("type", element.getType());
44151      }
44152      if (element.hasGroupSizeElement()) {
44153        composePositiveIntCore("groupSize", element.getGroupSizeElement(), false);
44154        composePositiveIntExtras("groupSize", element.getGroupSizeElement(), false);
44155      }
44156      if (element.hasCost()) {
44157        composeMoney("cost", element.getCost());
44158      }
44159      if (element.hasCommentElement()) {
44160        composeStringCore("comment", element.getCommentElement(), false);
44161        composeStringExtras("comment", element.getCommentElement(), false);
44162      }
44163  }
44164
44165  protected void composeInsurancePlanInsurancePlanPlanSpecificCostComponent(String name, InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
44166    if (element != null) {
44167      open(name);
44168      composeInsurancePlanInsurancePlanPlanSpecificCostComponentInner(element);
44169      close();
44170    }
44171  }
44172
44173  protected void composeInsurancePlanInsurancePlanPlanSpecificCostComponentInner(InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
44174      composeBackbone(element);
44175      if (element.hasCategory()) {
44176        composeCodeableConcept("category", element.getCategory());
44177      }
44178      if (element.hasBenefit()) {
44179        openArray("benefit");
44180        for (InsurancePlan.PlanBenefitComponent e : element.getBenefit()) 
44181          composeInsurancePlanPlanBenefitComponent(null, e);
44182        closeArray();
44183      };
44184  }
44185
44186  protected void composeInsurancePlanPlanBenefitComponent(String name, InsurancePlan.PlanBenefitComponent element) throws IOException {
44187    if (element != null) {
44188      open(name);
44189      composeInsurancePlanPlanBenefitComponentInner(element);
44190      close();
44191    }
44192  }
44193
44194  protected void composeInsurancePlanPlanBenefitComponentInner(InsurancePlan.PlanBenefitComponent element) throws IOException {
44195      composeBackbone(element);
44196      if (element.hasType()) {
44197        composeCodeableConcept("type", element.getType());
44198      }
44199      if (element.hasCost()) {
44200        openArray("cost");
44201        for (InsurancePlan.PlanBenefitCostComponent e : element.getCost()) 
44202          composeInsurancePlanPlanBenefitCostComponent(null, e);
44203        closeArray();
44204      };
44205  }
44206
44207  protected void composeInsurancePlanPlanBenefitCostComponent(String name, InsurancePlan.PlanBenefitCostComponent element) throws IOException {
44208    if (element != null) {
44209      open(name);
44210      composeInsurancePlanPlanBenefitCostComponentInner(element);
44211      close();
44212    }
44213  }
44214
44215  protected void composeInsurancePlanPlanBenefitCostComponentInner(InsurancePlan.PlanBenefitCostComponent element) throws IOException {
44216      composeBackbone(element);
44217      if (element.hasType()) {
44218        composeCodeableConcept("type", element.getType());
44219      }
44220      if (element.hasApplicability()) {
44221        composeCodeableConcept("applicability", element.getApplicability());
44222      }
44223      if (element.hasQualifiers()) {
44224        openArray("qualifiers");
44225        for (CodeableConcept e : element.getQualifiers()) 
44226          composeCodeableConcept(null, e);
44227        closeArray();
44228      };
44229      if (element.hasValue()) {
44230        composeQuantity("value", element.getValue());
44231      }
44232  }
44233
44234  protected void composeInvoice(String name, Invoice element) throws IOException {
44235    if (element != null) {
44236      prop("resourceType", name);
44237      composeInvoiceInner(element);
44238    }
44239  }
44240
44241  protected void composeInvoiceInner(Invoice element) throws IOException {
44242      composeDomainResourceElements(element);
44243      if (element.hasIdentifier()) {
44244        openArray("identifier");
44245        for (Identifier e : element.getIdentifier()) 
44246          composeIdentifier(null, e);
44247        closeArray();
44248      };
44249      if (element.hasStatusElement()) {
44250        composeEnumerationCore("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory(), false);
44251        composeEnumerationExtras("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory(), false);
44252      }
44253      if (element.hasCancelledReasonElement()) {
44254        composeStringCore("cancelledReason", element.getCancelledReasonElement(), false);
44255        composeStringExtras("cancelledReason", element.getCancelledReasonElement(), false);
44256      }
44257      if (element.hasType()) {
44258        composeCodeableConcept("type", element.getType());
44259      }
44260      if (element.hasSubject()) {
44261        composeReference("subject", element.getSubject());
44262      }
44263      if (element.hasRecipient()) {
44264        composeReference("recipient", element.getRecipient());
44265      }
44266      if (element.hasDateElement()) {
44267        composeDateTimeCore("date", element.getDateElement(), false);
44268        composeDateTimeExtras("date", element.getDateElement(), false);
44269      }
44270      if (element.hasParticipant()) {
44271        openArray("participant");
44272        for (Invoice.InvoiceParticipantComponent e : element.getParticipant()) 
44273          composeInvoiceInvoiceParticipantComponent(null, e);
44274        closeArray();
44275      };
44276      if (element.hasIssuer()) {
44277        composeReference("issuer", element.getIssuer());
44278      }
44279      if (element.hasAccount()) {
44280        composeReference("account", element.getAccount());
44281      }
44282      if (element.hasLineItem()) {
44283        openArray("lineItem");
44284        for (Invoice.InvoiceLineItemComponent e : element.getLineItem()) 
44285          composeInvoiceInvoiceLineItemComponent(null, e);
44286        closeArray();
44287      };
44288      if (element.hasTotalPriceComponent()) {
44289        openArray("totalPriceComponent");
44290        for (Invoice.InvoiceLineItemPriceComponentComponent e : element.getTotalPriceComponent()) 
44291          composeInvoiceInvoiceLineItemPriceComponentComponent(null, e);
44292        closeArray();
44293      };
44294      if (element.hasTotalNet()) {
44295        composeMoney("totalNet", element.getTotalNet());
44296      }
44297      if (element.hasTotalGross()) {
44298        composeMoney("totalGross", element.getTotalGross());
44299      }
44300      if (element.hasPaymentTermsElement()) {
44301        composeMarkdownCore("paymentTerms", element.getPaymentTermsElement(), false);
44302        composeMarkdownExtras("paymentTerms", element.getPaymentTermsElement(), false);
44303      }
44304      if (element.hasNote()) {
44305        openArray("note");
44306        for (Annotation e : element.getNote()) 
44307          composeAnnotation(null, e);
44308        closeArray();
44309      };
44310  }
44311
44312  protected void composeInvoiceInvoiceParticipantComponent(String name, Invoice.InvoiceParticipantComponent element) throws IOException {
44313    if (element != null) {
44314      open(name);
44315      composeInvoiceInvoiceParticipantComponentInner(element);
44316      close();
44317    }
44318  }
44319
44320  protected void composeInvoiceInvoiceParticipantComponentInner(Invoice.InvoiceParticipantComponent element) throws IOException {
44321      composeBackbone(element);
44322      if (element.hasRole()) {
44323        composeCodeableConcept("role", element.getRole());
44324      }
44325      if (element.hasActor()) {
44326        composeReference("actor", element.getActor());
44327      }
44328  }
44329
44330  protected void composeInvoiceInvoiceLineItemComponent(String name, Invoice.InvoiceLineItemComponent element) throws IOException {
44331    if (element != null) {
44332      open(name);
44333      composeInvoiceInvoiceLineItemComponentInner(element);
44334      close();
44335    }
44336  }
44337
44338  protected void composeInvoiceInvoiceLineItemComponentInner(Invoice.InvoiceLineItemComponent element) throws IOException {
44339      composeBackbone(element);
44340      if (element.hasSequenceElement()) {
44341        composePositiveIntCore("sequence", element.getSequenceElement(), false);
44342        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
44343      }
44344      if (element.hasChargeItem()) {
44345        composeType("chargeItem", element.getChargeItem());
44346      }
44347      if (element.hasPriceComponent()) {
44348        openArray("priceComponent");
44349        for (Invoice.InvoiceLineItemPriceComponentComponent e : element.getPriceComponent()) 
44350          composeInvoiceInvoiceLineItemPriceComponentComponent(null, e);
44351        closeArray();
44352      };
44353  }
44354
44355  protected void composeInvoiceInvoiceLineItemPriceComponentComponent(String name, Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
44356    if (element != null) {
44357      open(name);
44358      composeInvoiceInvoiceLineItemPriceComponentComponentInner(element);
44359      close();
44360    }
44361  }
44362
44363  protected void composeInvoiceInvoiceLineItemPriceComponentComponentInner(Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
44364      composeBackbone(element);
44365      if (element.hasTypeElement()) {
44366        composeEnumerationCore("type", element.getTypeElement(), new Invoice.InvoicePriceComponentTypeEnumFactory(), false);
44367        composeEnumerationExtras("type", element.getTypeElement(), new Invoice.InvoicePriceComponentTypeEnumFactory(), false);
44368      }
44369      if (element.hasCode()) {
44370        composeCodeableConcept("code", element.getCode());
44371      }
44372      if (element.hasFactorElement()) {
44373        composeDecimalCore("factor", element.getFactorElement(), false);
44374        composeDecimalExtras("factor", element.getFactorElement(), false);
44375      }
44376      if (element.hasAmount()) {
44377        composeMoney("amount", element.getAmount());
44378      }
44379  }
44380
44381  protected void composeLibrary(String name, Library element) throws IOException {
44382    if (element != null) {
44383      prop("resourceType", name);
44384      composeLibraryInner(element);
44385    }
44386  }
44387
44388  protected void composeLibraryInner(Library element) throws IOException {
44389      composeDomainResourceElements(element);
44390      if (element.hasUrlElement()) {
44391        composeUriCore("url", element.getUrlElement(), false);
44392        composeUriExtras("url", element.getUrlElement(), false);
44393      }
44394      if (element.hasIdentifier()) {
44395        openArray("identifier");
44396        for (Identifier e : element.getIdentifier()) 
44397          composeIdentifier(null, e);
44398        closeArray();
44399      };
44400      if (element.hasVersionElement()) {
44401        composeStringCore("version", element.getVersionElement(), false);
44402        composeStringExtras("version", element.getVersionElement(), false);
44403      }
44404      if (element.hasNameElement()) {
44405        composeStringCore("name", element.getNameElement(), false);
44406        composeStringExtras("name", element.getNameElement(), false);
44407      }
44408      if (element.hasTitleElement()) {
44409        composeStringCore("title", element.getTitleElement(), false);
44410        composeStringExtras("title", element.getTitleElement(), false);
44411      }
44412      if (element.hasSubtitleElement()) {
44413        composeStringCore("subtitle", element.getSubtitleElement(), false);
44414        composeStringExtras("subtitle", element.getSubtitleElement(), false);
44415      }
44416      if (element.hasStatusElement()) {
44417        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
44418        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
44419      }
44420      if (element.hasExperimentalElement()) {
44421        composeBooleanCore("experimental", element.getExperimentalElement(), false);
44422        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
44423      }
44424      if (element.hasType()) {
44425        composeCodeableConcept("type", element.getType());
44426      }
44427      if (element.hasSubject()) {
44428        composeType("subject", element.getSubject());
44429      }
44430      if (element.hasDateElement()) {
44431        composeDateTimeCore("date", element.getDateElement(), false);
44432        composeDateTimeExtras("date", element.getDateElement(), false);
44433      }
44434      if (element.hasPublisherElement()) {
44435        composeStringCore("publisher", element.getPublisherElement(), false);
44436        composeStringExtras("publisher", element.getPublisherElement(), false);
44437      }
44438      if (element.hasContact()) {
44439        openArray("contact");
44440        for (ContactDetail e : element.getContact()) 
44441          composeContactDetail(null, e);
44442        closeArray();
44443      };
44444      if (element.hasDescriptionElement()) {
44445        composeMarkdownCore("description", element.getDescriptionElement(), false);
44446        composeMarkdownExtras("description", element.getDescriptionElement(), false);
44447      }
44448      if (element.hasUseContext()) {
44449        openArray("useContext");
44450        for (UsageContext e : element.getUseContext()) 
44451          composeUsageContext(null, e);
44452        closeArray();
44453      };
44454      if (element.hasJurisdiction()) {
44455        openArray("jurisdiction");
44456        for (CodeableConcept e : element.getJurisdiction()) 
44457          composeCodeableConcept(null, e);
44458        closeArray();
44459      };
44460      if (element.hasPurposeElement()) {
44461        composeMarkdownCore("purpose", element.getPurposeElement(), false);
44462        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
44463      }
44464      if (element.hasUsageElement()) {
44465        composeStringCore("usage", element.getUsageElement(), false);
44466        composeStringExtras("usage", element.getUsageElement(), false);
44467      }
44468      if (element.hasCopyrightElement()) {
44469        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
44470        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
44471      }
44472      if (element.hasApprovalDateElement()) {
44473        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
44474        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
44475      }
44476      if (element.hasLastReviewDateElement()) {
44477        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
44478        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
44479      }
44480      if (element.hasEffectivePeriod()) {
44481        composePeriod("effectivePeriod", element.getEffectivePeriod());
44482      }
44483      if (element.hasTopic()) {
44484        openArray("topic");
44485        for (CodeableConcept e : element.getTopic()) 
44486          composeCodeableConcept(null, e);
44487        closeArray();
44488      };
44489      if (element.hasAuthor()) {
44490        openArray("author");
44491        for (ContactDetail e : element.getAuthor()) 
44492          composeContactDetail(null, e);
44493        closeArray();
44494      };
44495      if (element.hasEditor()) {
44496        openArray("editor");
44497        for (ContactDetail e : element.getEditor()) 
44498          composeContactDetail(null, e);
44499        closeArray();
44500      };
44501      if (element.hasReviewer()) {
44502        openArray("reviewer");
44503        for (ContactDetail e : element.getReviewer()) 
44504          composeContactDetail(null, e);
44505        closeArray();
44506      };
44507      if (element.hasEndorser()) {
44508        openArray("endorser");
44509        for (ContactDetail e : element.getEndorser()) 
44510          composeContactDetail(null, e);
44511        closeArray();
44512      };
44513      if (element.hasRelatedArtifact()) {
44514        openArray("relatedArtifact");
44515        for (RelatedArtifact e : element.getRelatedArtifact()) 
44516          composeRelatedArtifact(null, e);
44517        closeArray();
44518      };
44519      if (element.hasParameter()) {
44520        openArray("parameter");
44521        for (ParameterDefinition e : element.getParameter()) 
44522          composeParameterDefinition(null, e);
44523        closeArray();
44524      };
44525      if (element.hasDataRequirement()) {
44526        openArray("dataRequirement");
44527        for (DataRequirement e : element.getDataRequirement()) 
44528          composeDataRequirement(null, e);
44529        closeArray();
44530      };
44531      if (element.hasContent()) {
44532        openArray("content");
44533        for (Attachment e : element.getContent()) 
44534          composeAttachment(null, e);
44535        closeArray();
44536      };
44537  }
44538
44539  protected void composeLinkage(String name, Linkage element) throws IOException {
44540    if (element != null) {
44541      prop("resourceType", name);
44542      composeLinkageInner(element);
44543    }
44544  }
44545
44546  protected void composeLinkageInner(Linkage element) throws IOException {
44547      composeDomainResourceElements(element);
44548      if (element.hasActiveElement()) {
44549        composeBooleanCore("active", element.getActiveElement(), false);
44550        composeBooleanExtras("active", element.getActiveElement(), false);
44551      }
44552      if (element.hasAuthor()) {
44553        composeReference("author", element.getAuthor());
44554      }
44555      if (element.hasItem()) {
44556        openArray("item");
44557        for (Linkage.LinkageItemComponent e : element.getItem()) 
44558          composeLinkageLinkageItemComponent(null, e);
44559        closeArray();
44560      };
44561  }
44562
44563  protected void composeLinkageLinkageItemComponent(String name, Linkage.LinkageItemComponent element) throws IOException {
44564    if (element != null) {
44565      open(name);
44566      composeLinkageLinkageItemComponentInner(element);
44567      close();
44568    }
44569  }
44570
44571  protected void composeLinkageLinkageItemComponentInner(Linkage.LinkageItemComponent element) throws IOException {
44572      composeBackbone(element);
44573      if (element.hasTypeElement()) {
44574        composeEnumerationCore("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
44575        composeEnumerationExtras("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
44576      }
44577      if (element.hasResource()) {
44578        composeReference("resource", element.getResource());
44579      }
44580  }
44581
44582  protected void composeListResource(String name, ListResource element) throws IOException {
44583    if (element != null) {
44584      prop("resourceType", name);
44585      composeListResourceInner(element);
44586    }
44587  }
44588
44589  protected void composeListResourceInner(ListResource element) throws IOException {
44590      composeDomainResourceElements(element);
44591      if (element.hasIdentifier()) {
44592        openArray("identifier");
44593        for (Identifier e : element.getIdentifier()) 
44594          composeIdentifier(null, e);
44595        closeArray();
44596      };
44597      if (element.hasStatusElement()) {
44598        composeEnumerationCore("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
44599        composeEnumerationExtras("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
44600      }
44601      if (element.hasModeElement()) {
44602        composeEnumerationCore("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
44603        composeEnumerationExtras("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
44604      }
44605      if (element.hasTitleElement()) {
44606        composeStringCore("title", element.getTitleElement(), false);
44607        composeStringExtras("title", element.getTitleElement(), false);
44608      }
44609      if (element.hasCode()) {
44610        composeCodeableConcept("code", element.getCode());
44611      }
44612      if (element.hasSubject()) {
44613        composeReference("subject", element.getSubject());
44614      }
44615      if (element.hasEncounter()) {
44616        composeReference("encounter", element.getEncounter());
44617      }
44618      if (element.hasDateElement()) {
44619        composeDateTimeCore("date", element.getDateElement(), false);
44620        composeDateTimeExtras("date", element.getDateElement(), false);
44621      }
44622      if (element.hasSource()) {
44623        composeReference("source", element.getSource());
44624      }
44625      if (element.hasOrderedBy()) {
44626        composeCodeableConcept("orderedBy", element.getOrderedBy());
44627      }
44628      if (element.hasNote()) {
44629        openArray("note");
44630        for (Annotation e : element.getNote()) 
44631          composeAnnotation(null, e);
44632        closeArray();
44633      };
44634      if (element.hasEntry()) {
44635        openArray("entry");
44636        for (ListResource.ListEntryComponent e : element.getEntry()) 
44637          composeListResourceListEntryComponent(null, e);
44638        closeArray();
44639      };
44640      if (element.hasEmptyReason()) {
44641        composeCodeableConcept("emptyReason", element.getEmptyReason());
44642      }
44643  }
44644
44645  protected void composeListResourceListEntryComponent(String name, ListResource.ListEntryComponent element) throws IOException {
44646    if (element != null) {
44647      open(name);
44648      composeListResourceListEntryComponentInner(element);
44649      close();
44650    }
44651  }
44652
44653  protected void composeListResourceListEntryComponentInner(ListResource.ListEntryComponent element) throws IOException {
44654      composeBackbone(element);
44655      if (element.hasFlag()) {
44656        composeCodeableConcept("flag", element.getFlag());
44657      }
44658      if (element.hasDeletedElement()) {
44659        composeBooleanCore("deleted", element.getDeletedElement(), false);
44660        composeBooleanExtras("deleted", element.getDeletedElement(), false);
44661      }
44662      if (element.hasDateElement()) {
44663        composeDateTimeCore("date", element.getDateElement(), false);
44664        composeDateTimeExtras("date", element.getDateElement(), false);
44665      }
44666      if (element.hasItem()) {
44667        composeReference("item", element.getItem());
44668      }
44669  }
44670
44671  protected void composeLocation(String name, Location element) throws IOException {
44672    if (element != null) {
44673      prop("resourceType", name);
44674      composeLocationInner(element);
44675    }
44676  }
44677
44678  protected void composeLocationInner(Location element) throws IOException {
44679      composeDomainResourceElements(element);
44680      if (element.hasIdentifier()) {
44681        openArray("identifier");
44682        for (Identifier e : element.getIdentifier()) 
44683          composeIdentifier(null, e);
44684        closeArray();
44685      };
44686      if (element.hasStatusElement()) {
44687        composeEnumerationCore("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
44688        composeEnumerationExtras("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
44689      }
44690      if (element.hasOperationalStatus()) {
44691        composeCoding("operationalStatus", element.getOperationalStatus());
44692      }
44693      if (element.hasNameElement()) {
44694        composeStringCore("name", element.getNameElement(), false);
44695        composeStringExtras("name", element.getNameElement(), false);
44696      }
44697      if (element.hasAlias()) {
44698        openArray("alias");
44699        for (StringType e : element.getAlias()) 
44700          composeStringCore(null, e, true);
44701        closeArray();
44702        if (anyHasExtras(element.getAlias())) {
44703          openArray("_alias");
44704          for (StringType e : element.getAlias()) 
44705            composeStringExtras(null, e, true);
44706          closeArray();
44707        }
44708      };
44709      if (element.hasDescriptionElement()) {
44710        composeStringCore("description", element.getDescriptionElement(), false);
44711        composeStringExtras("description", element.getDescriptionElement(), false);
44712      }
44713      if (element.hasModeElement()) {
44714        composeEnumerationCore("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
44715        composeEnumerationExtras("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
44716      }
44717      if (element.hasType()) {
44718        openArray("type");
44719        for (CodeableConcept e : element.getType()) 
44720          composeCodeableConcept(null, e);
44721        closeArray();
44722      };
44723      if (element.hasTelecom()) {
44724        openArray("telecom");
44725        for (ContactPoint e : element.getTelecom()) 
44726          composeContactPoint(null, e);
44727        closeArray();
44728      };
44729      if (element.hasAddress()) {
44730        composeAddress("address", element.getAddress());
44731      }
44732      if (element.hasPhysicalType()) {
44733        composeCodeableConcept("physicalType", element.getPhysicalType());
44734      }
44735      if (element.hasPosition()) {
44736        composeLocationLocationPositionComponent("position", element.getPosition());
44737      }
44738      if (element.hasManagingOrganization()) {
44739        composeReference("managingOrganization", element.getManagingOrganization());
44740      }
44741      if (element.hasPartOf()) {
44742        composeReference("partOf", element.getPartOf());
44743      }
44744      if (element.hasHoursOfOperation()) {
44745        openArray("hoursOfOperation");
44746        for (Location.LocationHoursOfOperationComponent e : element.getHoursOfOperation()) 
44747          composeLocationLocationHoursOfOperationComponent(null, e);
44748        closeArray();
44749      };
44750      if (element.hasAvailabilityExceptionsElement()) {
44751        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
44752        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
44753      }
44754      if (element.hasEndpoint()) {
44755        openArray("endpoint");
44756        for (Reference e : element.getEndpoint()) 
44757          composeReference(null, e);
44758        closeArray();
44759      };
44760  }
44761
44762  protected void composeLocationLocationPositionComponent(String name, Location.LocationPositionComponent element) throws IOException {
44763    if (element != null) {
44764      open(name);
44765      composeLocationLocationPositionComponentInner(element);
44766      close();
44767    }
44768  }
44769
44770  protected void composeLocationLocationPositionComponentInner(Location.LocationPositionComponent element) throws IOException {
44771      composeBackbone(element);
44772      if (element.hasLongitudeElement()) {
44773        composeDecimalCore("longitude", element.getLongitudeElement(), false);
44774        composeDecimalExtras("longitude", element.getLongitudeElement(), false);
44775      }
44776      if (element.hasLatitudeElement()) {
44777        composeDecimalCore("latitude", element.getLatitudeElement(), false);
44778        composeDecimalExtras("latitude", element.getLatitudeElement(), false);
44779      }
44780      if (element.hasAltitudeElement()) {
44781        composeDecimalCore("altitude", element.getAltitudeElement(), false);
44782        composeDecimalExtras("altitude", element.getAltitudeElement(), false);
44783      }
44784  }
44785
44786  protected void composeLocationLocationHoursOfOperationComponent(String name, Location.LocationHoursOfOperationComponent element) throws IOException {
44787    if (element != null) {
44788      open(name);
44789      composeLocationLocationHoursOfOperationComponentInner(element);
44790      close();
44791    }
44792  }
44793
44794  protected void composeLocationLocationHoursOfOperationComponentInner(Location.LocationHoursOfOperationComponent element) throws IOException {
44795      composeBackbone(element);
44796      if (element.hasDaysOfWeek()) {
44797        openArray("daysOfWeek");
44798        for (Enumeration<Location.DaysOfWeek> e : element.getDaysOfWeek()) 
44799          composeEnumerationCore(null, e, new Location.DaysOfWeekEnumFactory(), true);
44800        closeArray();
44801        if (anyHasExtras(element.getDaysOfWeek())) {
44802          openArray("_daysOfWeek");
44803          for (Enumeration<Location.DaysOfWeek> e : element.getDaysOfWeek()) 
44804            composeEnumerationExtras(null, e, new Location.DaysOfWeekEnumFactory(), true);
44805          closeArray();
44806        }
44807      };
44808      if (element.hasAllDayElement()) {
44809        composeBooleanCore("allDay", element.getAllDayElement(), false);
44810        composeBooleanExtras("allDay", element.getAllDayElement(), false);
44811      }
44812      if (element.hasOpeningTimeElement()) {
44813        composeTimeCore("openingTime", element.getOpeningTimeElement(), false);
44814        composeTimeExtras("openingTime", element.getOpeningTimeElement(), false);
44815      }
44816      if (element.hasClosingTimeElement()) {
44817        composeTimeCore("closingTime", element.getClosingTimeElement(), false);
44818        composeTimeExtras("closingTime", element.getClosingTimeElement(), false);
44819      }
44820  }
44821
44822  protected void composeMeasure(String name, Measure element) throws IOException {
44823    if (element != null) {
44824      prop("resourceType", name);
44825      composeMeasureInner(element);
44826    }
44827  }
44828
44829  protected void composeMeasureInner(Measure element) throws IOException {
44830      composeDomainResourceElements(element);
44831      if (element.hasUrlElement()) {
44832        composeUriCore("url", element.getUrlElement(), false);
44833        composeUriExtras("url", element.getUrlElement(), false);
44834      }
44835      if (element.hasIdentifier()) {
44836        openArray("identifier");
44837        for (Identifier e : element.getIdentifier()) 
44838          composeIdentifier(null, e);
44839        closeArray();
44840      };
44841      if (element.hasVersionElement()) {
44842        composeStringCore("version", element.getVersionElement(), false);
44843        composeStringExtras("version", element.getVersionElement(), false);
44844      }
44845      if (element.hasNameElement()) {
44846        composeStringCore("name", element.getNameElement(), false);
44847        composeStringExtras("name", element.getNameElement(), false);
44848      }
44849      if (element.hasTitleElement()) {
44850        composeStringCore("title", element.getTitleElement(), false);
44851        composeStringExtras("title", element.getTitleElement(), false);
44852      }
44853      if (element.hasSubtitleElement()) {
44854        composeStringCore("subtitle", element.getSubtitleElement(), false);
44855        composeStringExtras("subtitle", element.getSubtitleElement(), false);
44856      }
44857      if (element.hasStatusElement()) {
44858        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
44859        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
44860      }
44861      if (element.hasExperimentalElement()) {
44862        composeBooleanCore("experimental", element.getExperimentalElement(), false);
44863        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
44864      }
44865      if (element.hasSubject()) {
44866        composeType("subject", element.getSubject());
44867      }
44868      if (element.hasDateElement()) {
44869        composeDateTimeCore("date", element.getDateElement(), false);
44870        composeDateTimeExtras("date", element.getDateElement(), false);
44871      }
44872      if (element.hasPublisherElement()) {
44873        composeStringCore("publisher", element.getPublisherElement(), false);
44874        composeStringExtras("publisher", element.getPublisherElement(), false);
44875      }
44876      if (element.hasContact()) {
44877        openArray("contact");
44878        for (ContactDetail e : element.getContact()) 
44879          composeContactDetail(null, e);
44880        closeArray();
44881      };
44882      if (element.hasDescriptionElement()) {
44883        composeMarkdownCore("description", element.getDescriptionElement(), false);
44884        composeMarkdownExtras("description", element.getDescriptionElement(), false);
44885      }
44886      if (element.hasUseContext()) {
44887        openArray("useContext");
44888        for (UsageContext e : element.getUseContext()) 
44889          composeUsageContext(null, e);
44890        closeArray();
44891      };
44892      if (element.hasJurisdiction()) {
44893        openArray("jurisdiction");
44894        for (CodeableConcept e : element.getJurisdiction()) 
44895          composeCodeableConcept(null, e);
44896        closeArray();
44897      };
44898      if (element.hasPurposeElement()) {
44899        composeMarkdownCore("purpose", element.getPurposeElement(), false);
44900        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
44901      }
44902      if (element.hasUsageElement()) {
44903        composeStringCore("usage", element.getUsageElement(), false);
44904        composeStringExtras("usage", element.getUsageElement(), false);
44905      }
44906      if (element.hasCopyrightElement()) {
44907        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
44908        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
44909      }
44910      if (element.hasApprovalDateElement()) {
44911        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
44912        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
44913      }
44914      if (element.hasLastReviewDateElement()) {
44915        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
44916        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
44917      }
44918      if (element.hasEffectivePeriod()) {
44919        composePeriod("effectivePeriod", element.getEffectivePeriod());
44920      }
44921      if (element.hasTopic()) {
44922        openArray("topic");
44923        for (CodeableConcept e : element.getTopic()) 
44924          composeCodeableConcept(null, e);
44925        closeArray();
44926      };
44927      if (element.hasAuthor()) {
44928        openArray("author");
44929        for (ContactDetail e : element.getAuthor()) 
44930          composeContactDetail(null, e);
44931        closeArray();
44932      };
44933      if (element.hasEditor()) {
44934        openArray("editor");
44935        for (ContactDetail e : element.getEditor()) 
44936          composeContactDetail(null, e);
44937        closeArray();
44938      };
44939      if (element.hasReviewer()) {
44940        openArray("reviewer");
44941        for (ContactDetail e : element.getReviewer()) 
44942          composeContactDetail(null, e);
44943        closeArray();
44944      };
44945      if (element.hasEndorser()) {
44946        openArray("endorser");
44947        for (ContactDetail e : element.getEndorser()) 
44948          composeContactDetail(null, e);
44949        closeArray();
44950      };
44951      if (element.hasRelatedArtifact()) {
44952        openArray("relatedArtifact");
44953        for (RelatedArtifact e : element.getRelatedArtifact()) 
44954          composeRelatedArtifact(null, e);
44955        closeArray();
44956      };
44957      if (element.hasLibrary()) {
44958        openArray("library");
44959        for (CanonicalType e : element.getLibrary()) 
44960          composeCanonicalCore(null, e, true);
44961        closeArray();
44962        if (anyHasExtras(element.getLibrary())) {
44963          openArray("_library");
44964          for (CanonicalType e : element.getLibrary()) 
44965            composeCanonicalExtras(null, e, true);
44966          closeArray();
44967        }
44968      };
44969      if (element.hasDisclaimerElement()) {
44970        composeMarkdownCore("disclaimer", element.getDisclaimerElement(), false);
44971        composeMarkdownExtras("disclaimer", element.getDisclaimerElement(), false);
44972      }
44973      if (element.hasScoring()) {
44974        composeCodeableConcept("scoring", element.getScoring());
44975      }
44976      if (element.hasCompositeScoring()) {
44977        composeCodeableConcept("compositeScoring", element.getCompositeScoring());
44978      }
44979      if (element.hasType()) {
44980        openArray("type");
44981        for (CodeableConcept e : element.getType()) 
44982          composeCodeableConcept(null, e);
44983        closeArray();
44984      };
44985      if (element.hasRiskAdjustmentElement()) {
44986        composeStringCore("riskAdjustment", element.getRiskAdjustmentElement(), false);
44987        composeStringExtras("riskAdjustment", element.getRiskAdjustmentElement(), false);
44988      }
44989      if (element.hasRateAggregationElement()) {
44990        composeStringCore("rateAggregation", element.getRateAggregationElement(), false);
44991        composeStringExtras("rateAggregation", element.getRateAggregationElement(), false);
44992      }
44993      if (element.hasRationaleElement()) {
44994        composeMarkdownCore("rationale", element.getRationaleElement(), false);
44995        composeMarkdownExtras("rationale", element.getRationaleElement(), false);
44996      }
44997      if (element.hasClinicalRecommendationStatementElement()) {
44998        composeMarkdownCore("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
44999        composeMarkdownExtras("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
45000      }
45001      if (element.hasImprovementNotation()) {
45002        composeCodeableConcept("improvementNotation", element.getImprovementNotation());
45003      }
45004      if (element.hasDefinition()) {
45005        openArray("definition");
45006        for (MarkdownType e : element.getDefinition()) 
45007          composeMarkdownCore(null, e, true);
45008        closeArray();
45009        if (anyHasExtras(element.getDefinition())) {
45010          openArray("_definition");
45011          for (MarkdownType e : element.getDefinition()) 
45012            composeMarkdownExtras(null, e, true);
45013          closeArray();
45014        }
45015      };
45016      if (element.hasGuidanceElement()) {
45017        composeMarkdownCore("guidance", element.getGuidanceElement(), false);
45018        composeMarkdownExtras("guidance", element.getGuidanceElement(), false);
45019      }
45020      if (element.hasGroup()) {
45021        openArray("group");
45022        for (Measure.MeasureGroupComponent e : element.getGroup()) 
45023          composeMeasureMeasureGroupComponent(null, e);
45024        closeArray();
45025      };
45026      if (element.hasSupplementalData()) {
45027        openArray("supplementalData");
45028        for (Measure.MeasureSupplementalDataComponent e : element.getSupplementalData()) 
45029          composeMeasureMeasureSupplementalDataComponent(null, e);
45030        closeArray();
45031      };
45032  }
45033
45034  protected void composeMeasureMeasureGroupComponent(String name, Measure.MeasureGroupComponent element) throws IOException {
45035    if (element != null) {
45036      open(name);
45037      composeMeasureMeasureGroupComponentInner(element);
45038      close();
45039    }
45040  }
45041
45042  protected void composeMeasureMeasureGroupComponentInner(Measure.MeasureGroupComponent element) throws IOException {
45043      composeBackbone(element);
45044      if (element.hasCode()) {
45045        composeCodeableConcept("code", element.getCode());
45046      }
45047      if (element.hasDescriptionElement()) {
45048        composeStringCore("description", element.getDescriptionElement(), false);
45049        composeStringExtras("description", element.getDescriptionElement(), false);
45050      }
45051      if (element.hasPopulation()) {
45052        openArray("population");
45053        for (Measure.MeasureGroupPopulationComponent e : element.getPopulation()) 
45054          composeMeasureMeasureGroupPopulationComponent(null, e);
45055        closeArray();
45056      };
45057      if (element.hasStratifier()) {
45058        openArray("stratifier");
45059        for (Measure.MeasureGroupStratifierComponent e : element.getStratifier()) 
45060          composeMeasureMeasureGroupStratifierComponent(null, e);
45061        closeArray();
45062      };
45063  }
45064
45065  protected void composeMeasureMeasureGroupPopulationComponent(String name, Measure.MeasureGroupPopulationComponent element) throws IOException {
45066    if (element != null) {
45067      open(name);
45068      composeMeasureMeasureGroupPopulationComponentInner(element);
45069      close();
45070    }
45071  }
45072
45073  protected void composeMeasureMeasureGroupPopulationComponentInner(Measure.MeasureGroupPopulationComponent element) throws IOException {
45074      composeBackbone(element);
45075      if (element.hasCode()) {
45076        composeCodeableConcept("code", element.getCode());
45077      }
45078      if (element.hasDescriptionElement()) {
45079        composeStringCore("description", element.getDescriptionElement(), false);
45080        composeStringExtras("description", element.getDescriptionElement(), false);
45081      }
45082      if (element.hasCriteria()) {
45083        composeExpression("criteria", element.getCriteria());
45084      }
45085  }
45086
45087  protected void composeMeasureMeasureGroupStratifierComponent(String name, Measure.MeasureGroupStratifierComponent element) throws IOException {
45088    if (element != null) {
45089      open(name);
45090      composeMeasureMeasureGroupStratifierComponentInner(element);
45091      close();
45092    }
45093  }
45094
45095  protected void composeMeasureMeasureGroupStratifierComponentInner(Measure.MeasureGroupStratifierComponent element) throws IOException {
45096      composeBackbone(element);
45097      if (element.hasCode()) {
45098        composeCodeableConcept("code", element.getCode());
45099      }
45100      if (element.hasDescriptionElement()) {
45101        composeStringCore("description", element.getDescriptionElement(), false);
45102        composeStringExtras("description", element.getDescriptionElement(), false);
45103      }
45104      if (element.hasCriteria()) {
45105        composeExpression("criteria", element.getCriteria());
45106      }
45107      if (element.hasComponent()) {
45108        openArray("component");
45109        for (Measure.MeasureGroupStratifierComponentComponent e : element.getComponent()) 
45110          composeMeasureMeasureGroupStratifierComponentComponent(null, e);
45111        closeArray();
45112      };
45113  }
45114
45115  protected void composeMeasureMeasureGroupStratifierComponentComponent(String name, Measure.MeasureGroupStratifierComponentComponent element) throws IOException {
45116    if (element != null) {
45117      open(name);
45118      composeMeasureMeasureGroupStratifierComponentComponentInner(element);
45119      close();
45120    }
45121  }
45122
45123  protected void composeMeasureMeasureGroupStratifierComponentComponentInner(Measure.MeasureGroupStratifierComponentComponent element) throws IOException {
45124      composeBackbone(element);
45125      if (element.hasCode()) {
45126        composeCodeableConcept("code", element.getCode());
45127      }
45128      if (element.hasDescriptionElement()) {
45129        composeStringCore("description", element.getDescriptionElement(), false);
45130        composeStringExtras("description", element.getDescriptionElement(), false);
45131      }
45132      if (element.hasCriteria()) {
45133        composeExpression("criteria", element.getCriteria());
45134      }
45135  }
45136
45137  protected void composeMeasureMeasureSupplementalDataComponent(String name, Measure.MeasureSupplementalDataComponent element) throws IOException {
45138    if (element != null) {
45139      open(name);
45140      composeMeasureMeasureSupplementalDataComponentInner(element);
45141      close();
45142    }
45143  }
45144
45145  protected void composeMeasureMeasureSupplementalDataComponentInner(Measure.MeasureSupplementalDataComponent element) throws IOException {
45146      composeBackbone(element);
45147      if (element.hasCode()) {
45148        composeCodeableConcept("code", element.getCode());
45149      }
45150      if (element.hasUsage()) {
45151        openArray("usage");
45152        for (CodeableConcept e : element.getUsage()) 
45153          composeCodeableConcept(null, e);
45154        closeArray();
45155      };
45156      if (element.hasDescriptionElement()) {
45157        composeStringCore("description", element.getDescriptionElement(), false);
45158        composeStringExtras("description", element.getDescriptionElement(), false);
45159      }
45160      if (element.hasCriteria()) {
45161        composeExpression("criteria", element.getCriteria());
45162      }
45163  }
45164
45165  protected void composeMeasureReport(String name, MeasureReport element) throws IOException {
45166    if (element != null) {
45167      prop("resourceType", name);
45168      composeMeasureReportInner(element);
45169    }
45170  }
45171
45172  protected void composeMeasureReportInner(MeasureReport element) throws IOException {
45173      composeDomainResourceElements(element);
45174      if (element.hasIdentifier()) {
45175        openArray("identifier");
45176        for (Identifier e : element.getIdentifier()) 
45177          composeIdentifier(null, e);
45178        closeArray();
45179      };
45180      if (element.hasStatusElement()) {
45181        composeEnumerationCore("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
45182        composeEnumerationExtras("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
45183      }
45184      if (element.hasTypeElement()) {
45185        composeEnumerationCore("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
45186        composeEnumerationExtras("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
45187      }
45188      if (element.hasMeasureElement()) {
45189        composeCanonicalCore("measure", element.getMeasureElement(), false);
45190        composeCanonicalExtras("measure", element.getMeasureElement(), false);
45191      }
45192      if (element.hasSubject()) {
45193        composeReference("subject", element.getSubject());
45194      }
45195      if (element.hasDateElement()) {
45196        composeDateTimeCore("date", element.getDateElement(), false);
45197        composeDateTimeExtras("date", element.getDateElement(), false);
45198      }
45199      if (element.hasReporter()) {
45200        composeReference("reporter", element.getReporter());
45201      }
45202      if (element.hasPeriod()) {
45203        composePeriod("period", element.getPeriod());
45204      }
45205      if (element.hasImprovementNotation()) {
45206        composeCodeableConcept("improvementNotation", element.getImprovementNotation());
45207      }
45208      if (element.hasGroup()) {
45209        openArray("group");
45210        for (MeasureReport.MeasureReportGroupComponent e : element.getGroup()) 
45211          composeMeasureReportMeasureReportGroupComponent(null, e);
45212        closeArray();
45213      };
45214      if (element.hasEvaluatedResource()) {
45215        openArray("evaluatedResource");
45216        for (Reference e : element.getEvaluatedResource()) 
45217          composeReference(null, e);
45218        closeArray();
45219      };
45220  }
45221
45222  protected void composeMeasureReportMeasureReportGroupComponent(String name, MeasureReport.MeasureReportGroupComponent element) throws IOException {
45223    if (element != null) {
45224      open(name);
45225      composeMeasureReportMeasureReportGroupComponentInner(element);
45226      close();
45227    }
45228  }
45229
45230  protected void composeMeasureReportMeasureReportGroupComponentInner(MeasureReport.MeasureReportGroupComponent element) throws IOException {
45231      composeBackbone(element);
45232      if (element.hasCode()) {
45233        composeCodeableConcept("code", element.getCode());
45234      }
45235      if (element.hasPopulation()) {
45236        openArray("population");
45237        for (MeasureReport.MeasureReportGroupPopulationComponent e : element.getPopulation()) 
45238          composeMeasureReportMeasureReportGroupPopulationComponent(null, e);
45239        closeArray();
45240      };
45241      if (element.hasMeasureScore()) {
45242        composeQuantity("measureScore", element.getMeasureScore());
45243      }
45244      if (element.hasStratifier()) {
45245        openArray("stratifier");
45246        for (MeasureReport.MeasureReportGroupStratifierComponent e : element.getStratifier()) 
45247          composeMeasureReportMeasureReportGroupStratifierComponent(null, e);
45248        closeArray();
45249      };
45250  }
45251
45252  protected void composeMeasureReportMeasureReportGroupPopulationComponent(String name, MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
45253    if (element != null) {
45254      open(name);
45255      composeMeasureReportMeasureReportGroupPopulationComponentInner(element);
45256      close();
45257    }
45258  }
45259
45260  protected void composeMeasureReportMeasureReportGroupPopulationComponentInner(MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
45261      composeBackbone(element);
45262      if (element.hasCode()) {
45263        composeCodeableConcept("code", element.getCode());
45264      }
45265      if (element.hasCountElement()) {
45266        composeIntegerCore("count", element.getCountElement(), false);
45267        composeIntegerExtras("count", element.getCountElement(), false);
45268      }
45269      if (element.hasSubjectResults()) {
45270        composeReference("subjectResults", element.getSubjectResults());
45271      }
45272  }
45273
45274  protected void composeMeasureReportMeasureReportGroupStratifierComponent(String name, MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
45275    if (element != null) {
45276      open(name);
45277      composeMeasureReportMeasureReportGroupStratifierComponentInner(element);
45278      close();
45279    }
45280  }
45281
45282  protected void composeMeasureReportMeasureReportGroupStratifierComponentInner(MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
45283      composeBackbone(element);
45284      if (element.hasCode()) {
45285        openArray("code");
45286        for (CodeableConcept e : element.getCode()) 
45287          composeCodeableConcept(null, e);
45288        closeArray();
45289      };
45290      if (element.hasStratum()) {
45291        openArray("stratum");
45292        for (MeasureReport.StratifierGroupComponent e : element.getStratum()) 
45293          composeMeasureReportStratifierGroupComponent(null, e);
45294        closeArray();
45295      };
45296  }
45297
45298  protected void composeMeasureReportStratifierGroupComponent(String name, MeasureReport.StratifierGroupComponent element) throws IOException {
45299    if (element != null) {
45300      open(name);
45301      composeMeasureReportStratifierGroupComponentInner(element);
45302      close();
45303    }
45304  }
45305
45306  protected void composeMeasureReportStratifierGroupComponentInner(MeasureReport.StratifierGroupComponent element) throws IOException {
45307      composeBackbone(element);
45308      if (element.hasValue()) {
45309        composeCodeableConcept("value", element.getValue());
45310      }
45311      if (element.hasComponent()) {
45312        openArray("component");
45313        for (MeasureReport.StratifierGroupComponentComponent e : element.getComponent()) 
45314          composeMeasureReportStratifierGroupComponentComponent(null, e);
45315        closeArray();
45316      };
45317      if (element.hasPopulation()) {
45318        openArray("population");
45319        for (MeasureReport.StratifierGroupPopulationComponent e : element.getPopulation()) 
45320          composeMeasureReportStratifierGroupPopulationComponent(null, e);
45321        closeArray();
45322      };
45323      if (element.hasMeasureScore()) {
45324        composeQuantity("measureScore", element.getMeasureScore());
45325      }
45326  }
45327
45328  protected void composeMeasureReportStratifierGroupComponentComponent(String name, MeasureReport.StratifierGroupComponentComponent element) throws IOException {
45329    if (element != null) {
45330      open(name);
45331      composeMeasureReportStratifierGroupComponentComponentInner(element);
45332      close();
45333    }
45334  }
45335
45336  protected void composeMeasureReportStratifierGroupComponentComponentInner(MeasureReport.StratifierGroupComponentComponent element) throws IOException {
45337      composeBackbone(element);
45338      if (element.hasCode()) {
45339        composeCodeableConcept("code", element.getCode());
45340      }
45341      if (element.hasValue()) {
45342        composeCodeableConcept("value", element.getValue());
45343      }
45344  }
45345
45346  protected void composeMeasureReportStratifierGroupPopulationComponent(String name, MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
45347    if (element != null) {
45348      open(name);
45349      composeMeasureReportStratifierGroupPopulationComponentInner(element);
45350      close();
45351    }
45352  }
45353
45354  protected void composeMeasureReportStratifierGroupPopulationComponentInner(MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
45355      composeBackbone(element);
45356      if (element.hasCode()) {
45357        composeCodeableConcept("code", element.getCode());
45358      }
45359      if (element.hasCountElement()) {
45360        composeIntegerCore("count", element.getCountElement(), false);
45361        composeIntegerExtras("count", element.getCountElement(), false);
45362      }
45363      if (element.hasSubjectResults()) {
45364        composeReference("subjectResults", element.getSubjectResults());
45365      }
45366  }
45367
45368  protected void composeMedia(String name, Media element) throws IOException {
45369    if (element != null) {
45370      prop("resourceType", name);
45371      composeMediaInner(element);
45372    }
45373  }
45374
45375  protected void composeMediaInner(Media element) throws IOException {
45376      composeDomainResourceElements(element);
45377      if (element.hasIdentifier()) {
45378        openArray("identifier");
45379        for (Identifier e : element.getIdentifier()) 
45380          composeIdentifier(null, e);
45381        closeArray();
45382      };
45383      if (element.hasBasedOn()) {
45384        openArray("basedOn");
45385        for (Reference e : element.getBasedOn()) 
45386          composeReference(null, e);
45387        closeArray();
45388      };
45389      if (element.hasPartOf()) {
45390        openArray("partOf");
45391        for (Reference e : element.getPartOf()) 
45392          composeReference(null, e);
45393        closeArray();
45394      };
45395      if (element.hasStatusElement()) {
45396        composeEnumerationCore("status", element.getStatusElement(), new Media.MediaStatusEnumFactory(), false);
45397        composeEnumerationExtras("status", element.getStatusElement(), new Media.MediaStatusEnumFactory(), false);
45398      }
45399      if (element.hasType()) {
45400        composeCodeableConcept("type", element.getType());
45401      }
45402      if (element.hasModality()) {
45403        composeCodeableConcept("modality", element.getModality());
45404      }
45405      if (element.hasView()) {
45406        composeCodeableConcept("view", element.getView());
45407      }
45408      if (element.hasSubject()) {
45409        composeReference("subject", element.getSubject());
45410      }
45411      if (element.hasEncounter()) {
45412        composeReference("encounter", element.getEncounter());
45413      }
45414      if (element.hasCreated()) {
45415        composeType("created", element.getCreated());
45416      }
45417      if (element.hasIssuedElement()) {
45418        composeInstantCore("issued", element.getIssuedElement(), false);
45419        composeInstantExtras("issued", element.getIssuedElement(), false);
45420      }
45421      if (element.hasOperator()) {
45422        composeReference("operator", element.getOperator());
45423      }
45424      if (element.hasReasonCode()) {
45425        openArray("reasonCode");
45426        for (CodeableConcept e : element.getReasonCode()) 
45427          composeCodeableConcept(null, e);
45428        closeArray();
45429      };
45430      if (element.hasBodySite()) {
45431        composeCodeableConcept("bodySite", element.getBodySite());
45432      }
45433      if (element.hasDeviceNameElement()) {
45434        composeStringCore("deviceName", element.getDeviceNameElement(), false);
45435        composeStringExtras("deviceName", element.getDeviceNameElement(), false);
45436      }
45437      if (element.hasDevice()) {
45438        composeReference("device", element.getDevice());
45439      }
45440      if (element.hasHeightElement()) {
45441        composePositiveIntCore("height", element.getHeightElement(), false);
45442        composePositiveIntExtras("height", element.getHeightElement(), false);
45443      }
45444      if (element.hasWidthElement()) {
45445        composePositiveIntCore("width", element.getWidthElement(), false);
45446        composePositiveIntExtras("width", element.getWidthElement(), false);
45447      }
45448      if (element.hasFramesElement()) {
45449        composePositiveIntCore("frames", element.getFramesElement(), false);
45450        composePositiveIntExtras("frames", element.getFramesElement(), false);
45451      }
45452      if (element.hasDurationElement()) {
45453        composeDecimalCore("duration", element.getDurationElement(), false);
45454        composeDecimalExtras("duration", element.getDurationElement(), false);
45455      }
45456      if (element.hasContent()) {
45457        composeAttachment("content", element.getContent());
45458      }
45459      if (element.hasNote()) {
45460        openArray("note");
45461        for (Annotation e : element.getNote()) 
45462          composeAnnotation(null, e);
45463        closeArray();
45464      };
45465  }
45466
45467  protected void composeMedication(String name, Medication element) throws IOException {
45468    if (element != null) {
45469      prop("resourceType", name);
45470      composeMedicationInner(element);
45471    }
45472  }
45473
45474  protected void composeMedicationInner(Medication element) throws IOException {
45475      composeDomainResourceElements(element);
45476      if (element.hasIdentifier()) {
45477        openArray("identifier");
45478        for (Identifier e : element.getIdentifier()) 
45479          composeIdentifier(null, e);
45480        closeArray();
45481      };
45482      if (element.hasCode()) {
45483        composeCodeableConcept("code", element.getCode());
45484      }
45485      if (element.hasStatusElement()) {
45486        composeEnumerationCore("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory(), false);
45487        composeEnumerationExtras("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory(), false);
45488      }
45489      if (element.hasManufacturer()) {
45490        composeReference("manufacturer", element.getManufacturer());
45491      }
45492      if (element.hasForm()) {
45493        composeCodeableConcept("form", element.getForm());
45494      }
45495      if (element.hasAmount()) {
45496        composeRatio("amount", element.getAmount());
45497      }
45498      if (element.hasIngredient()) {
45499        openArray("ingredient");
45500        for (Medication.MedicationIngredientComponent e : element.getIngredient()) 
45501          composeMedicationMedicationIngredientComponent(null, e);
45502        closeArray();
45503      };
45504      if (element.hasBatch()) {
45505        composeMedicationMedicationBatchComponent("batch", element.getBatch());
45506      }
45507  }
45508
45509  protected void composeMedicationMedicationIngredientComponent(String name, Medication.MedicationIngredientComponent element) throws IOException {
45510    if (element != null) {
45511      open(name);
45512      composeMedicationMedicationIngredientComponentInner(element);
45513      close();
45514    }
45515  }
45516
45517  protected void composeMedicationMedicationIngredientComponentInner(Medication.MedicationIngredientComponent element) throws IOException {
45518      composeBackbone(element);
45519      if (element.hasItem()) {
45520        composeType("item", element.getItem());
45521      }
45522      if (element.hasIsActiveElement()) {
45523        composeBooleanCore("isActive", element.getIsActiveElement(), false);
45524        composeBooleanExtras("isActive", element.getIsActiveElement(), false);
45525      }
45526      if (element.hasStrength()) {
45527        composeRatio("strength", element.getStrength());
45528      }
45529  }
45530
45531  protected void composeMedicationMedicationBatchComponent(String name, Medication.MedicationBatchComponent element) throws IOException {
45532    if (element != null) {
45533      open(name);
45534      composeMedicationMedicationBatchComponentInner(element);
45535      close();
45536    }
45537  }
45538
45539  protected void composeMedicationMedicationBatchComponentInner(Medication.MedicationBatchComponent element) throws IOException {
45540      composeBackbone(element);
45541      if (element.hasLotNumberElement()) {
45542        composeStringCore("lotNumber", element.getLotNumberElement(), false);
45543        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
45544      }
45545      if (element.hasExpirationDateElement()) {
45546        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
45547        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
45548      }
45549  }
45550
45551  protected void composeMedicationAdministration(String name, MedicationAdministration element) throws IOException {
45552    if (element != null) {
45553      prop("resourceType", name);
45554      composeMedicationAdministrationInner(element);
45555    }
45556  }
45557
45558  protected void composeMedicationAdministrationInner(MedicationAdministration element) throws IOException {
45559      composeDomainResourceElements(element);
45560      if (element.hasIdentifier()) {
45561        openArray("identifier");
45562        for (Identifier e : element.getIdentifier()) 
45563          composeIdentifier(null, e);
45564        closeArray();
45565      };
45566      if (element.hasInstantiates()) {
45567        openArray("instantiates");
45568        for (UriType e : element.getInstantiates()) 
45569          composeUriCore(null, e, true);
45570        closeArray();
45571        if (anyHasExtras(element.getInstantiates())) {
45572          openArray("_instantiates");
45573          for (UriType e : element.getInstantiates()) 
45574            composeUriExtras(null, e, true);
45575          closeArray();
45576        }
45577      };
45578      if (element.hasPartOf()) {
45579        openArray("partOf");
45580        for (Reference e : element.getPartOf()) 
45581          composeReference(null, e);
45582        closeArray();
45583      };
45584      if (element.hasStatusElement()) {
45585        composeCodeCore("status", element.getStatusElement(), false);
45586        composeCodeExtras("status", element.getStatusElement(), false);
45587      }
45588      if (element.hasStatusReason()) {
45589        openArray("statusReason");
45590        for (CodeableConcept e : element.getStatusReason()) 
45591          composeCodeableConcept(null, e);
45592        closeArray();
45593      };
45594      if (element.hasCategory()) {
45595        composeCodeableConcept("category", element.getCategory());
45596      }
45597      if (element.hasMedication()) {
45598        composeType("medication", element.getMedication());
45599      }
45600      if (element.hasSubject()) {
45601        composeReference("subject", element.getSubject());
45602      }
45603      if (element.hasContext()) {
45604        composeReference("context", element.getContext());
45605      }
45606      if (element.hasSupportingInformation()) {
45607        openArray("supportingInformation");
45608        for (Reference e : element.getSupportingInformation()) 
45609          composeReference(null, e);
45610        closeArray();
45611      };
45612      if (element.hasEffective()) {
45613        composeType("effective", element.getEffective());
45614      }
45615      if (element.hasPerformer()) {
45616        openArray("performer");
45617        for (MedicationAdministration.MedicationAdministrationPerformerComponent e : element.getPerformer()) 
45618          composeMedicationAdministrationMedicationAdministrationPerformerComponent(null, e);
45619        closeArray();
45620      };
45621      if (element.hasReasonCode()) {
45622        openArray("reasonCode");
45623        for (CodeableConcept e : element.getReasonCode()) 
45624          composeCodeableConcept(null, e);
45625        closeArray();
45626      };
45627      if (element.hasReasonReference()) {
45628        openArray("reasonReference");
45629        for (Reference e : element.getReasonReference()) 
45630          composeReference(null, e);
45631        closeArray();
45632      };
45633      if (element.hasRequest()) {
45634        composeReference("request", element.getRequest());
45635      }
45636      if (element.hasDevice()) {
45637        openArray("device");
45638        for (Reference e : element.getDevice()) 
45639          composeReference(null, e);
45640        closeArray();
45641      };
45642      if (element.hasNote()) {
45643        openArray("note");
45644        for (Annotation e : element.getNote()) 
45645          composeAnnotation(null, e);
45646        closeArray();
45647      };
45648      if (element.hasDosage()) {
45649        composeMedicationAdministrationMedicationAdministrationDosageComponent("dosage", element.getDosage());
45650      }
45651      if (element.hasEventHistory()) {
45652        openArray("eventHistory");
45653        for (Reference e : element.getEventHistory()) 
45654          composeReference(null, e);
45655        closeArray();
45656      };
45657  }
45658
45659  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponent(String name, MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
45660    if (element != null) {
45661      open(name);
45662      composeMedicationAdministrationMedicationAdministrationPerformerComponentInner(element);
45663      close();
45664    }
45665  }
45666
45667  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponentInner(MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
45668      composeBackbone(element);
45669      if (element.hasFunction()) {
45670        composeCodeableConcept("function", element.getFunction());
45671      }
45672      if (element.hasActor()) {
45673        composeReference("actor", element.getActor());
45674      }
45675  }
45676
45677  protected void composeMedicationAdministrationMedicationAdministrationDosageComponent(String name, MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
45678    if (element != null) {
45679      open(name);
45680      composeMedicationAdministrationMedicationAdministrationDosageComponentInner(element);
45681      close();
45682    }
45683  }
45684
45685  protected void composeMedicationAdministrationMedicationAdministrationDosageComponentInner(MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
45686      composeBackbone(element);
45687      if (element.hasTextElement()) {
45688        composeStringCore("text", element.getTextElement(), false);
45689        composeStringExtras("text", element.getTextElement(), false);
45690      }
45691      if (element.hasSite()) {
45692        composeCodeableConcept("site", element.getSite());
45693      }
45694      if (element.hasRoute()) {
45695        composeCodeableConcept("route", element.getRoute());
45696      }
45697      if (element.hasMethod()) {
45698        composeCodeableConcept("method", element.getMethod());
45699      }
45700      if (element.hasDose()) {
45701        composeQuantity("dose", element.getDose());
45702      }
45703      if (element.hasRate()) {
45704        composeType("rate", element.getRate());
45705      }
45706  }
45707
45708  protected void composeMedicationDispense(String name, MedicationDispense element) throws IOException {
45709    if (element != null) {
45710      prop("resourceType", name);
45711      composeMedicationDispenseInner(element);
45712    }
45713  }
45714
45715  protected void composeMedicationDispenseInner(MedicationDispense element) throws IOException {
45716      composeDomainResourceElements(element);
45717      if (element.hasIdentifier()) {
45718        openArray("identifier");
45719        for (Identifier e : element.getIdentifier()) 
45720          composeIdentifier(null, e);
45721        closeArray();
45722      };
45723      if (element.hasPartOf()) {
45724        openArray("partOf");
45725        for (Reference e : element.getPartOf()) 
45726          composeReference(null, e);
45727        closeArray();
45728      };
45729      if (element.hasStatusElement()) {
45730        composeCodeCore("status", element.getStatusElement(), false);
45731        composeCodeExtras("status", element.getStatusElement(), false);
45732      }
45733      if (element.hasStatusReason()) {
45734        composeType("statusReason", element.getStatusReason());
45735      }
45736      if (element.hasCategory()) {
45737        composeCodeableConcept("category", element.getCategory());
45738      }
45739      if (element.hasMedication()) {
45740        composeType("medication", element.getMedication());
45741      }
45742      if (element.hasSubject()) {
45743        composeReference("subject", element.getSubject());
45744      }
45745      if (element.hasContext()) {
45746        composeReference("context", element.getContext());
45747      }
45748      if (element.hasSupportingInformation()) {
45749        openArray("supportingInformation");
45750        for (Reference e : element.getSupportingInformation()) 
45751          composeReference(null, e);
45752        closeArray();
45753      };
45754      if (element.hasPerformer()) {
45755        openArray("performer");
45756        for (MedicationDispense.MedicationDispensePerformerComponent e : element.getPerformer()) 
45757          composeMedicationDispenseMedicationDispensePerformerComponent(null, e);
45758        closeArray();
45759      };
45760      if (element.hasLocation()) {
45761        composeReference("location", element.getLocation());
45762      }
45763      if (element.hasAuthorizingPrescription()) {
45764        openArray("authorizingPrescription");
45765        for (Reference e : element.getAuthorizingPrescription()) 
45766          composeReference(null, e);
45767        closeArray();
45768      };
45769      if (element.hasType()) {
45770        composeCodeableConcept("type", element.getType());
45771      }
45772      if (element.hasQuantity()) {
45773        composeQuantity("quantity", element.getQuantity());
45774      }
45775      if (element.hasDaysSupply()) {
45776        composeQuantity("daysSupply", element.getDaysSupply());
45777      }
45778      if (element.hasWhenPreparedElement()) {
45779        composeDateTimeCore("whenPrepared", element.getWhenPreparedElement(), false);
45780        composeDateTimeExtras("whenPrepared", element.getWhenPreparedElement(), false);
45781      }
45782      if (element.hasWhenHandedOverElement()) {
45783        composeDateTimeCore("whenHandedOver", element.getWhenHandedOverElement(), false);
45784        composeDateTimeExtras("whenHandedOver", element.getWhenHandedOverElement(), false);
45785      }
45786      if (element.hasDestination()) {
45787        composeReference("destination", element.getDestination());
45788      }
45789      if (element.hasReceiver()) {
45790        openArray("receiver");
45791        for (Reference e : element.getReceiver()) 
45792          composeReference(null, e);
45793        closeArray();
45794      };
45795      if (element.hasNote()) {
45796        openArray("note");
45797        for (Annotation e : element.getNote()) 
45798          composeAnnotation(null, e);
45799        closeArray();
45800      };
45801      if (element.hasDosageInstruction()) {
45802        openArray("dosageInstruction");
45803        for (Dosage e : element.getDosageInstruction()) 
45804          composeDosage(null, e);
45805        closeArray();
45806      };
45807      if (element.hasSubstitution()) {
45808        composeMedicationDispenseMedicationDispenseSubstitutionComponent("substitution", element.getSubstitution());
45809      }
45810      if (element.hasDetectedIssue()) {
45811        openArray("detectedIssue");
45812        for (Reference e : element.getDetectedIssue()) 
45813          composeReference(null, e);
45814        closeArray();
45815      };
45816      if (element.hasEventHistory()) {
45817        openArray("eventHistory");
45818        for (Reference e : element.getEventHistory()) 
45819          composeReference(null, e);
45820        closeArray();
45821      };
45822  }
45823
45824  protected void composeMedicationDispenseMedicationDispensePerformerComponent(String name, MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
45825    if (element != null) {
45826      open(name);
45827      composeMedicationDispenseMedicationDispensePerformerComponentInner(element);
45828      close();
45829    }
45830  }
45831
45832  protected void composeMedicationDispenseMedicationDispensePerformerComponentInner(MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
45833      composeBackbone(element);
45834      if (element.hasFunction()) {
45835        composeCodeableConcept("function", element.getFunction());
45836      }
45837      if (element.hasActor()) {
45838        composeReference("actor", element.getActor());
45839      }
45840  }
45841
45842  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponent(String name, MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
45843    if (element != null) {
45844      open(name);
45845      composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(element);
45846      close();
45847    }
45848  }
45849
45850  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
45851      composeBackbone(element);
45852      if (element.hasWasSubstitutedElement()) {
45853        composeBooleanCore("wasSubstituted", element.getWasSubstitutedElement(), false);
45854        composeBooleanExtras("wasSubstituted", element.getWasSubstitutedElement(), false);
45855      }
45856      if (element.hasType()) {
45857        composeCodeableConcept("type", element.getType());
45858      }
45859      if (element.hasReason()) {
45860        openArray("reason");
45861        for (CodeableConcept e : element.getReason()) 
45862          composeCodeableConcept(null, e);
45863        closeArray();
45864      };
45865      if (element.hasResponsibleParty()) {
45866        openArray("responsibleParty");
45867        for (Reference e : element.getResponsibleParty()) 
45868          composeReference(null, e);
45869        closeArray();
45870      };
45871  }
45872
45873  protected void composeMedicationKnowledge(String name, MedicationKnowledge element) throws IOException {
45874    if (element != null) {
45875      prop("resourceType", name);
45876      composeMedicationKnowledgeInner(element);
45877    }
45878  }
45879
45880  protected void composeMedicationKnowledgeInner(MedicationKnowledge element) throws IOException {
45881      composeDomainResourceElements(element);
45882      if (element.hasCode()) {
45883        composeCodeableConcept("code", element.getCode());
45884      }
45885      if (element.hasStatusElement()) {
45886        composeCodeCore("status", element.getStatusElement(), false);
45887        composeCodeExtras("status", element.getStatusElement(), false);
45888      }
45889      if (element.hasManufacturer()) {
45890        composeReference("manufacturer", element.getManufacturer());
45891      }
45892      if (element.hasDoseForm()) {
45893        composeCodeableConcept("doseForm", element.getDoseForm());
45894      }
45895      if (element.hasAmount()) {
45896        composeQuantity("amount", element.getAmount());
45897      }
45898      if (element.hasSynonym()) {
45899        openArray("synonym");
45900        for (StringType e : element.getSynonym()) 
45901          composeStringCore(null, e, true);
45902        closeArray();
45903        if (anyHasExtras(element.getSynonym())) {
45904          openArray("_synonym");
45905          for (StringType e : element.getSynonym()) 
45906            composeStringExtras(null, e, true);
45907          closeArray();
45908        }
45909      };
45910      if (element.hasRelatedMedicationKnowledge()) {
45911        openArray("relatedMedicationKnowledge");
45912        for (MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent e : element.getRelatedMedicationKnowledge()) 
45913          composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(null, e);
45914        closeArray();
45915      };
45916      if (element.hasAssociatedMedication()) {
45917        openArray("associatedMedication");
45918        for (Reference e : element.getAssociatedMedication()) 
45919          composeReference(null, e);
45920        closeArray();
45921      };
45922      if (element.hasProductType()) {
45923        openArray("productType");
45924        for (CodeableConcept e : element.getProductType()) 
45925          composeCodeableConcept(null, e);
45926        closeArray();
45927      };
45928      if (element.hasMonograph()) {
45929        openArray("monograph");
45930        for (MedicationKnowledge.MedicationKnowledgeMonographComponent e : element.getMonograph()) 
45931          composeMedicationKnowledgeMedicationKnowledgeMonographComponent(null, e);
45932        closeArray();
45933      };
45934      if (element.hasIngredient()) {
45935        openArray("ingredient");
45936        for (MedicationKnowledge.MedicationKnowledgeIngredientComponent e : element.getIngredient()) 
45937          composeMedicationKnowledgeMedicationKnowledgeIngredientComponent(null, e);
45938        closeArray();
45939      };
45940      if (element.hasPreparationInstructionElement()) {
45941        composeMarkdownCore("preparationInstruction", element.getPreparationInstructionElement(), false);
45942        composeMarkdownExtras("preparationInstruction", element.getPreparationInstructionElement(), false);
45943      }
45944      if (element.hasIntendedRoute()) {
45945        openArray("intendedRoute");
45946        for (CodeableConcept e : element.getIntendedRoute()) 
45947          composeCodeableConcept(null, e);
45948        closeArray();
45949      };
45950      if (element.hasCost()) {
45951        openArray("cost");
45952        for (MedicationKnowledge.MedicationKnowledgeCostComponent e : element.getCost()) 
45953          composeMedicationKnowledgeMedicationKnowledgeCostComponent(null, e);
45954        closeArray();
45955      };
45956      if (element.hasMonitoringProgram()) {
45957        openArray("monitoringProgram");
45958        for (MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent e : element.getMonitoringProgram()) 
45959          composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(null, e);
45960        closeArray();
45961      };
45962      if (element.hasAdministrationGuidelines()) {
45963        openArray("administrationGuidelines");
45964        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent e : element.getAdministrationGuidelines()) 
45965          composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(null, e);
45966        closeArray();
45967      };
45968      if (element.hasMedicineClassification()) {
45969        openArray("medicineClassification");
45970        for (MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent e : element.getMedicineClassification()) 
45971          composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(null, e);
45972        closeArray();
45973      };
45974      if (element.hasPackaging()) {
45975        composeMedicationKnowledgeMedicationKnowledgePackagingComponent("packaging", element.getPackaging());
45976      }
45977      if (element.hasDrugCharacteristic()) {
45978        openArray("drugCharacteristic");
45979        for (MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent e : element.getDrugCharacteristic()) 
45980          composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(null, e);
45981        closeArray();
45982      };
45983      if (element.hasContraindication()) {
45984        openArray("contraindication");
45985        for (Reference e : element.getContraindication()) 
45986          composeReference(null, e);
45987        closeArray();
45988      };
45989      if (element.hasRegulatory()) {
45990        openArray("regulatory");
45991        for (MedicationKnowledge.MedicationKnowledgeRegulatoryComponent e : element.getRegulatory()) 
45992          composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(null, e);
45993        closeArray();
45994      };
45995      if (element.hasKinetics()) {
45996        openArray("kinetics");
45997        for (MedicationKnowledge.MedicationKnowledgeKineticsComponent e : element.getKinetics()) 
45998          composeMedicationKnowledgeMedicationKnowledgeKineticsComponent(null, e);
45999        closeArray();
46000      };
46001  }
46002
46003  protected void composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(String name, MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
46004    if (element != null) {
46005      open(name);
46006      composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentInner(element);
46007      close();
46008    }
46009  }
46010
46011  protected void composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentInner(MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
46012      composeBackbone(element);
46013      if (element.hasType()) {
46014        composeCodeableConcept("type", element.getType());
46015      }
46016      if (element.hasReference()) {
46017        openArray("reference");
46018        for (Reference e : element.getReference()) 
46019          composeReference(null, e);
46020        closeArray();
46021      };
46022  }
46023
46024  protected void composeMedicationKnowledgeMedicationKnowledgeMonographComponent(String name, MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
46025    if (element != null) {
46026      open(name);
46027      composeMedicationKnowledgeMedicationKnowledgeMonographComponentInner(element);
46028      close();
46029    }
46030  }
46031
46032  protected void composeMedicationKnowledgeMedicationKnowledgeMonographComponentInner(MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
46033      composeBackbone(element);
46034      if (element.hasType()) {
46035        composeCodeableConcept("type", element.getType());
46036      }
46037      if (element.hasSource()) {
46038        composeReference("source", element.getSource());
46039      }
46040  }
46041
46042  protected void composeMedicationKnowledgeMedicationKnowledgeIngredientComponent(String name, MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
46043    if (element != null) {
46044      open(name);
46045      composeMedicationKnowledgeMedicationKnowledgeIngredientComponentInner(element);
46046      close();
46047    }
46048  }
46049
46050  protected void composeMedicationKnowledgeMedicationKnowledgeIngredientComponentInner(MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
46051      composeBackbone(element);
46052      if (element.hasItem()) {
46053        composeType("item", element.getItem());
46054      }
46055      if (element.hasIsActiveElement()) {
46056        composeBooleanCore("isActive", element.getIsActiveElement(), false);
46057        composeBooleanExtras("isActive", element.getIsActiveElement(), false);
46058      }
46059      if (element.hasStrength()) {
46060        composeRatio("strength", element.getStrength());
46061      }
46062  }
46063
46064  protected void composeMedicationKnowledgeMedicationKnowledgeCostComponent(String name, MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
46065    if (element != null) {
46066      open(name);
46067      composeMedicationKnowledgeMedicationKnowledgeCostComponentInner(element);
46068      close();
46069    }
46070  }
46071
46072  protected void composeMedicationKnowledgeMedicationKnowledgeCostComponentInner(MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
46073      composeBackbone(element);
46074      if (element.hasType()) {
46075        composeCodeableConcept("type", element.getType());
46076      }
46077      if (element.hasSourceElement()) {
46078        composeStringCore("source", element.getSourceElement(), false);
46079        composeStringExtras("source", element.getSourceElement(), false);
46080      }
46081      if (element.hasCost()) {
46082        composeMoney("cost", element.getCost());
46083      }
46084  }
46085
46086  protected void composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(String name, MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
46087    if (element != null) {
46088      open(name);
46089      composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentInner(element);
46090      close();
46091    }
46092  }
46093
46094  protected void composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentInner(MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
46095      composeBackbone(element);
46096      if (element.hasType()) {
46097        composeCodeableConcept("type", element.getType());
46098      }
46099      if (element.hasNameElement()) {
46100        composeStringCore("name", element.getNameElement(), false);
46101        composeStringExtras("name", element.getNameElement(), false);
46102      }
46103  }
46104
46105  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent element) throws IOException {
46106    if (element != null) {
46107      open(name);
46108      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentInner(element);
46109      close();
46110    }
46111  }
46112
46113  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentInner(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent element) throws IOException {
46114      composeBackbone(element);
46115      if (element.hasDosage()) {
46116        openArray("dosage");
46117        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent e : element.getDosage()) 
46118          composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(null, e);
46119        closeArray();
46120      };
46121      if (element.hasIndication()) {
46122        composeType("indication", element.getIndication());
46123      }
46124      if (element.hasPatientCharacteristics()) {
46125        openArray("patientCharacteristics");
46126        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent e : element.getPatientCharacteristics()) 
46127          composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(null, e);
46128        closeArray();
46129      };
46130  }
46131
46132  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent element) throws IOException {
46133    if (element != null) {
46134      open(name);
46135      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentInner(element);
46136      close();
46137    }
46138  }
46139
46140  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentInner(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent element) throws IOException {
46141      composeBackbone(element);
46142      if (element.hasType()) {
46143        composeCodeableConcept("type", element.getType());
46144      }
46145      if (element.hasDosage()) {
46146        openArray("dosage");
46147        for (Dosage e : element.getDosage()) 
46148          composeDosage(null, e);
46149        closeArray();
46150      };
46151  }
46152
46153  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent element) throws IOException {
46154    if (element != null) {
46155      open(name);
46156      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentInner(element);
46157      close();
46158    }
46159  }
46160
46161  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentInner(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent element) throws IOException {
46162      composeBackbone(element);
46163      if (element.hasCharacteristic()) {
46164        composeType("characteristic", element.getCharacteristic());
46165      }
46166      if (element.hasValue()) {
46167        openArray("value");
46168        for (StringType e : element.getValue()) 
46169          composeStringCore(null, e, true);
46170        closeArray();
46171        if (anyHasExtras(element.getValue())) {
46172          openArray("_value");
46173          for (StringType e : element.getValue()) 
46174            composeStringExtras(null, e, true);
46175          closeArray();
46176        }
46177      };
46178  }
46179
46180  protected void composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(String name, MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
46181    if (element != null) {
46182      open(name);
46183      composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentInner(element);
46184      close();
46185    }
46186  }
46187
46188  protected void composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentInner(MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
46189      composeBackbone(element);
46190      if (element.hasType()) {
46191        composeCodeableConcept("type", element.getType());
46192      }
46193      if (element.hasClassification()) {
46194        openArray("classification");
46195        for (CodeableConcept e : element.getClassification()) 
46196          composeCodeableConcept(null, e);
46197        closeArray();
46198      };
46199  }
46200
46201  protected void composeMedicationKnowledgeMedicationKnowledgePackagingComponent(String name, MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
46202    if (element != null) {
46203      open(name);
46204      composeMedicationKnowledgeMedicationKnowledgePackagingComponentInner(element);
46205      close();
46206    }
46207  }
46208
46209  protected void composeMedicationKnowledgeMedicationKnowledgePackagingComponentInner(MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
46210      composeBackbone(element);
46211      if (element.hasType()) {
46212        composeCodeableConcept("type", element.getType());
46213      }
46214      if (element.hasQuantity()) {
46215        composeQuantity("quantity", element.getQuantity());
46216      }
46217  }
46218
46219  protected void composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(String name, MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
46220    if (element != null) {
46221      open(name);
46222      composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentInner(element);
46223      close();
46224    }
46225  }
46226
46227  protected void composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentInner(MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
46228      composeBackbone(element);
46229      if (element.hasType()) {
46230        composeCodeableConcept("type", element.getType());
46231      }
46232      if (element.hasValue()) {
46233        composeType("value", element.getValue());
46234      }
46235  }
46236
46237  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
46238    if (element != null) {
46239      open(name);
46240      composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponentInner(element);
46241      close();
46242    }
46243  }
46244
46245  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponentInner(MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
46246      composeBackbone(element);
46247      if (element.hasRegulatoryAuthority()) {
46248        composeReference("regulatoryAuthority", element.getRegulatoryAuthority());
46249      }
46250      if (element.hasSubstitution()) {
46251        openArray("substitution");
46252        for (MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent e : element.getSubstitution()) 
46253          composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(null, e);
46254        closeArray();
46255      };
46256      if (element.hasSchedule()) {
46257        openArray("schedule");
46258        for (MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent e : element.getSchedule()) 
46259          composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(null, e);
46260        closeArray();
46261      };
46262      if (element.hasMaxDispense()) {
46263        composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent("maxDispense", element.getMaxDispense());
46264      }
46265  }
46266
46267  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
46268    if (element != null) {
46269      open(name);
46270      composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentInner(element);
46271      close();
46272    }
46273  }
46274
46275  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentInner(MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
46276      composeBackbone(element);
46277      if (element.hasType()) {
46278        composeCodeableConcept("type", element.getType());
46279      }
46280      if (element.hasAllowedElement()) {
46281        composeBooleanCore("allowed", element.getAllowedElement(), false);
46282        composeBooleanExtras("allowed", element.getAllowedElement(), false);
46283      }
46284  }
46285
46286  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent element) throws IOException {
46287    if (element != null) {
46288      open(name);
46289      composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentInner(element);
46290      close();
46291    }
46292  }
46293
46294  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentInner(MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent element) throws IOException {
46295      composeBackbone(element);
46296      if (element.hasSchedule()) {
46297        composeCodeableConcept("schedule", element.getSchedule());
46298      }
46299  }
46300
46301  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
46302    if (element != null) {
46303      open(name);
46304      composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentInner(element);
46305      close();
46306    }
46307  }
46308
46309  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentInner(MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
46310      composeBackbone(element);
46311      if (element.hasQuantity()) {
46312        composeQuantity("quantity", element.getQuantity());
46313      }
46314      if (element.hasPeriod()) {
46315        composeDuration("period", element.getPeriod());
46316      }
46317  }
46318
46319  protected void composeMedicationKnowledgeMedicationKnowledgeKineticsComponent(String name, MedicationKnowledge.MedicationKnowledgeKineticsComponent element) throws IOException {
46320    if (element != null) {
46321      open(name);
46322      composeMedicationKnowledgeMedicationKnowledgeKineticsComponentInner(element);
46323      close();
46324    }
46325  }
46326
46327  protected void composeMedicationKnowledgeMedicationKnowledgeKineticsComponentInner(MedicationKnowledge.MedicationKnowledgeKineticsComponent element) throws IOException {
46328      composeBackbone(element);
46329      if (element.hasAreaUnderCurve()) {
46330        openArray("areaUnderCurve");
46331        for (Quantity e : element.getAreaUnderCurve()) 
46332          composeQuantity(null, e);
46333        closeArray();
46334      };
46335      if (element.hasLethalDose50()) {
46336        openArray("lethalDose50");
46337        for (Quantity e : element.getLethalDose50()) 
46338          composeQuantity(null, e);
46339        closeArray();
46340      };
46341      if (element.hasHalfLifePeriod()) {
46342        composeDuration("halfLifePeriod", element.getHalfLifePeriod());
46343      }
46344  }
46345
46346  protected void composeMedicationRequest(String name, MedicationRequest element) throws IOException {
46347    if (element != null) {
46348      prop("resourceType", name);
46349      composeMedicationRequestInner(element);
46350    }
46351  }
46352
46353  protected void composeMedicationRequestInner(MedicationRequest element) throws IOException {
46354      composeDomainResourceElements(element);
46355      if (element.hasIdentifier()) {
46356        openArray("identifier");
46357        for (Identifier e : element.getIdentifier()) 
46358          composeIdentifier(null, e);
46359        closeArray();
46360      };
46361      if (element.hasStatusElement()) {
46362        composeEnumerationCore("status", element.getStatusElement(), new MedicationRequest.MedicationRequestStatusEnumFactory(), false);
46363        composeEnumerationExtras("status", element.getStatusElement(), new MedicationRequest.MedicationRequestStatusEnumFactory(), false);
46364      }
46365      if (element.hasStatusReason()) {
46366        composeCodeableConcept("statusReason", element.getStatusReason());
46367      }
46368      if (element.hasIntentElement()) {
46369        composeEnumerationCore("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
46370        composeEnumerationExtras("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
46371      }
46372      if (element.hasCategory()) {
46373        openArray("category");
46374        for (CodeableConcept e : element.getCategory()) 
46375          composeCodeableConcept(null, e);
46376        closeArray();
46377      };
46378      if (element.hasPriorityElement()) {
46379        composeEnumerationCore("priority", element.getPriorityElement(), new MedicationRequest.MedicationRequestPriorityEnumFactory(), false);
46380        composeEnumerationExtras("priority", element.getPriorityElement(), new MedicationRequest.MedicationRequestPriorityEnumFactory(), false);
46381      }
46382      if (element.hasDoNotPerformElement()) {
46383        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
46384        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
46385      }
46386      if (element.hasReported()) {
46387        composeType("reported", element.getReported());
46388      }
46389      if (element.hasMedication()) {
46390        composeType("medication", element.getMedication());
46391      }
46392      if (element.hasSubject()) {
46393        composeReference("subject", element.getSubject());
46394      }
46395      if (element.hasEncounter()) {
46396        composeReference("encounter", element.getEncounter());
46397      }
46398      if (element.hasSupportingInformation()) {
46399        openArray("supportingInformation");
46400        for (Reference e : element.getSupportingInformation()) 
46401          composeReference(null, e);
46402        closeArray();
46403      };
46404      if (element.hasAuthoredOnElement()) {
46405        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
46406        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
46407      }
46408      if (element.hasRequester()) {
46409        composeReference("requester", element.getRequester());
46410      }
46411      if (element.hasPerformer()) {
46412        composeReference("performer", element.getPerformer());
46413      }
46414      if (element.hasPerformerType()) {
46415        composeCodeableConcept("performerType", element.getPerformerType());
46416      }
46417      if (element.hasRecorder()) {
46418        composeReference("recorder", element.getRecorder());
46419      }
46420      if (element.hasReasonCode()) {
46421        openArray("reasonCode");
46422        for (CodeableConcept e : element.getReasonCode()) 
46423          composeCodeableConcept(null, e);
46424        closeArray();
46425      };
46426      if (element.hasReasonReference()) {
46427        openArray("reasonReference");
46428        for (Reference e : element.getReasonReference()) 
46429          composeReference(null, e);
46430        closeArray();
46431      };
46432      if (element.hasInstantiatesCanonical()) {
46433        openArray("instantiatesCanonical");
46434        for (CanonicalType e : element.getInstantiatesCanonical()) 
46435          composeCanonicalCore(null, e, true);
46436        closeArray();
46437        if (anyHasExtras(element.getInstantiatesCanonical())) {
46438          openArray("_instantiatesCanonical");
46439          for (CanonicalType e : element.getInstantiatesCanonical()) 
46440            composeCanonicalExtras(null, e, true);
46441          closeArray();
46442        }
46443      };
46444      if (element.hasInstantiatesUri()) {
46445        openArray("instantiatesUri");
46446        for (UriType e : element.getInstantiatesUri()) 
46447          composeUriCore(null, e, true);
46448        closeArray();
46449        if (anyHasExtras(element.getInstantiatesUri())) {
46450          openArray("_instantiatesUri");
46451          for (UriType e : element.getInstantiatesUri()) 
46452            composeUriExtras(null, e, true);
46453          closeArray();
46454        }
46455      };
46456      if (element.hasBasedOn()) {
46457        openArray("basedOn");
46458        for (Reference e : element.getBasedOn()) 
46459          composeReference(null, e);
46460        closeArray();
46461      };
46462      if (element.hasGroupIdentifier()) {
46463        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
46464      }
46465      if (element.hasCourseOfTherapyType()) {
46466        composeCodeableConcept("courseOfTherapyType", element.getCourseOfTherapyType());
46467      }
46468      if (element.hasInsurance()) {
46469        openArray("insurance");
46470        for (Reference e : element.getInsurance()) 
46471          composeReference(null, e);
46472        closeArray();
46473      };
46474      if (element.hasNote()) {
46475        openArray("note");
46476        for (Annotation e : element.getNote()) 
46477          composeAnnotation(null, e);
46478        closeArray();
46479      };
46480      if (element.hasDosageInstruction()) {
46481        openArray("dosageInstruction");
46482        for (Dosage e : element.getDosageInstruction()) 
46483          composeDosage(null, e);
46484        closeArray();
46485      };
46486      if (element.hasDispenseRequest()) {
46487        composeMedicationRequestMedicationRequestDispenseRequestComponent("dispenseRequest", element.getDispenseRequest());
46488      }
46489      if (element.hasSubstitution()) {
46490        composeMedicationRequestMedicationRequestSubstitutionComponent("substitution", element.getSubstitution());
46491      }
46492      if (element.hasPriorPrescription()) {
46493        composeReference("priorPrescription", element.getPriorPrescription());
46494      }
46495      if (element.hasDetectedIssue()) {
46496        openArray("detectedIssue");
46497        for (Reference e : element.getDetectedIssue()) 
46498          composeReference(null, e);
46499        closeArray();
46500      };
46501      if (element.hasEventHistory()) {
46502        openArray("eventHistory");
46503        for (Reference e : element.getEventHistory()) 
46504          composeReference(null, e);
46505        closeArray();
46506      };
46507  }
46508
46509  protected void composeMedicationRequestMedicationRequestDispenseRequestComponent(String name, MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
46510    if (element != null) {
46511      open(name);
46512      composeMedicationRequestMedicationRequestDispenseRequestComponentInner(element);
46513      close();
46514    }
46515  }
46516
46517  protected void composeMedicationRequestMedicationRequestDispenseRequestComponentInner(MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
46518      composeBackbone(element);
46519      if (element.hasInitialFill()) {
46520        composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponent("initialFill", element.getInitialFill());
46521      }
46522      if (element.hasDispenseInterval()) {
46523        composeDuration("dispenseInterval", element.getDispenseInterval());
46524      }
46525      if (element.hasValidityPeriod()) {
46526        composePeriod("validityPeriod", element.getValidityPeriod());
46527      }
46528      if (element.hasNumberOfRepeatsAllowedElement()) {
46529        composeUnsignedIntCore("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
46530        composeUnsignedIntExtras("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
46531      }
46532      if (element.hasQuantity()) {
46533        composeQuantity("quantity", element.getQuantity());
46534      }
46535      if (element.hasExpectedSupplyDuration()) {
46536        composeDuration("expectedSupplyDuration", element.getExpectedSupplyDuration());
46537      }
46538      if (element.hasPerformer()) {
46539        composeReference("performer", element.getPerformer());
46540      }
46541  }
46542
46543  protected void composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponent(String name, MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
46544    if (element != null) {
46545      open(name);
46546      composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponentInner(element);
46547      close();
46548    }
46549  }
46550
46551  protected void composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponentInner(MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
46552      composeBackbone(element);
46553      if (element.hasQuantity()) {
46554        composeQuantity("quantity", element.getQuantity());
46555      }
46556      if (element.hasDuration()) {
46557        composeDuration("duration", element.getDuration());
46558      }
46559  }
46560
46561  protected void composeMedicationRequestMedicationRequestSubstitutionComponent(String name, MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
46562    if (element != null) {
46563      open(name);
46564      composeMedicationRequestMedicationRequestSubstitutionComponentInner(element);
46565      close();
46566    }
46567  }
46568
46569  protected void composeMedicationRequestMedicationRequestSubstitutionComponentInner(MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
46570      composeBackbone(element);
46571      if (element.hasAllowed()) {
46572        composeType("allowed", element.getAllowed());
46573      }
46574      if (element.hasReason()) {
46575        composeCodeableConcept("reason", element.getReason());
46576      }
46577  }
46578
46579  protected void composeMedicationStatement(String name, MedicationStatement element) throws IOException {
46580    if (element != null) {
46581      prop("resourceType", name);
46582      composeMedicationStatementInner(element);
46583    }
46584  }
46585
46586  protected void composeMedicationStatementInner(MedicationStatement element) throws IOException {
46587      composeDomainResourceElements(element);
46588      if (element.hasIdentifier()) {
46589        openArray("identifier");
46590        for (Identifier e : element.getIdentifier()) 
46591          composeIdentifier(null, e);
46592        closeArray();
46593      };
46594      if (element.hasBasedOn()) {
46595        openArray("basedOn");
46596        for (Reference e : element.getBasedOn()) 
46597          composeReference(null, e);
46598        closeArray();
46599      };
46600      if (element.hasPartOf()) {
46601        openArray("partOf");
46602        for (Reference e : element.getPartOf()) 
46603          composeReference(null, e);
46604        closeArray();
46605      };
46606      if (element.hasStatusElement()) {
46607        composeEnumerationCore("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
46608        composeEnumerationExtras("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
46609      }
46610      if (element.hasStatusReason()) {
46611        openArray("statusReason");
46612        for (CodeableConcept e : element.getStatusReason()) 
46613          composeCodeableConcept(null, e);
46614        closeArray();
46615      };
46616      if (element.hasCategory()) {
46617        composeCodeableConcept("category", element.getCategory());
46618      }
46619      if (element.hasMedication()) {
46620        composeType("medication", element.getMedication());
46621      }
46622      if (element.hasSubject()) {
46623        composeReference("subject", element.getSubject());
46624      }
46625      if (element.hasContext()) {
46626        composeReference("context", element.getContext());
46627      }
46628      if (element.hasEffective()) {
46629        composeType("effective", element.getEffective());
46630      }
46631      if (element.hasDateAssertedElement()) {
46632        composeDateTimeCore("dateAsserted", element.getDateAssertedElement(), false);
46633        composeDateTimeExtras("dateAsserted", element.getDateAssertedElement(), false);
46634      }
46635      if (element.hasInformationSource()) {
46636        composeReference("informationSource", element.getInformationSource());
46637      }
46638      if (element.hasDerivedFrom()) {
46639        openArray("derivedFrom");
46640        for (Reference e : element.getDerivedFrom()) 
46641          composeReference(null, e);
46642        closeArray();
46643      };
46644      if (element.hasReasonCode()) {
46645        openArray("reasonCode");
46646        for (CodeableConcept e : element.getReasonCode()) 
46647          composeCodeableConcept(null, e);
46648        closeArray();
46649      };
46650      if (element.hasReasonReference()) {
46651        openArray("reasonReference");
46652        for (Reference e : element.getReasonReference()) 
46653          composeReference(null, e);
46654        closeArray();
46655      };
46656      if (element.hasNote()) {
46657        openArray("note");
46658        for (Annotation e : element.getNote()) 
46659          composeAnnotation(null, e);
46660        closeArray();
46661      };
46662      if (element.hasDosage()) {
46663        openArray("dosage");
46664        for (Dosage e : element.getDosage()) 
46665          composeDosage(null, e);
46666        closeArray();
46667      };
46668  }
46669
46670  protected void composeMedicinalProduct(String name, MedicinalProduct element) throws IOException {
46671    if (element != null) {
46672      prop("resourceType", name);
46673      composeMedicinalProductInner(element);
46674    }
46675  }
46676
46677  protected void composeMedicinalProductInner(MedicinalProduct element) throws IOException {
46678      composeDomainResourceElements(element);
46679      if (element.hasIdentifier()) {
46680        openArray("identifier");
46681        for (Identifier e : element.getIdentifier()) 
46682          composeIdentifier(null, e);
46683        closeArray();
46684      };
46685      if (element.hasType()) {
46686        composeCodeableConcept("type", element.getType());
46687      }
46688      if (element.hasDomain()) {
46689        composeCoding("domain", element.getDomain());
46690      }
46691      if (element.hasCombinedPharmaceuticalDoseForm()) {
46692        composeCodeableConcept("combinedPharmaceuticalDoseForm", element.getCombinedPharmaceuticalDoseForm());
46693      }
46694      if (element.hasLegalStatusOfSupply()) {
46695        composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
46696      }
46697      if (element.hasAdditionalMonitoringIndicator()) {
46698        composeCodeableConcept("additionalMonitoringIndicator", element.getAdditionalMonitoringIndicator());
46699      }
46700      if (element.hasSpecialMeasures()) {
46701        openArray("specialMeasures");
46702        for (StringType e : element.getSpecialMeasures()) 
46703          composeStringCore(null, e, true);
46704        closeArray();
46705        if (anyHasExtras(element.getSpecialMeasures())) {
46706          openArray("_specialMeasures");
46707          for (StringType e : element.getSpecialMeasures()) 
46708            composeStringExtras(null, e, true);
46709          closeArray();
46710        }
46711      };
46712      if (element.hasPaediatricUseIndicator()) {
46713        composeCodeableConcept("paediatricUseIndicator", element.getPaediatricUseIndicator());
46714      }
46715      if (element.hasProductClassification()) {
46716        openArray("productClassification");
46717        for (CodeableConcept e : element.getProductClassification()) 
46718          composeCodeableConcept(null, e);
46719        closeArray();
46720      };
46721      if (element.hasMarketingStatus()) {
46722        openArray("marketingStatus");
46723        for (MarketingStatus e : element.getMarketingStatus()) 
46724          composeMarketingStatus(null, e);
46725        closeArray();
46726      };
46727      if (element.hasPharmaceuticalProduct()) {
46728        openArray("pharmaceuticalProduct");
46729        for (Reference e : element.getPharmaceuticalProduct()) 
46730          composeReference(null, e);
46731        closeArray();
46732      };
46733      if (element.hasPackagedMedicinalProduct()) {
46734        openArray("packagedMedicinalProduct");
46735        for (Reference e : element.getPackagedMedicinalProduct()) 
46736          composeReference(null, e);
46737        closeArray();
46738      };
46739      if (element.hasAttachedDocument()) {
46740        openArray("attachedDocument");
46741        for (Reference e : element.getAttachedDocument()) 
46742          composeReference(null, e);
46743        closeArray();
46744      };
46745      if (element.hasMasterFile()) {
46746        openArray("masterFile");
46747        for (Reference e : element.getMasterFile()) 
46748          composeReference(null, e);
46749        closeArray();
46750      };
46751      if (element.hasContact()) {
46752        openArray("contact");
46753        for (Reference e : element.getContact()) 
46754          composeReference(null, e);
46755        closeArray();
46756      };
46757      if (element.hasClinicalTrial()) {
46758        openArray("clinicalTrial");
46759        for (Reference e : element.getClinicalTrial()) 
46760          composeReference(null, e);
46761        closeArray();
46762      };
46763      if (element.hasName()) {
46764        openArray("name");
46765        for (MedicinalProduct.MedicinalProductNameComponent e : element.getName()) 
46766          composeMedicinalProductMedicinalProductNameComponent(null, e);
46767        closeArray();
46768      };
46769      if (element.hasCrossReference()) {
46770        openArray("crossReference");
46771        for (Identifier e : element.getCrossReference()) 
46772          composeIdentifier(null, e);
46773        closeArray();
46774      };
46775      if (element.hasManufacturingBusinessOperation()) {
46776        openArray("manufacturingBusinessOperation");
46777        for (MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent e : element.getManufacturingBusinessOperation()) 
46778          composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(null, e);
46779        closeArray();
46780      };
46781      if (element.hasSpecialDesignation()) {
46782        openArray("specialDesignation");
46783        for (MedicinalProduct.MedicinalProductSpecialDesignationComponent e : element.getSpecialDesignation()) 
46784          composeMedicinalProductMedicinalProductSpecialDesignationComponent(null, e);
46785        closeArray();
46786      };
46787  }
46788
46789  protected void composeMedicinalProductMedicinalProductNameComponent(String name, MedicinalProduct.MedicinalProductNameComponent element) throws IOException {
46790    if (element != null) {
46791      open(name);
46792      composeMedicinalProductMedicinalProductNameComponentInner(element);
46793      close();
46794    }
46795  }
46796
46797  protected void composeMedicinalProductMedicinalProductNameComponentInner(MedicinalProduct.MedicinalProductNameComponent element) throws IOException {
46798      composeBackbone(element);
46799      if (element.hasProductNameElement()) {
46800        composeStringCore("productName", element.getProductNameElement(), false);
46801        composeStringExtras("productName", element.getProductNameElement(), false);
46802      }
46803      if (element.hasNamePart()) {
46804        openArray("namePart");
46805        for (MedicinalProduct.MedicinalProductNameNamePartComponent e : element.getNamePart()) 
46806          composeMedicinalProductMedicinalProductNameNamePartComponent(null, e);
46807        closeArray();
46808      };
46809      if (element.hasCountryLanguage()) {
46810        openArray("countryLanguage");
46811        for (MedicinalProduct.MedicinalProductNameCountryLanguageComponent e : element.getCountryLanguage()) 
46812          composeMedicinalProductMedicinalProductNameCountryLanguageComponent(null, e);
46813        closeArray();
46814      };
46815  }
46816
46817  protected void composeMedicinalProductMedicinalProductNameNamePartComponent(String name, MedicinalProduct.MedicinalProductNameNamePartComponent element) throws IOException {
46818    if (element != null) {
46819      open(name);
46820      composeMedicinalProductMedicinalProductNameNamePartComponentInner(element);
46821      close();
46822    }
46823  }
46824
46825  protected void composeMedicinalProductMedicinalProductNameNamePartComponentInner(MedicinalProduct.MedicinalProductNameNamePartComponent element) throws IOException {
46826      composeBackbone(element);
46827      if (element.hasPartElement()) {
46828        composeStringCore("part", element.getPartElement(), false);
46829        composeStringExtras("part", element.getPartElement(), false);
46830      }
46831      if (element.hasType()) {
46832        composeCoding("type", element.getType());
46833      }
46834  }
46835
46836  protected void composeMedicinalProductMedicinalProductNameCountryLanguageComponent(String name, MedicinalProduct.MedicinalProductNameCountryLanguageComponent element) throws IOException {
46837    if (element != null) {
46838      open(name);
46839      composeMedicinalProductMedicinalProductNameCountryLanguageComponentInner(element);
46840      close();
46841    }
46842  }
46843
46844  protected void composeMedicinalProductMedicinalProductNameCountryLanguageComponentInner(MedicinalProduct.MedicinalProductNameCountryLanguageComponent element) throws IOException {
46845      composeBackbone(element);
46846      if (element.hasCountry()) {
46847        composeCodeableConcept("country", element.getCountry());
46848      }
46849      if (element.hasJurisdiction()) {
46850        composeCodeableConcept("jurisdiction", element.getJurisdiction());
46851      }
46852      if (element.hasLanguage()) {
46853        composeCodeableConcept("language", element.getLanguage());
46854      }
46855  }
46856
46857  protected void composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(String name, MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent element) throws IOException {
46858    if (element != null) {
46859      open(name);
46860      composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponentInner(element);
46861      close();
46862    }
46863  }
46864
46865  protected void composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponentInner(MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent element) throws IOException {
46866      composeBackbone(element);
46867      if (element.hasOperationType()) {
46868        composeCodeableConcept("operationType", element.getOperationType());
46869      }
46870      if (element.hasAuthorisationReferenceNumber()) {
46871        composeIdentifier("authorisationReferenceNumber", element.getAuthorisationReferenceNumber());
46872      }
46873      if (element.hasEffectiveDateElement()) {
46874        composeDateTimeCore("effectiveDate", element.getEffectiveDateElement(), false);
46875        composeDateTimeExtras("effectiveDate", element.getEffectiveDateElement(), false);
46876      }
46877      if (element.hasConfidentialityIndicator()) {
46878        composeCodeableConcept("confidentialityIndicator", element.getConfidentialityIndicator());
46879      }
46880      if (element.hasManufacturer()) {
46881        openArray("manufacturer");
46882        for (Reference e : element.getManufacturer()) 
46883          composeReference(null, e);
46884        closeArray();
46885      };
46886      if (element.hasRegulator()) {
46887        composeReference("regulator", element.getRegulator());
46888      }
46889  }
46890
46891  protected void composeMedicinalProductMedicinalProductSpecialDesignationComponent(String name, MedicinalProduct.MedicinalProductSpecialDesignationComponent element) throws IOException {
46892    if (element != null) {
46893      open(name);
46894      composeMedicinalProductMedicinalProductSpecialDesignationComponentInner(element);
46895      close();
46896    }
46897  }
46898
46899  protected void composeMedicinalProductMedicinalProductSpecialDesignationComponentInner(MedicinalProduct.MedicinalProductSpecialDesignationComponent element) throws IOException {
46900      composeBackbone(element);
46901      if (element.hasIdentifier()) {
46902        openArray("identifier");
46903        for (Identifier e : element.getIdentifier()) 
46904          composeIdentifier(null, e);
46905        closeArray();
46906      };
46907      if (element.hasType()) {
46908        composeCodeableConcept("type", element.getType());
46909      }
46910      if (element.hasIntendedUse()) {
46911        composeCodeableConcept("intendedUse", element.getIntendedUse());
46912      }
46913      if (element.hasIndication()) {
46914        composeType("indication", element.getIndication());
46915      }
46916      if (element.hasStatus()) {
46917        composeCodeableConcept("status", element.getStatus());
46918      }
46919      if (element.hasDateElement()) {
46920        composeDateTimeCore("date", element.getDateElement(), false);
46921        composeDateTimeExtras("date", element.getDateElement(), false);
46922      }
46923      if (element.hasSpecies()) {
46924        composeCodeableConcept("species", element.getSpecies());
46925      }
46926  }
46927
46928  protected void composeMedicinalProductAuthorization(String name, MedicinalProductAuthorization element) throws IOException {
46929    if (element != null) {
46930      prop("resourceType", name);
46931      composeMedicinalProductAuthorizationInner(element);
46932    }
46933  }
46934
46935  protected void composeMedicinalProductAuthorizationInner(MedicinalProductAuthorization element) throws IOException {
46936      composeDomainResourceElements(element);
46937      if (element.hasIdentifier()) {
46938        openArray("identifier");
46939        for (Identifier e : element.getIdentifier()) 
46940          composeIdentifier(null, e);
46941        closeArray();
46942      };
46943      if (element.hasSubject()) {
46944        composeReference("subject", element.getSubject());
46945      }
46946      if (element.hasCountry()) {
46947        openArray("country");
46948        for (CodeableConcept e : element.getCountry()) 
46949          composeCodeableConcept(null, e);
46950        closeArray();
46951      };
46952      if (element.hasJurisdiction()) {
46953        openArray("jurisdiction");
46954        for (CodeableConcept e : element.getJurisdiction()) 
46955          composeCodeableConcept(null, e);
46956        closeArray();
46957      };
46958      if (element.hasStatus()) {
46959        composeCodeableConcept("status", element.getStatus());
46960      }
46961      if (element.hasStatusDateElement()) {
46962        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
46963        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
46964      }
46965      if (element.hasRestoreDateElement()) {
46966        composeDateTimeCore("restoreDate", element.getRestoreDateElement(), false);
46967        composeDateTimeExtras("restoreDate", element.getRestoreDateElement(), false);
46968      }
46969      if (element.hasValidityPeriod()) {
46970        composePeriod("validityPeriod", element.getValidityPeriod());
46971      }
46972      if (element.hasDataExclusivityPeriod()) {
46973        composePeriod("dataExclusivityPeriod", element.getDataExclusivityPeriod());
46974      }
46975      if (element.hasDateOfFirstAuthorizationElement()) {
46976        composeDateTimeCore("dateOfFirstAuthorization", element.getDateOfFirstAuthorizationElement(), false);
46977        composeDateTimeExtras("dateOfFirstAuthorization", element.getDateOfFirstAuthorizationElement(), false);
46978      }
46979      if (element.hasInternationalBirthDateElement()) {
46980        composeDateTimeCore("internationalBirthDate", element.getInternationalBirthDateElement(), false);
46981        composeDateTimeExtras("internationalBirthDate", element.getInternationalBirthDateElement(), false);
46982      }
46983      if (element.hasLegalBasis()) {
46984        composeCodeableConcept("legalBasis", element.getLegalBasis());
46985      }
46986      if (element.hasJurisdictionalAuthorization()) {
46987        openArray("jurisdictionalAuthorization");
46988        for (MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent e : element.getJurisdictionalAuthorization()) 
46989          composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(null, e);
46990        closeArray();
46991      };
46992      if (element.hasHolder()) {
46993        composeReference("holder", element.getHolder());
46994      }
46995      if (element.hasRegulator()) {
46996        composeReference("regulator", element.getRegulator());
46997      }
46998      if (element.hasProcedure()) {
46999        composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent("procedure", element.getProcedure());
47000      }
47001  }
47002
47003  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(String name, MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent element) throws IOException {
47004    if (element != null) {
47005      open(name);
47006      composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentInner(element);
47007      close();
47008    }
47009  }
47010
47011  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentInner(MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent element) throws IOException {
47012      composeBackbone(element);
47013      if (element.hasIdentifier()) {
47014        openArray("identifier");
47015        for (Identifier e : element.getIdentifier()) 
47016          composeIdentifier(null, e);
47017        closeArray();
47018      };
47019      if (element.hasCountry()) {
47020        composeCodeableConcept("country", element.getCountry());
47021      }
47022      if (element.hasJurisdiction()) {
47023        openArray("jurisdiction");
47024        for (CodeableConcept e : element.getJurisdiction()) 
47025          composeCodeableConcept(null, e);
47026        closeArray();
47027      };
47028      if (element.hasLegalStatusOfSupply()) {
47029        composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
47030      }
47031      if (element.hasValidityPeriod()) {
47032        composePeriod("validityPeriod", element.getValidityPeriod());
47033      }
47034  }
47035
47036  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(String name, MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent element) throws IOException {
47037    if (element != null) {
47038      open(name);
47039      composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentInner(element);
47040      close();
47041    }
47042  }
47043
47044  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentInner(MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent element) throws IOException {
47045      composeBackbone(element);
47046      if (element.hasIdentifier()) {
47047        composeIdentifier("identifier", element.getIdentifier());
47048      }
47049      if (element.hasType()) {
47050        composeCodeableConcept("type", element.getType());
47051      }
47052      if (element.hasDate()) {
47053        composeType("date", element.getDate());
47054      }
47055      if (element.hasApplication()) {
47056        openArray("application");
47057        for (MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent e : element.getApplication()) 
47058          composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(null, e);
47059        closeArray();
47060      };
47061  }
47062
47063  protected void composeMedicinalProductContraindication(String name, MedicinalProductContraindication element) throws IOException {
47064    if (element != null) {
47065      prop("resourceType", name);
47066      composeMedicinalProductContraindicationInner(element);
47067    }
47068  }
47069
47070  protected void composeMedicinalProductContraindicationInner(MedicinalProductContraindication element) throws IOException {
47071      composeDomainResourceElements(element);
47072      if (element.hasSubject()) {
47073        openArray("subject");
47074        for (Reference e : element.getSubject()) 
47075          composeReference(null, e);
47076        closeArray();
47077      };
47078      if (element.hasDisease()) {
47079        composeCodeableConcept("disease", element.getDisease());
47080      }
47081      if (element.hasDiseaseStatus()) {
47082        composeCodeableConcept("diseaseStatus", element.getDiseaseStatus());
47083      }
47084      if (element.hasComorbidity()) {
47085        openArray("comorbidity");
47086        for (CodeableConcept e : element.getComorbidity()) 
47087          composeCodeableConcept(null, e);
47088        closeArray();
47089      };
47090      if (element.hasTherapeuticIndication()) {
47091        openArray("therapeuticIndication");
47092        for (Reference e : element.getTherapeuticIndication()) 
47093          composeReference(null, e);
47094        closeArray();
47095      };
47096      if (element.hasOtherTherapy()) {
47097        openArray("otherTherapy");
47098        for (MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent e : element.getOtherTherapy()) 
47099          composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(null, e);
47100        closeArray();
47101      };
47102      if (element.hasPopulation()) {
47103        openArray("population");
47104        for (Population e : element.getPopulation()) 
47105          composePopulation(null, e);
47106        closeArray();
47107      };
47108  }
47109
47110  protected void composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(String name, MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent element) throws IOException {
47111    if (element != null) {
47112      open(name);
47113      composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentInner(element);
47114      close();
47115    }
47116  }
47117
47118  protected void composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentInner(MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent element) throws IOException {
47119      composeBackbone(element);
47120      if (element.hasTherapyRelationshipType()) {
47121        composeCodeableConcept("therapyRelationshipType", element.getTherapyRelationshipType());
47122      }
47123      if (element.hasMedication()) {
47124        composeType("medication", element.getMedication());
47125      }
47126  }
47127
47128  protected void composeMedicinalProductIndication(String name, MedicinalProductIndication element) throws IOException {
47129    if (element != null) {
47130      prop("resourceType", name);
47131      composeMedicinalProductIndicationInner(element);
47132    }
47133  }
47134
47135  protected void composeMedicinalProductIndicationInner(MedicinalProductIndication element) throws IOException {
47136      composeDomainResourceElements(element);
47137      if (element.hasSubject()) {
47138        openArray("subject");
47139        for (Reference e : element.getSubject()) 
47140          composeReference(null, e);
47141        closeArray();
47142      };
47143      if (element.hasDiseaseSymptomProcedure()) {
47144        composeCodeableConcept("diseaseSymptomProcedure", element.getDiseaseSymptomProcedure());
47145      }
47146      if (element.hasDiseaseStatus()) {
47147        composeCodeableConcept("diseaseStatus", element.getDiseaseStatus());
47148      }
47149      if (element.hasComorbidity()) {
47150        openArray("comorbidity");
47151        for (CodeableConcept e : element.getComorbidity()) 
47152          composeCodeableConcept(null, e);
47153        closeArray();
47154      };
47155      if (element.hasIntendedEffect()) {
47156        composeCodeableConcept("intendedEffect", element.getIntendedEffect());
47157      }
47158      if (element.hasDuration()) {
47159        composeQuantity("duration", element.getDuration());
47160      }
47161      if (element.hasOtherTherapy()) {
47162        openArray("otherTherapy");
47163        for (MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent e : element.getOtherTherapy()) 
47164          composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(null, e);
47165        closeArray();
47166      };
47167      if (element.hasUndesirableEffect()) {
47168        openArray("undesirableEffect");
47169        for (Reference e : element.getUndesirableEffect()) 
47170          composeReference(null, e);
47171        closeArray();
47172      };
47173      if (element.hasPopulation()) {
47174        openArray("population");
47175        for (Population e : element.getPopulation()) 
47176          composePopulation(null, e);
47177        closeArray();
47178      };
47179  }
47180
47181  protected void composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(String name, MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent element) throws IOException {
47182    if (element != null) {
47183      open(name);
47184      composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentInner(element);
47185      close();
47186    }
47187  }
47188
47189  protected void composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentInner(MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent element) throws IOException {
47190      composeBackbone(element);
47191      if (element.hasTherapyRelationshipType()) {
47192        composeCodeableConcept("therapyRelationshipType", element.getTherapyRelationshipType());
47193      }
47194      if (element.hasMedication()) {
47195        composeType("medication", element.getMedication());
47196      }
47197  }
47198
47199  protected void composeMedicinalProductIngredient(String name, MedicinalProductIngredient element) throws IOException {
47200    if (element != null) {
47201      prop("resourceType", name);
47202      composeMedicinalProductIngredientInner(element);
47203    }
47204  }
47205
47206  protected void composeMedicinalProductIngredientInner(MedicinalProductIngredient element) throws IOException {
47207      composeDomainResourceElements(element);
47208      if (element.hasIdentifier()) {
47209        composeIdentifier("identifier", element.getIdentifier());
47210      }
47211      if (element.hasRole()) {
47212        composeCodeableConcept("role", element.getRole());
47213      }
47214      if (element.hasAllergenicIndicatorElement()) {
47215        composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
47216        composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
47217      }
47218      if (element.hasManufacturer()) {
47219        openArray("manufacturer");
47220        for (Reference e : element.getManufacturer()) 
47221          composeReference(null, e);
47222        closeArray();
47223      };
47224      if (element.hasSpecifiedSubstance()) {
47225        openArray("specifiedSubstance");
47226        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent e : element.getSpecifiedSubstance()) 
47227          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(null, e);
47228        closeArray();
47229      };
47230      if (element.hasSubstance()) {
47231        composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent("substance", element.getSubstance());
47232      }
47233  }
47234
47235  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent element) throws IOException {
47236    if (element != null) {
47237      open(name);
47238      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentInner(element);
47239      close();
47240    }
47241  }
47242
47243  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent element) throws IOException {
47244      composeBackbone(element);
47245      if (element.hasCode()) {
47246        composeCodeableConcept("code", element.getCode());
47247      }
47248      if (element.hasGroup()) {
47249        composeCodeableConcept("group", element.getGroup());
47250      }
47251      if (element.hasConfidentiality()) {
47252        composeCodeableConcept("confidentiality", element.getConfidentiality());
47253      }
47254      if (element.hasStrength()) {
47255        openArray("strength");
47256        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent e : element.getStrength()) 
47257          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(null, e);
47258        closeArray();
47259      };
47260  }
47261
47262  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent element) throws IOException {
47263    if (element != null) {
47264      open(name);
47265      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentInner(element);
47266      close();
47267    }
47268  }
47269
47270  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent element) throws IOException {
47271      composeBackbone(element);
47272      if (element.hasPresentation()) {
47273        composeRatio("presentation", element.getPresentation());
47274      }
47275      if (element.hasPresentationLowLimit()) {
47276        composeRatio("presentationLowLimit", element.getPresentationLowLimit());
47277      }
47278      if (element.hasConcentration()) {
47279        composeRatio("concentration", element.getConcentration());
47280      }
47281      if (element.hasConcentrationLowLimit()) {
47282        composeRatio("concentrationLowLimit", element.getConcentrationLowLimit());
47283      }
47284      if (element.hasMeasurementPointElement()) {
47285        composeStringCore("measurementPoint", element.getMeasurementPointElement(), false);
47286        composeStringExtras("measurementPoint", element.getMeasurementPointElement(), false);
47287      }
47288      if (element.hasCountry()) {
47289        openArray("country");
47290        for (CodeableConcept e : element.getCountry()) 
47291          composeCodeableConcept(null, e);
47292        closeArray();
47293      };
47294      if (element.hasReferenceStrength()) {
47295        openArray("referenceStrength");
47296        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent e : element.getReferenceStrength()) 
47297          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(null, e);
47298        closeArray();
47299      };
47300  }
47301
47302  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent element) throws IOException {
47303    if (element != null) {
47304      open(name);
47305      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentInner(element);
47306      close();
47307    }
47308  }
47309
47310  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent element) throws IOException {
47311      composeBackbone(element);
47312      if (element.hasSubstance()) {
47313        composeCodeableConcept("substance", element.getSubstance());
47314      }
47315      if (element.hasStrength()) {
47316        composeRatio("strength", element.getStrength());
47317      }
47318      if (element.hasStrengthLowLimit()) {
47319        composeRatio("strengthLowLimit", element.getStrengthLowLimit());
47320      }
47321      if (element.hasMeasurementPointElement()) {
47322        composeStringCore("measurementPoint", element.getMeasurementPointElement(), false);
47323        composeStringExtras("measurementPoint", element.getMeasurementPointElement(), false);
47324      }
47325      if (element.hasCountry()) {
47326        openArray("country");
47327        for (CodeableConcept e : element.getCountry()) 
47328          composeCodeableConcept(null, e);
47329        closeArray();
47330      };
47331  }
47332
47333  protected void composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent element) throws IOException {
47334    if (element != null) {
47335      open(name);
47336      composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentInner(element);
47337      close();
47338    }
47339  }
47340
47341  protected void composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent element) throws IOException {
47342      composeBackbone(element);
47343      if (element.hasCode()) {
47344        composeCodeableConcept("code", element.getCode());
47345      }
47346      if (element.hasStrength()) {
47347        openArray("strength");
47348        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent e : element.getStrength()) 
47349          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(null, e);
47350        closeArray();
47351      };
47352  }
47353
47354  protected void composeMedicinalProductInteraction(String name, MedicinalProductInteraction element) throws IOException {
47355    if (element != null) {
47356      prop("resourceType", name);
47357      composeMedicinalProductInteractionInner(element);
47358    }
47359  }
47360
47361  protected void composeMedicinalProductInteractionInner(MedicinalProductInteraction element) throws IOException {
47362      composeDomainResourceElements(element);
47363      if (element.hasSubject()) {
47364        openArray("subject");
47365        for (Reference e : element.getSubject()) 
47366          composeReference(null, e);
47367        closeArray();
47368      };
47369      if (element.hasDescriptionElement()) {
47370        composeStringCore("description", element.getDescriptionElement(), false);
47371        composeStringExtras("description", element.getDescriptionElement(), false);
47372      }
47373      if (element.hasInteractant()) {
47374        openArray("interactant");
47375        for (MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent e : element.getInteractant()) 
47376          composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponent(null, e);
47377        closeArray();
47378      };
47379      if (element.hasType()) {
47380        composeCodeableConcept("type", element.getType());
47381      }
47382      if (element.hasEffect()) {
47383        composeCodeableConcept("effect", element.getEffect());
47384      }
47385      if (element.hasIncidence()) {
47386        composeCodeableConcept("incidence", element.getIncidence());
47387      }
47388      if (element.hasManagement()) {
47389        composeCodeableConcept("management", element.getManagement());
47390      }
47391  }
47392
47393  protected void composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponent(String name, MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent element) throws IOException {
47394    if (element != null) {
47395      open(name);
47396      composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponentInner(element);
47397      close();
47398    }
47399  }
47400
47401  protected void composeMedicinalProductInteractionMedicinalProductInteractionInteractantComponentInner(MedicinalProductInteraction.MedicinalProductInteractionInteractantComponent element) throws IOException {
47402      composeBackbone(element);
47403      if (element.hasItem()) {
47404        composeType("item", element.getItem());
47405      }
47406  }
47407
47408  protected void composeMedicinalProductManufactured(String name, MedicinalProductManufactured element) throws IOException {
47409    if (element != null) {
47410      prop("resourceType", name);
47411      composeMedicinalProductManufacturedInner(element);
47412    }
47413  }
47414
47415  protected void composeMedicinalProductManufacturedInner(MedicinalProductManufactured element) throws IOException {
47416      composeDomainResourceElements(element);
47417      if (element.hasManufacturedDoseForm()) {
47418        composeCodeableConcept("manufacturedDoseForm", element.getManufacturedDoseForm());
47419      }
47420      if (element.hasUnitOfPresentation()) {
47421        composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
47422      }
47423      if (element.hasQuantity()) {
47424        composeQuantity("quantity", element.getQuantity());
47425      }
47426      if (element.hasManufacturer()) {
47427        openArray("manufacturer");
47428        for (Reference e : element.getManufacturer()) 
47429          composeReference(null, e);
47430        closeArray();
47431      };
47432      if (element.hasIngredient()) {
47433        openArray("ingredient");
47434        for (Reference e : element.getIngredient()) 
47435          composeReference(null, e);
47436        closeArray();
47437      };
47438      if (element.hasPhysicalCharacteristics()) {
47439        composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
47440      }
47441      if (element.hasOtherCharacteristics()) {
47442        openArray("otherCharacteristics");
47443        for (CodeableConcept e : element.getOtherCharacteristics()) 
47444          composeCodeableConcept(null, e);
47445        closeArray();
47446      };
47447  }
47448
47449  protected void composeMedicinalProductPackaged(String name, MedicinalProductPackaged element) throws IOException {
47450    if (element != null) {
47451      prop("resourceType", name);
47452      composeMedicinalProductPackagedInner(element);
47453    }
47454  }
47455
47456  protected void composeMedicinalProductPackagedInner(MedicinalProductPackaged element) throws IOException {
47457      composeDomainResourceElements(element);
47458      if (element.hasIdentifier()) {
47459        openArray("identifier");
47460        for (Identifier e : element.getIdentifier()) 
47461          composeIdentifier(null, e);
47462        closeArray();
47463      };
47464      if (element.hasSubject()) {
47465        openArray("subject");
47466        for (Reference e : element.getSubject()) 
47467          composeReference(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.hasLegalStatusOfSupply()) {
47475        composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
47476      }
47477      if (element.hasMarketingStatus()) {
47478        openArray("marketingStatus");
47479        for (MarketingStatus e : element.getMarketingStatus()) 
47480          composeMarketingStatus(null, e);
47481        closeArray();
47482      };
47483      if (element.hasMarketingAuthorization()) {
47484        composeReference("marketingAuthorization", element.getMarketingAuthorization());
47485      }
47486      if (element.hasManufacturer()) {
47487        openArray("manufacturer");
47488        for (Reference e : element.getManufacturer()) 
47489          composeReference(null, e);
47490        closeArray();
47491      };
47492      if (element.hasBatchIdentifier()) {
47493        openArray("batchIdentifier");
47494        for (MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent e : element.getBatchIdentifier()) 
47495          composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(null, e);
47496        closeArray();
47497      };
47498      if (element.hasPackageItem()) {
47499        openArray("packageItem");
47500        for (MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent e : element.getPackageItem()) 
47501          composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(null, e);
47502        closeArray();
47503      };
47504  }
47505
47506  protected void composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(String name, MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent element) throws IOException {
47507    if (element != null) {
47508      open(name);
47509      composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentInner(element);
47510      close();
47511    }
47512  }
47513
47514  protected void composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentInner(MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent element) throws IOException {
47515      composeBackbone(element);
47516      if (element.hasOuterPackaging()) {
47517        composeIdentifier("outerPackaging", element.getOuterPackaging());
47518      }
47519      if (element.hasImmediatePackaging()) {
47520        composeIdentifier("immediatePackaging", element.getImmediatePackaging());
47521      }
47522  }
47523
47524  protected void composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(String name, MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent element) throws IOException {
47525    if (element != null) {
47526      open(name);
47527      composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentInner(element);
47528      close();
47529    }
47530  }
47531
47532  protected void composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentInner(MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent element) throws IOException {
47533      composeBackbone(element);
47534      if (element.hasIdentifier()) {
47535        openArray("identifier");
47536        for (Identifier e : element.getIdentifier()) 
47537          composeIdentifier(null, e);
47538        closeArray();
47539      };
47540      if (element.hasType()) {
47541        composeCodeableConcept("type", element.getType());
47542      }
47543      if (element.hasQuantity()) {
47544        composeQuantity("quantity", element.getQuantity());
47545      }
47546      if (element.hasMaterial()) {
47547        openArray("material");
47548        for (CodeableConcept e : element.getMaterial()) 
47549          composeCodeableConcept(null, e);
47550        closeArray();
47551      };
47552      if (element.hasAlternateMaterial()) {
47553        openArray("alternateMaterial");
47554        for (CodeableConcept e : element.getAlternateMaterial()) 
47555          composeCodeableConcept(null, e);
47556        closeArray();
47557      };
47558      if (element.hasDevice()) {
47559        openArray("device");
47560        for (Reference e : element.getDevice()) 
47561          composeReference(null, e);
47562        closeArray();
47563      };
47564      if (element.hasManufacturedItem()) {
47565        openArray("manufacturedItem");
47566        for (Reference e : element.getManufacturedItem()) 
47567          composeReference(null, e);
47568        closeArray();
47569      };
47570      if (element.hasPackageItem()) {
47571        openArray("packageItem");
47572        for (MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent e : element.getPackageItem()) 
47573          composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(null, e);
47574        closeArray();
47575      };
47576      if (element.hasPhysicalCharacteristics()) {
47577        composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
47578      }
47579      if (element.hasOtherCharacteristics()) {
47580        openArray("otherCharacteristics");
47581        for (CodeableConcept e : element.getOtherCharacteristics()) 
47582          composeCodeableConcept(null, e);
47583        closeArray();
47584      };
47585      if (element.hasShelfLifeStorage()) {
47586        openArray("shelfLifeStorage");
47587        for (ProductShelfLife e : element.getShelfLifeStorage()) 
47588          composeProductShelfLife(null, e);
47589        closeArray();
47590      };
47591      if (element.hasManufacturer()) {
47592        openArray("manufacturer");
47593        for (Reference e : element.getManufacturer()) 
47594          composeReference(null, e);
47595        closeArray();
47596      };
47597  }
47598
47599  protected void composeMedicinalProductPharmaceutical(String name, MedicinalProductPharmaceutical element) throws IOException {
47600    if (element != null) {
47601      prop("resourceType", name);
47602      composeMedicinalProductPharmaceuticalInner(element);
47603    }
47604  }
47605
47606  protected void composeMedicinalProductPharmaceuticalInner(MedicinalProductPharmaceutical element) throws IOException {
47607      composeDomainResourceElements(element);
47608      if (element.hasIdentifier()) {
47609        openArray("identifier");
47610        for (Identifier e : element.getIdentifier()) 
47611          composeIdentifier(null, e);
47612        closeArray();
47613      };
47614      if (element.hasAdministrableDoseForm()) {
47615        composeCodeableConcept("administrableDoseForm", element.getAdministrableDoseForm());
47616      }
47617      if (element.hasUnitOfPresentation()) {
47618        composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
47619      }
47620      if (element.hasIngredient()) {
47621        openArray("ingredient");
47622        for (Reference e : element.getIngredient()) 
47623          composeReference(null, e);
47624        closeArray();
47625      };
47626      if (element.hasDevice()) {
47627        openArray("device");
47628        for (Reference e : element.getDevice()) 
47629          composeReference(null, e);
47630        closeArray();
47631      };
47632      if (element.hasCharacteristics()) {
47633        openArray("characteristics");
47634        for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent e : element.getCharacteristics()) 
47635          composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(null, e);
47636        closeArray();
47637      };
47638      if (element.hasRouteOfAdministration()) {
47639        openArray("routeOfAdministration");
47640        for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent e : element.getRouteOfAdministration()) 
47641          composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(null, e);
47642        closeArray();
47643      };
47644  }
47645
47646  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent element) throws IOException {
47647    if (element != null) {
47648      open(name);
47649      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentInner(element);
47650      close();
47651    }
47652  }
47653
47654  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentInner(MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent element) throws IOException {
47655      composeBackbone(element);
47656      if (element.hasCode()) {
47657        composeCodeableConcept("code", element.getCode());
47658      }
47659      if (element.hasStatus()) {
47660        composeCodeableConcept("status", element.getStatus());
47661      }
47662  }
47663
47664  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent element) throws IOException {
47665    if (element != null) {
47666      open(name);
47667      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentInner(element);
47668      close();
47669    }
47670  }
47671
47672  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentInner(MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent element) throws IOException {
47673      composeBackbone(element);
47674      if (element.hasCode()) {
47675        composeCodeableConcept("code", element.getCode());
47676      }
47677      if (element.hasFirstDose()) {
47678        composeQuantity("firstDose", element.getFirstDose());
47679      }
47680      if (element.hasMaxSingleDose()) {
47681        composeQuantity("maxSingleDose", element.getMaxSingleDose());
47682      }
47683      if (element.hasMaxDosePerDay()) {
47684        composeQuantity("maxDosePerDay", element.getMaxDosePerDay());
47685      }
47686      if (element.hasMaxDosePerTreatmentPeriod()) {
47687        composeRatio("maxDosePerTreatmentPeriod", element.getMaxDosePerTreatmentPeriod());
47688      }
47689      if (element.hasMaxTreatmentPeriod()) {
47690        composeDuration("maxTreatmentPeriod", element.getMaxTreatmentPeriod());
47691      }
47692      if (element.hasTargetSpecies()) {
47693        openArray("targetSpecies");
47694        for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent e : element.getTargetSpecies()) 
47695          composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(null, e);
47696        closeArray();
47697      };
47698  }
47699
47700  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent element) throws IOException {
47701    if (element != null) {
47702      open(name);
47703      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentInner(element);
47704      close();
47705    }
47706  }
47707
47708  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentInner(MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent element) throws IOException {
47709      composeBackbone(element);
47710      if (element.hasCode()) {
47711        composeCodeableConcept("code", element.getCode());
47712      }
47713      if (element.hasWithdrawalPeriod()) {
47714        openArray("withdrawalPeriod");
47715        for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent e : element.getWithdrawalPeriod()) 
47716          composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(null, e);
47717        closeArray();
47718      };
47719  }
47720
47721  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element) throws IOException {
47722    if (element != null) {
47723      open(name);
47724      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentInner(element);
47725      close();
47726    }
47727  }
47728
47729  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentInner(MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element) throws IOException {
47730      composeBackbone(element);
47731      if (element.hasTissue()) {
47732        composeCodeableConcept("tissue", element.getTissue());
47733      }
47734      if (element.hasValue()) {
47735        composeQuantity("value", element.getValue());
47736      }
47737      if (element.hasSupportingInformationElement()) {
47738        composeStringCore("supportingInformation", element.getSupportingInformationElement(), false);
47739        composeStringExtras("supportingInformation", element.getSupportingInformationElement(), false);
47740      }
47741  }
47742
47743  protected void composeMedicinalProductUndesirableEffect(String name, MedicinalProductUndesirableEffect element) throws IOException {
47744    if (element != null) {
47745      prop("resourceType", name);
47746      composeMedicinalProductUndesirableEffectInner(element);
47747    }
47748  }
47749
47750  protected void composeMedicinalProductUndesirableEffectInner(MedicinalProductUndesirableEffect element) throws IOException {
47751      composeDomainResourceElements(element);
47752      if (element.hasSubject()) {
47753        openArray("subject");
47754        for (Reference e : element.getSubject()) 
47755          composeReference(null, e);
47756        closeArray();
47757      };
47758      if (element.hasSymptomConditionEffect()) {
47759        composeCodeableConcept("symptomConditionEffect", element.getSymptomConditionEffect());
47760      }
47761      if (element.hasClassification()) {
47762        composeCodeableConcept("classification", element.getClassification());
47763      }
47764      if (element.hasFrequencyOfOccurrence()) {
47765        composeCodeableConcept("frequencyOfOccurrence", element.getFrequencyOfOccurrence());
47766      }
47767      if (element.hasPopulation()) {
47768        openArray("population");
47769        for (Population e : element.getPopulation()) 
47770          composePopulation(null, e);
47771        closeArray();
47772      };
47773  }
47774
47775  protected void composeMessageDefinition(String name, MessageDefinition element) throws IOException {
47776    if (element != null) {
47777      prop("resourceType", name);
47778      composeMessageDefinitionInner(element);
47779    }
47780  }
47781
47782  protected void composeMessageDefinitionInner(MessageDefinition element) throws IOException {
47783      composeDomainResourceElements(element);
47784      if (element.hasUrlElement()) {
47785        composeUriCore("url", element.getUrlElement(), false);
47786        composeUriExtras("url", element.getUrlElement(), false);
47787      }
47788      if (element.hasIdentifier()) {
47789        openArray("identifier");
47790        for (Identifier e : element.getIdentifier()) 
47791          composeIdentifier(null, e);
47792        closeArray();
47793      };
47794      if (element.hasVersionElement()) {
47795        composeStringCore("version", element.getVersionElement(), false);
47796        composeStringExtras("version", element.getVersionElement(), false);
47797      }
47798      if (element.hasNameElement()) {
47799        composeStringCore("name", element.getNameElement(), false);
47800        composeStringExtras("name", element.getNameElement(), false);
47801      }
47802      if (element.hasTitleElement()) {
47803        composeStringCore("title", element.getTitleElement(), false);
47804        composeStringExtras("title", element.getTitleElement(), false);
47805      }
47806      if (element.hasReplaces()) {
47807        openArray("replaces");
47808        for (CanonicalType e : element.getReplaces()) 
47809          composeCanonicalCore(null, e, true);
47810        closeArray();
47811        if (anyHasExtras(element.getReplaces())) {
47812          openArray("_replaces");
47813          for (CanonicalType e : element.getReplaces()) 
47814            composeCanonicalExtras(null, e, true);
47815          closeArray();
47816        }
47817      };
47818      if (element.hasStatusElement()) {
47819        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
47820        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
47821      }
47822      if (element.hasExperimentalElement()) {
47823        composeBooleanCore("experimental", element.getExperimentalElement(), false);
47824        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
47825      }
47826      if (element.hasDateElement()) {
47827        composeDateTimeCore("date", element.getDateElement(), false);
47828        composeDateTimeExtras("date", element.getDateElement(), false);
47829      }
47830      if (element.hasPublisherElement()) {
47831        composeStringCore("publisher", element.getPublisherElement(), false);
47832        composeStringExtras("publisher", element.getPublisherElement(), false);
47833      }
47834      if (element.hasContact()) {
47835        openArray("contact");
47836        for (ContactDetail e : element.getContact()) 
47837          composeContactDetail(null, e);
47838        closeArray();
47839      };
47840      if (element.hasDescriptionElement()) {
47841        composeMarkdownCore("description", element.getDescriptionElement(), false);
47842        composeMarkdownExtras("description", element.getDescriptionElement(), false);
47843      }
47844      if (element.hasUseContext()) {
47845        openArray("useContext");
47846        for (UsageContext e : element.getUseContext()) 
47847          composeUsageContext(null, e);
47848        closeArray();
47849      };
47850      if (element.hasJurisdiction()) {
47851        openArray("jurisdiction");
47852        for (CodeableConcept e : element.getJurisdiction()) 
47853          composeCodeableConcept(null, e);
47854        closeArray();
47855      };
47856      if (element.hasPurposeElement()) {
47857        composeMarkdownCore("purpose", element.getPurposeElement(), false);
47858        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
47859      }
47860      if (element.hasCopyrightElement()) {
47861        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
47862        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
47863      }
47864      if (element.hasBaseElement()) {
47865        composeCanonicalCore("base", element.getBaseElement(), false);
47866        composeCanonicalExtras("base", element.getBaseElement(), false);
47867      }
47868      if (element.hasParent()) {
47869        openArray("parent");
47870        for (CanonicalType e : element.getParent()) 
47871          composeCanonicalCore(null, e, true);
47872        closeArray();
47873        if (anyHasExtras(element.getParent())) {
47874          openArray("_parent");
47875          for (CanonicalType e : element.getParent()) 
47876            composeCanonicalExtras(null, e, true);
47877          closeArray();
47878        }
47879      };
47880      if (element.hasEvent()) {
47881        composeType("event", element.getEvent());
47882      }
47883      if (element.hasCategoryElement()) {
47884        composeEnumerationCore("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
47885        composeEnumerationExtras("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
47886      }
47887      if (element.hasFocus()) {
47888        openArray("focus");
47889        for (MessageDefinition.MessageDefinitionFocusComponent e : element.getFocus()) 
47890          composeMessageDefinitionMessageDefinitionFocusComponent(null, e);
47891        closeArray();
47892      };
47893      if (element.hasResponseRequiredElement()) {
47894        composeEnumerationCore("responseRequired", element.getResponseRequiredElement(), new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
47895        composeEnumerationExtras("responseRequired", element.getResponseRequiredElement(), new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
47896      }
47897      if (element.hasAllowedResponse()) {
47898        openArray("allowedResponse");
47899        for (MessageDefinition.MessageDefinitionAllowedResponseComponent e : element.getAllowedResponse()) 
47900          composeMessageDefinitionMessageDefinitionAllowedResponseComponent(null, e);
47901        closeArray();
47902      };
47903      if (element.hasGraph()) {
47904        openArray("graph");
47905        for (CanonicalType e : element.getGraph()) 
47906          composeCanonicalCore(null, e, true);
47907        closeArray();
47908        if (anyHasExtras(element.getGraph())) {
47909          openArray("_graph");
47910          for (CanonicalType e : element.getGraph()) 
47911            composeCanonicalExtras(null, e, true);
47912          closeArray();
47913        }
47914      };
47915  }
47916
47917  protected void composeMessageDefinitionMessageDefinitionFocusComponent(String name, MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
47918    if (element != null) {
47919      open(name);
47920      composeMessageDefinitionMessageDefinitionFocusComponentInner(element);
47921      close();
47922    }
47923  }
47924
47925  protected void composeMessageDefinitionMessageDefinitionFocusComponentInner(MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
47926      composeBackbone(element);
47927      if (element.hasCodeElement()) {
47928        composeCodeCore("code", element.getCodeElement(), false);
47929        composeCodeExtras("code", element.getCodeElement(), false);
47930      }
47931      if (element.hasProfileElement()) {
47932        composeCanonicalCore("profile", element.getProfileElement(), false);
47933        composeCanonicalExtras("profile", element.getProfileElement(), false);
47934      }
47935      if (element.hasMinElement()) {
47936        composeUnsignedIntCore("min", element.getMinElement(), false);
47937        composeUnsignedIntExtras("min", element.getMinElement(), false);
47938      }
47939      if (element.hasMaxElement()) {
47940        composeStringCore("max", element.getMaxElement(), false);
47941        composeStringExtras("max", element.getMaxElement(), false);
47942      }
47943  }
47944
47945  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponent(String name, MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
47946    if (element != null) {
47947      open(name);
47948      composeMessageDefinitionMessageDefinitionAllowedResponseComponentInner(element);
47949      close();
47950    }
47951  }
47952
47953  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponentInner(MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
47954      composeBackbone(element);
47955      if (element.hasMessageElement()) {
47956        composeCanonicalCore("message", element.getMessageElement(), false);
47957        composeCanonicalExtras("message", element.getMessageElement(), false);
47958      }
47959      if (element.hasSituationElement()) {
47960        composeMarkdownCore("situation", element.getSituationElement(), false);
47961        composeMarkdownExtras("situation", element.getSituationElement(), false);
47962      }
47963  }
47964
47965  protected void composeMessageHeader(String name, MessageHeader element) throws IOException {
47966    if (element != null) {
47967      prop("resourceType", name);
47968      composeMessageHeaderInner(element);
47969    }
47970  }
47971
47972  protected void composeMessageHeaderInner(MessageHeader element) throws IOException {
47973      composeDomainResourceElements(element);
47974      if (element.hasEvent()) {
47975        composeType("event", element.getEvent());
47976      }
47977      if (element.hasDestination()) {
47978        openArray("destination");
47979        for (MessageHeader.MessageDestinationComponent e : element.getDestination()) 
47980          composeMessageHeaderMessageDestinationComponent(null, e);
47981        closeArray();
47982      };
47983      if (element.hasSender()) {
47984        composeReference("sender", element.getSender());
47985      }
47986      if (element.hasEnterer()) {
47987        composeReference("enterer", element.getEnterer());
47988      }
47989      if (element.hasAuthor()) {
47990        composeReference("author", element.getAuthor());
47991      }
47992      if (element.hasSource()) {
47993        composeMessageHeaderMessageSourceComponent("source", element.getSource());
47994      }
47995      if (element.hasResponsible()) {
47996        composeReference("responsible", element.getResponsible());
47997      }
47998      if (element.hasReason()) {
47999        composeCodeableConcept("reason", element.getReason());
48000      }
48001      if (element.hasResponse()) {
48002        composeMessageHeaderMessageHeaderResponseComponent("response", element.getResponse());
48003      }
48004      if (element.hasFocus()) {
48005        openArray("focus");
48006        for (Reference e : element.getFocus()) 
48007          composeReference(null, e);
48008        closeArray();
48009      };
48010      if (element.hasDefinitionElement()) {
48011        composeCanonicalCore("definition", element.getDefinitionElement(), false);
48012        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
48013      }
48014  }
48015
48016  protected void composeMessageHeaderMessageDestinationComponent(String name, MessageHeader.MessageDestinationComponent element) throws IOException {
48017    if (element != null) {
48018      open(name);
48019      composeMessageHeaderMessageDestinationComponentInner(element);
48020      close();
48021    }
48022  }
48023
48024  protected void composeMessageHeaderMessageDestinationComponentInner(MessageHeader.MessageDestinationComponent element) throws IOException {
48025      composeBackbone(element);
48026      if (element.hasNameElement()) {
48027        composeStringCore("name", element.getNameElement(), false);
48028        composeStringExtras("name", element.getNameElement(), false);
48029      }
48030      if (element.hasTarget()) {
48031        composeReference("target", element.getTarget());
48032      }
48033      if (element.hasEndpointElement()) {
48034        composeUrlCore("endpoint", element.getEndpointElement(), false);
48035        composeUrlExtras("endpoint", element.getEndpointElement(), false);
48036      }
48037      if (element.hasReceiver()) {
48038        composeReference("receiver", element.getReceiver());
48039      }
48040  }
48041
48042  protected void composeMessageHeaderMessageSourceComponent(String name, MessageHeader.MessageSourceComponent element) throws IOException {
48043    if (element != null) {
48044      open(name);
48045      composeMessageHeaderMessageSourceComponentInner(element);
48046      close();
48047    }
48048  }
48049
48050  protected void composeMessageHeaderMessageSourceComponentInner(MessageHeader.MessageSourceComponent element) throws IOException {
48051      composeBackbone(element);
48052      if (element.hasNameElement()) {
48053        composeStringCore("name", element.getNameElement(), false);
48054        composeStringExtras("name", element.getNameElement(), false);
48055      }
48056      if (element.hasSoftwareElement()) {
48057        composeStringCore("software", element.getSoftwareElement(), false);
48058        composeStringExtras("software", element.getSoftwareElement(), false);
48059      }
48060      if (element.hasVersionElement()) {
48061        composeStringCore("version", element.getVersionElement(), false);
48062        composeStringExtras("version", element.getVersionElement(), false);
48063      }
48064      if (element.hasContact()) {
48065        composeContactPoint("contact", element.getContact());
48066      }
48067      if (element.hasEndpointElement()) {
48068        composeUrlCore("endpoint", element.getEndpointElement(), false);
48069        composeUrlExtras("endpoint", element.getEndpointElement(), false);
48070      }
48071  }
48072
48073  protected void composeMessageHeaderMessageHeaderResponseComponent(String name, MessageHeader.MessageHeaderResponseComponent element) throws IOException {
48074    if (element != null) {
48075      open(name);
48076      composeMessageHeaderMessageHeaderResponseComponentInner(element);
48077      close();
48078    }
48079  }
48080
48081  protected void composeMessageHeaderMessageHeaderResponseComponentInner(MessageHeader.MessageHeaderResponseComponent element) throws IOException {
48082      composeBackbone(element);
48083      if (element.hasIdentifierElement()) {
48084        composeIdCore("identifier", element.getIdentifierElement(), false);
48085        composeIdExtras("identifier", element.getIdentifierElement(), false);
48086      }
48087      if (element.hasCodeElement()) {
48088        composeEnumerationCore("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
48089        composeEnumerationExtras("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
48090      }
48091      if (element.hasDetails()) {
48092        composeReference("details", element.getDetails());
48093      }
48094  }
48095
48096  protected void composeMolecularSequence(String name, MolecularSequence element) throws IOException {
48097    if (element != null) {
48098      prop("resourceType", name);
48099      composeMolecularSequenceInner(element);
48100    }
48101  }
48102
48103  protected void composeMolecularSequenceInner(MolecularSequence element) throws IOException {
48104      composeDomainResourceElements(element);
48105      if (element.hasIdentifier()) {
48106        openArray("identifier");
48107        for (Identifier e : element.getIdentifier()) 
48108          composeIdentifier(null, e);
48109        closeArray();
48110      };
48111      if (element.hasTypeElement()) {
48112        composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.SequenceTypeEnumFactory(), false);
48113        composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.SequenceTypeEnumFactory(), false);
48114      }
48115      if (element.hasCoordinateSystemElement()) {
48116        composeIntegerCore("coordinateSystem", element.getCoordinateSystemElement(), false);
48117        composeIntegerExtras("coordinateSystem", element.getCoordinateSystemElement(), false);
48118      }
48119      if (element.hasPatient()) {
48120        composeReference("patient", element.getPatient());
48121      }
48122      if (element.hasSpecimen()) {
48123        composeReference("specimen", element.getSpecimen());
48124      }
48125      if (element.hasDevice()) {
48126        composeReference("device", element.getDevice());
48127      }
48128      if (element.hasPerformer()) {
48129        composeReference("performer", element.getPerformer());
48130      }
48131      if (element.hasQuantity()) {
48132        composeQuantity("quantity", element.getQuantity());
48133      }
48134      if (element.hasReferenceSeq()) {
48135        composeMolecularSequenceMolecularSequenceReferenceSeqComponent("referenceSeq", element.getReferenceSeq());
48136      }
48137      if (element.hasVariant()) {
48138        openArray("variant");
48139        for (MolecularSequence.MolecularSequenceVariantComponent e : element.getVariant()) 
48140          composeMolecularSequenceMolecularSequenceVariantComponent(null, e);
48141        closeArray();
48142      };
48143      if (element.hasObservedSeqElement()) {
48144        composeStringCore("observedSeq", element.getObservedSeqElement(), false);
48145        composeStringExtras("observedSeq", element.getObservedSeqElement(), false);
48146      }
48147      if (element.hasQuality()) {
48148        openArray("quality");
48149        for (MolecularSequence.MolecularSequenceQualityComponent e : element.getQuality()) 
48150          composeMolecularSequenceMolecularSequenceQualityComponent(null, e);
48151        closeArray();
48152      };
48153      if (element.hasReadCoverageElement()) {
48154        composeIntegerCore("readCoverage", element.getReadCoverageElement(), false);
48155        composeIntegerExtras("readCoverage", element.getReadCoverageElement(), false);
48156      }
48157      if (element.hasRepository()) {
48158        openArray("repository");
48159        for (MolecularSequence.MolecularSequenceRepositoryComponent e : element.getRepository()) 
48160          composeMolecularSequenceMolecularSequenceRepositoryComponent(null, e);
48161        closeArray();
48162      };
48163      if (element.hasPointer()) {
48164        openArray("pointer");
48165        for (Reference e : element.getPointer()) 
48166          composeReference(null, e);
48167        closeArray();
48168      };
48169      if (element.hasStructureVariant()) {
48170        openArray("structureVariant");
48171        for (MolecularSequence.MolecularSequenceStructureVariantComponent e : element.getStructureVariant()) 
48172          composeMolecularSequenceMolecularSequenceStructureVariantComponent(null, e);
48173        closeArray();
48174      };
48175  }
48176
48177  protected void composeMolecularSequenceMolecularSequenceReferenceSeqComponent(String name, MolecularSequence.MolecularSequenceReferenceSeqComponent element) throws IOException {
48178    if (element != null) {
48179      open(name);
48180      composeMolecularSequenceMolecularSequenceReferenceSeqComponentInner(element);
48181      close();
48182    }
48183  }
48184
48185  protected void composeMolecularSequenceMolecularSequenceReferenceSeqComponentInner(MolecularSequence.MolecularSequenceReferenceSeqComponent element) throws IOException {
48186      composeBackbone(element);
48187      if (element.hasChromosome()) {
48188        composeCodeableConcept("chromosome", element.getChromosome());
48189      }
48190      if (element.hasGenomeBuildElement()) {
48191        composeStringCore("genomeBuild", element.getGenomeBuildElement(), false);
48192        composeStringExtras("genomeBuild", element.getGenomeBuildElement(), false);
48193      }
48194      if (element.hasOrientationElement()) {
48195        composeEnumerationCore("orientation", element.getOrientationElement(), new MolecularSequence.OrientationTypeEnumFactory(), false);
48196        composeEnumerationExtras("orientation", element.getOrientationElement(), new MolecularSequence.OrientationTypeEnumFactory(), false);
48197      }
48198      if (element.hasReferenceSeqId()) {
48199        composeCodeableConcept("referenceSeqId", element.getReferenceSeqId());
48200      }
48201      if (element.hasReferenceSeqPointer()) {
48202        composeReference("referenceSeqPointer", element.getReferenceSeqPointer());
48203      }
48204      if (element.hasReferenceSeqStringElement()) {
48205        composeStringCore("referenceSeqString", element.getReferenceSeqStringElement(), false);
48206        composeStringExtras("referenceSeqString", element.getReferenceSeqStringElement(), false);
48207      }
48208      if (element.hasStrandElement()) {
48209        composeEnumerationCore("strand", element.getStrandElement(), new MolecularSequence.StrandTypeEnumFactory(), false);
48210        composeEnumerationExtras("strand", element.getStrandElement(), new MolecularSequence.StrandTypeEnumFactory(), false);
48211      }
48212      if (element.hasWindowStartElement()) {
48213        composeIntegerCore("windowStart", element.getWindowStartElement(), false);
48214        composeIntegerExtras("windowStart", element.getWindowStartElement(), false);
48215      }
48216      if (element.hasWindowEndElement()) {
48217        composeIntegerCore("windowEnd", element.getWindowEndElement(), false);
48218        composeIntegerExtras("windowEnd", element.getWindowEndElement(), false);
48219      }
48220  }
48221
48222  protected void composeMolecularSequenceMolecularSequenceVariantComponent(String name, MolecularSequence.MolecularSequenceVariantComponent element) throws IOException {
48223    if (element != null) {
48224      open(name);
48225      composeMolecularSequenceMolecularSequenceVariantComponentInner(element);
48226      close();
48227    }
48228  }
48229
48230  protected void composeMolecularSequenceMolecularSequenceVariantComponentInner(MolecularSequence.MolecularSequenceVariantComponent element) throws IOException {
48231      composeBackbone(element);
48232      if (element.hasStartElement()) {
48233        composeIntegerCore("start", element.getStartElement(), false);
48234        composeIntegerExtras("start", element.getStartElement(), false);
48235      }
48236      if (element.hasEndElement()) {
48237        composeIntegerCore("end", element.getEndElement(), false);
48238        composeIntegerExtras("end", element.getEndElement(), false);
48239      }
48240      if (element.hasObservedAlleleElement()) {
48241        composeStringCore("observedAllele", element.getObservedAlleleElement(), false);
48242        composeStringExtras("observedAllele", element.getObservedAlleleElement(), false);
48243      }
48244      if (element.hasReferenceAlleleElement()) {
48245        composeStringCore("referenceAllele", element.getReferenceAlleleElement(), false);
48246        composeStringExtras("referenceAllele", element.getReferenceAlleleElement(), false);
48247      }
48248      if (element.hasCigarElement()) {
48249        composeStringCore("cigar", element.getCigarElement(), false);
48250        composeStringExtras("cigar", element.getCigarElement(), false);
48251      }
48252      if (element.hasVariantPointer()) {
48253        composeReference("variantPointer", element.getVariantPointer());
48254      }
48255  }
48256
48257  protected void composeMolecularSequenceMolecularSequenceQualityComponent(String name, MolecularSequence.MolecularSequenceQualityComponent element) throws IOException {
48258    if (element != null) {
48259      open(name);
48260      composeMolecularSequenceMolecularSequenceQualityComponentInner(element);
48261      close();
48262    }
48263  }
48264
48265  protected void composeMolecularSequenceMolecularSequenceQualityComponentInner(MolecularSequence.MolecularSequenceQualityComponent element) throws IOException {
48266      composeBackbone(element);
48267      if (element.hasTypeElement()) {
48268        composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.QualityTypeEnumFactory(), false);
48269        composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.QualityTypeEnumFactory(), false);
48270      }
48271      if (element.hasStandardSequence()) {
48272        composeCodeableConcept("standardSequence", element.getStandardSequence());
48273      }
48274      if (element.hasStartElement()) {
48275        composeIntegerCore("start", element.getStartElement(), false);
48276        composeIntegerExtras("start", element.getStartElement(), false);
48277      }
48278      if (element.hasEndElement()) {
48279        composeIntegerCore("end", element.getEndElement(), false);
48280        composeIntegerExtras("end", element.getEndElement(), false);
48281      }
48282      if (element.hasScore()) {
48283        composeQuantity("score", element.getScore());
48284      }
48285      if (element.hasMethod()) {
48286        composeCodeableConcept("method", element.getMethod());
48287      }
48288      if (element.hasTruthTPElement()) {
48289        composeDecimalCore("truthTP", element.getTruthTPElement(), false);
48290        composeDecimalExtras("truthTP", element.getTruthTPElement(), false);
48291      }
48292      if (element.hasQueryTPElement()) {
48293        composeDecimalCore("queryTP", element.getQueryTPElement(), false);
48294        composeDecimalExtras("queryTP", element.getQueryTPElement(), false);
48295      }
48296      if (element.hasTruthFNElement()) {
48297        composeDecimalCore("truthFN", element.getTruthFNElement(), false);
48298        composeDecimalExtras("truthFN", element.getTruthFNElement(), false);
48299      }
48300      if (element.hasQueryFPElement()) {
48301        composeDecimalCore("queryFP", element.getQueryFPElement(), false);
48302        composeDecimalExtras("queryFP", element.getQueryFPElement(), false);
48303      }
48304      if (element.hasGtFPElement()) {
48305        composeDecimalCore("gtFP", element.getGtFPElement(), false);
48306        composeDecimalExtras("gtFP", element.getGtFPElement(), false);
48307      }
48308      if (element.hasPrecisionElement()) {
48309        composeDecimalCore("precision", element.getPrecisionElement(), false);
48310        composeDecimalExtras("precision", element.getPrecisionElement(), false);
48311      }
48312      if (element.hasRecallElement()) {
48313        composeDecimalCore("recall", element.getRecallElement(), false);
48314        composeDecimalExtras("recall", element.getRecallElement(), false);
48315      }
48316      if (element.hasFScoreElement()) {
48317        composeDecimalCore("fScore", element.getFScoreElement(), false);
48318        composeDecimalExtras("fScore", element.getFScoreElement(), false);
48319      }
48320      if (element.hasRoc()) {
48321        composeMolecularSequenceMolecularSequenceQualityRocComponent("roc", element.getRoc());
48322      }
48323  }
48324
48325  protected void composeMolecularSequenceMolecularSequenceQualityRocComponent(String name, MolecularSequence.MolecularSequenceQualityRocComponent element) throws IOException {
48326    if (element != null) {
48327      open(name);
48328      composeMolecularSequenceMolecularSequenceQualityRocComponentInner(element);
48329      close();
48330    }
48331  }
48332
48333  protected void composeMolecularSequenceMolecularSequenceQualityRocComponentInner(MolecularSequence.MolecularSequenceQualityRocComponent element) throws IOException {
48334      composeBackbone(element);
48335      if (element.hasScore()) {
48336        openArray("score");
48337        for (IntegerType e : element.getScore()) 
48338          composeIntegerCore(null, e, true);
48339        closeArray();
48340        if (anyHasExtras(element.getScore())) {
48341          openArray("_score");
48342          for (IntegerType e : element.getScore()) 
48343            composeIntegerExtras(null, e, true);
48344          closeArray();
48345        }
48346      };
48347      if (element.hasNumTP()) {
48348        openArray("numTP");
48349        for (IntegerType e : element.getNumTP()) 
48350          composeIntegerCore(null, e, true);
48351        closeArray();
48352        if (anyHasExtras(element.getNumTP())) {
48353          openArray("_numTP");
48354          for (IntegerType e : element.getNumTP()) 
48355            composeIntegerExtras(null, e, true);
48356          closeArray();
48357        }
48358      };
48359      if (element.hasNumFP()) {
48360        openArray("numFP");
48361        for (IntegerType e : element.getNumFP()) 
48362          composeIntegerCore(null, e, true);
48363        closeArray();
48364        if (anyHasExtras(element.getNumFP())) {
48365          openArray("_numFP");
48366          for (IntegerType e : element.getNumFP()) 
48367            composeIntegerExtras(null, e, true);
48368          closeArray();
48369        }
48370      };
48371      if (element.hasNumFN()) {
48372        openArray("numFN");
48373        for (IntegerType e : element.getNumFN()) 
48374          composeIntegerCore(null, e, true);
48375        closeArray();
48376        if (anyHasExtras(element.getNumFN())) {
48377          openArray("_numFN");
48378          for (IntegerType e : element.getNumFN()) 
48379            composeIntegerExtras(null, e, true);
48380          closeArray();
48381        }
48382      };
48383      if (element.hasPrecision()) {
48384        openArray("precision");
48385        for (DecimalType e : element.getPrecision()) 
48386          composeDecimalCore(null, e, true);
48387        closeArray();
48388        if (anyHasExtras(element.getPrecision())) {
48389          openArray("_precision");
48390          for (DecimalType e : element.getPrecision()) 
48391            composeDecimalExtras(null, e, true);
48392          closeArray();
48393        }
48394      };
48395      if (element.hasSensitivity()) {
48396        openArray("sensitivity");
48397        for (DecimalType e : element.getSensitivity()) 
48398          composeDecimalCore(null, e, true);
48399        closeArray();
48400        if (anyHasExtras(element.getSensitivity())) {
48401          openArray("_sensitivity");
48402          for (DecimalType e : element.getSensitivity()) 
48403            composeDecimalExtras(null, e, true);
48404          closeArray();
48405        }
48406      };
48407      if (element.hasFMeasure()) {
48408        openArray("fMeasure");
48409        for (DecimalType e : element.getFMeasure()) 
48410          composeDecimalCore(null, e, true);
48411        closeArray();
48412        if (anyHasExtras(element.getFMeasure())) {
48413          openArray("_fMeasure");
48414          for (DecimalType e : element.getFMeasure()) 
48415            composeDecimalExtras(null, e, true);
48416          closeArray();
48417        }
48418      };
48419  }
48420
48421  protected void composeMolecularSequenceMolecularSequenceRepositoryComponent(String name, MolecularSequence.MolecularSequenceRepositoryComponent element) throws IOException {
48422    if (element != null) {
48423      open(name);
48424      composeMolecularSequenceMolecularSequenceRepositoryComponentInner(element);
48425      close();
48426    }
48427  }
48428
48429  protected void composeMolecularSequenceMolecularSequenceRepositoryComponentInner(MolecularSequence.MolecularSequenceRepositoryComponent element) throws IOException {
48430      composeBackbone(element);
48431      if (element.hasTypeElement()) {
48432        composeEnumerationCore("type", element.getTypeElement(), new MolecularSequence.RepositoryTypeEnumFactory(), false);
48433        composeEnumerationExtras("type", element.getTypeElement(), new MolecularSequence.RepositoryTypeEnumFactory(), false);
48434      }
48435      if (element.hasUrlElement()) {
48436        composeUriCore("url", element.getUrlElement(), false);
48437        composeUriExtras("url", element.getUrlElement(), false);
48438      }
48439      if (element.hasNameElement()) {
48440        composeStringCore("name", element.getNameElement(), false);
48441        composeStringExtras("name", element.getNameElement(), false);
48442      }
48443      if (element.hasDatasetIdElement()) {
48444        composeStringCore("datasetId", element.getDatasetIdElement(), false);
48445        composeStringExtras("datasetId", element.getDatasetIdElement(), false);
48446      }
48447      if (element.hasVariantsetIdElement()) {
48448        composeStringCore("variantsetId", element.getVariantsetIdElement(), false);
48449        composeStringExtras("variantsetId", element.getVariantsetIdElement(), false);
48450      }
48451      if (element.hasReadsetIdElement()) {
48452        composeStringCore("readsetId", element.getReadsetIdElement(), false);
48453        composeStringExtras("readsetId", element.getReadsetIdElement(), false);
48454      }
48455  }
48456
48457  protected void composeMolecularSequenceMolecularSequenceStructureVariantComponent(String name, MolecularSequence.MolecularSequenceStructureVariantComponent element) throws IOException {
48458    if (element != null) {
48459      open(name);
48460      composeMolecularSequenceMolecularSequenceStructureVariantComponentInner(element);
48461      close();
48462    }
48463  }
48464
48465  protected void composeMolecularSequenceMolecularSequenceStructureVariantComponentInner(MolecularSequence.MolecularSequenceStructureVariantComponent element) throws IOException {
48466      composeBackbone(element);
48467      if (element.hasVariantType()) {
48468        composeCodeableConcept("variantType", element.getVariantType());
48469      }
48470      if (element.hasExactElement()) {
48471        composeBooleanCore("exact", element.getExactElement(), false);
48472        composeBooleanExtras("exact", element.getExactElement(), false);
48473      }
48474      if (element.hasLengthElement()) {
48475        composeIntegerCore("length", element.getLengthElement(), false);
48476        composeIntegerExtras("length", element.getLengthElement(), false);
48477      }
48478      if (element.hasOuter()) {
48479        composeMolecularSequenceMolecularSequenceStructureVariantOuterComponent("outer", element.getOuter());
48480      }
48481      if (element.hasInner()) {
48482        composeMolecularSequenceMolecularSequenceStructureVariantInnerComponent("inner", element.getInner());
48483      }
48484  }
48485
48486  protected void composeMolecularSequenceMolecularSequenceStructureVariantOuterComponent(String name, MolecularSequence.MolecularSequenceStructureVariantOuterComponent element) throws IOException {
48487    if (element != null) {
48488      open(name);
48489      composeMolecularSequenceMolecularSequenceStructureVariantOuterComponentInner(element);
48490      close();
48491    }
48492  }
48493
48494  protected void composeMolecularSequenceMolecularSequenceStructureVariantOuterComponentInner(MolecularSequence.MolecularSequenceStructureVariantOuterComponent element) throws IOException {
48495      composeBackbone(element);
48496      if (element.hasStartElement()) {
48497        composeIntegerCore("start", element.getStartElement(), false);
48498        composeIntegerExtras("start", element.getStartElement(), false);
48499      }
48500      if (element.hasEndElement()) {
48501        composeIntegerCore("end", element.getEndElement(), false);
48502        composeIntegerExtras("end", element.getEndElement(), false);
48503      }
48504  }
48505
48506  protected void composeMolecularSequenceMolecularSequenceStructureVariantInnerComponent(String name, MolecularSequence.MolecularSequenceStructureVariantInnerComponent element) throws IOException {
48507    if (element != null) {
48508      open(name);
48509      composeMolecularSequenceMolecularSequenceStructureVariantInnerComponentInner(element);
48510      close();
48511    }
48512  }
48513
48514  protected void composeMolecularSequenceMolecularSequenceStructureVariantInnerComponentInner(MolecularSequence.MolecularSequenceStructureVariantInnerComponent element) throws IOException {
48515      composeBackbone(element);
48516      if (element.hasStartElement()) {
48517        composeIntegerCore("start", element.getStartElement(), false);
48518        composeIntegerExtras("start", element.getStartElement(), false);
48519      }
48520      if (element.hasEndElement()) {
48521        composeIntegerCore("end", element.getEndElement(), false);
48522        composeIntegerExtras("end", element.getEndElement(), false);
48523      }
48524  }
48525
48526  protected void composeNamingSystem(String name, NamingSystem element) throws IOException {
48527    if (element != null) {
48528      prop("resourceType", name);
48529      composeNamingSystemInner(element);
48530    }
48531  }
48532
48533  protected void composeNamingSystemInner(NamingSystem element) throws IOException {
48534      composeDomainResourceElements(element);
48535      if (element.hasNameElement()) {
48536        composeStringCore("name", element.getNameElement(), false);
48537        composeStringExtras("name", element.getNameElement(), false);
48538      }
48539      if (element.hasStatusElement()) {
48540        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
48541        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
48542      }
48543      if (element.hasKindElement()) {
48544        composeEnumerationCore("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
48545        composeEnumerationExtras("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
48546      }
48547      if (element.hasDateElement()) {
48548        composeDateTimeCore("date", element.getDateElement(), false);
48549        composeDateTimeExtras("date", element.getDateElement(), false);
48550      }
48551      if (element.hasPublisherElement()) {
48552        composeStringCore("publisher", element.getPublisherElement(), false);
48553        composeStringExtras("publisher", element.getPublisherElement(), false);
48554      }
48555      if (element.hasContact()) {
48556        openArray("contact");
48557        for (ContactDetail e : element.getContact()) 
48558          composeContactDetail(null, e);
48559        closeArray();
48560      };
48561      if (element.hasResponsibleElement()) {
48562        composeStringCore("responsible", element.getResponsibleElement(), false);
48563        composeStringExtras("responsible", element.getResponsibleElement(), false);
48564      }
48565      if (element.hasType()) {
48566        composeCodeableConcept("type", element.getType());
48567      }
48568      if (element.hasDescriptionElement()) {
48569        composeMarkdownCore("description", element.getDescriptionElement(), false);
48570        composeMarkdownExtras("description", element.getDescriptionElement(), false);
48571      }
48572      if (element.hasUseContext()) {
48573        openArray("useContext");
48574        for (UsageContext e : element.getUseContext()) 
48575          composeUsageContext(null, e);
48576        closeArray();
48577      };
48578      if (element.hasJurisdiction()) {
48579        openArray("jurisdiction");
48580        for (CodeableConcept e : element.getJurisdiction()) 
48581          composeCodeableConcept(null, e);
48582        closeArray();
48583      };
48584      if (element.hasUsageElement()) {
48585        composeStringCore("usage", element.getUsageElement(), false);
48586        composeStringExtras("usage", element.getUsageElement(), false);
48587      }
48588      if (element.hasUniqueId()) {
48589        openArray("uniqueId");
48590        for (NamingSystem.NamingSystemUniqueIdComponent e : element.getUniqueId()) 
48591          composeNamingSystemNamingSystemUniqueIdComponent(null, e);
48592        closeArray();
48593      };
48594  }
48595
48596  protected void composeNamingSystemNamingSystemUniqueIdComponent(String name, NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
48597    if (element != null) {
48598      open(name);
48599      composeNamingSystemNamingSystemUniqueIdComponentInner(element);
48600      close();
48601    }
48602  }
48603
48604  protected void composeNamingSystemNamingSystemUniqueIdComponentInner(NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
48605      composeBackbone(element);
48606      if (element.hasTypeElement()) {
48607        composeEnumerationCore("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
48608        composeEnumerationExtras("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
48609      }
48610      if (element.hasValueElement()) {
48611        composeStringCore("value", element.getValueElement(), false);
48612        composeStringExtras("value", element.getValueElement(), false);
48613      }
48614      if (element.hasPreferredElement()) {
48615        composeBooleanCore("preferred", element.getPreferredElement(), false);
48616        composeBooleanExtras("preferred", element.getPreferredElement(), false);
48617      }
48618      if (element.hasCommentElement()) {
48619        composeStringCore("comment", element.getCommentElement(), false);
48620        composeStringExtras("comment", element.getCommentElement(), false);
48621      }
48622      if (element.hasPeriod()) {
48623        composePeriod("period", element.getPeriod());
48624      }
48625  }
48626
48627  protected void composeNutritionOrder(String name, NutritionOrder element) throws IOException {
48628    if (element != null) {
48629      prop("resourceType", name);
48630      composeNutritionOrderInner(element);
48631    }
48632  }
48633
48634  protected void composeNutritionOrderInner(NutritionOrder element) throws IOException {
48635      composeDomainResourceElements(element);
48636      if (element.hasIdentifier()) {
48637        openArray("identifier");
48638        for (Identifier e : element.getIdentifier()) 
48639          composeIdentifier(null, e);
48640        closeArray();
48641      };
48642      if (element.hasInstantiatesCanonical()) {
48643        openArray("instantiatesCanonical");
48644        for (CanonicalType e : element.getInstantiatesCanonical()) 
48645          composeCanonicalCore(null, e, true);
48646        closeArray();
48647        if (anyHasExtras(element.getInstantiatesCanonical())) {
48648          openArray("_instantiatesCanonical");
48649          for (CanonicalType e : element.getInstantiatesCanonical()) 
48650            composeCanonicalExtras(null, e, true);
48651          closeArray();
48652        }
48653      };
48654      if (element.hasInstantiatesUri()) {
48655        openArray("instantiatesUri");
48656        for (UriType e : element.getInstantiatesUri()) 
48657          composeUriCore(null, e, true);
48658        closeArray();
48659        if (anyHasExtras(element.getInstantiatesUri())) {
48660          openArray("_instantiatesUri");
48661          for (UriType e : element.getInstantiatesUri()) 
48662            composeUriExtras(null, e, true);
48663          closeArray();
48664        }
48665      };
48666      if (element.hasInstantiates()) {
48667        openArray("instantiates");
48668        for (UriType e : element.getInstantiates()) 
48669          composeUriCore(null, e, true);
48670        closeArray();
48671        if (anyHasExtras(element.getInstantiates())) {
48672          openArray("_instantiates");
48673          for (UriType e : element.getInstantiates()) 
48674            composeUriExtras(null, e, true);
48675          closeArray();
48676        }
48677      };
48678      if (element.hasStatusElement()) {
48679        composeEnumerationCore("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
48680        composeEnumerationExtras("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
48681      }
48682      if (element.hasIntentElement()) {
48683        composeEnumerationCore("intent", element.getIntentElement(), new NutritionOrder.NutritiionOrderIntentEnumFactory(), false);
48684        composeEnumerationExtras("intent", element.getIntentElement(), new NutritionOrder.NutritiionOrderIntentEnumFactory(), false);
48685      }
48686      if (element.hasPatient()) {
48687        composeReference("patient", element.getPatient());
48688      }
48689      if (element.hasEncounter()) {
48690        composeReference("encounter", element.getEncounter());
48691      }
48692      if (element.hasDateTimeElement()) {
48693        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
48694        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
48695      }
48696      if (element.hasOrderer()) {
48697        composeReference("orderer", element.getOrderer());
48698      }
48699      if (element.hasAllergyIntolerance()) {
48700        openArray("allergyIntolerance");
48701        for (Reference e : element.getAllergyIntolerance()) 
48702          composeReference(null, e);
48703        closeArray();
48704      };
48705      if (element.hasFoodPreferenceModifier()) {
48706        openArray("foodPreferenceModifier");
48707        for (CodeableConcept e : element.getFoodPreferenceModifier()) 
48708          composeCodeableConcept(null, e);
48709        closeArray();
48710      };
48711      if (element.hasExcludeFoodModifier()) {
48712        openArray("excludeFoodModifier");
48713        for (CodeableConcept e : element.getExcludeFoodModifier()) 
48714          composeCodeableConcept(null, e);
48715        closeArray();
48716      };
48717      if (element.hasOralDiet()) {
48718        composeNutritionOrderNutritionOrderOralDietComponent("oralDiet", element.getOralDiet());
48719      }
48720      if (element.hasSupplement()) {
48721        openArray("supplement");
48722        for (NutritionOrder.NutritionOrderSupplementComponent e : element.getSupplement()) 
48723          composeNutritionOrderNutritionOrderSupplementComponent(null, e);
48724        closeArray();
48725      };
48726      if (element.hasEnteralFormula()) {
48727        composeNutritionOrderNutritionOrderEnteralFormulaComponent("enteralFormula", element.getEnteralFormula());
48728      }
48729      if (element.hasNote()) {
48730        openArray("note");
48731        for (Annotation e : element.getNote()) 
48732          composeAnnotation(null, e);
48733        closeArray();
48734      };
48735  }
48736
48737  protected void composeNutritionOrderNutritionOrderOralDietComponent(String name, NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
48738    if (element != null) {
48739      open(name);
48740      composeNutritionOrderNutritionOrderOralDietComponentInner(element);
48741      close();
48742    }
48743  }
48744
48745  protected void composeNutritionOrderNutritionOrderOralDietComponentInner(NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
48746      composeBackbone(element);
48747      if (element.hasType()) {
48748        openArray("type");
48749        for (CodeableConcept e : element.getType()) 
48750          composeCodeableConcept(null, e);
48751        closeArray();
48752      };
48753      if (element.hasSchedule()) {
48754        openArray("schedule");
48755        for (Timing e : element.getSchedule()) 
48756          composeTiming(null, e);
48757        closeArray();
48758      };
48759      if (element.hasNutrient()) {
48760        openArray("nutrient");
48761        for (NutritionOrder.NutritionOrderOralDietNutrientComponent e : element.getNutrient()) 
48762          composeNutritionOrderNutritionOrderOralDietNutrientComponent(null, e);
48763        closeArray();
48764      };
48765      if (element.hasTexture()) {
48766        openArray("texture");
48767        for (NutritionOrder.NutritionOrderOralDietTextureComponent e : element.getTexture()) 
48768          composeNutritionOrderNutritionOrderOralDietTextureComponent(null, e);
48769        closeArray();
48770      };
48771      if (element.hasFluidConsistencyType()) {
48772        openArray("fluidConsistencyType");
48773        for (CodeableConcept e : element.getFluidConsistencyType()) 
48774          composeCodeableConcept(null, e);
48775        closeArray();
48776      };
48777      if (element.hasInstructionElement()) {
48778        composeStringCore("instruction", element.getInstructionElement(), false);
48779        composeStringExtras("instruction", element.getInstructionElement(), false);
48780      }
48781  }
48782
48783  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponent(String name, NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
48784    if (element != null) {
48785      open(name);
48786      composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(element);
48787      close();
48788    }
48789  }
48790
48791  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
48792      composeBackbone(element);
48793      if (element.hasModifier()) {
48794        composeCodeableConcept("modifier", element.getModifier());
48795      }
48796      if (element.hasAmount()) {
48797        composeQuantity("amount", element.getAmount());
48798      }
48799  }
48800
48801  protected void composeNutritionOrderNutritionOrderOralDietTextureComponent(String name, NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
48802    if (element != null) {
48803      open(name);
48804      composeNutritionOrderNutritionOrderOralDietTextureComponentInner(element);
48805      close();
48806    }
48807  }
48808
48809  protected void composeNutritionOrderNutritionOrderOralDietTextureComponentInner(NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
48810      composeBackbone(element);
48811      if (element.hasModifier()) {
48812        composeCodeableConcept("modifier", element.getModifier());
48813      }
48814      if (element.hasFoodType()) {
48815        composeCodeableConcept("foodType", element.getFoodType());
48816      }
48817  }
48818
48819  protected void composeNutritionOrderNutritionOrderSupplementComponent(String name, NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
48820    if (element != null) {
48821      open(name);
48822      composeNutritionOrderNutritionOrderSupplementComponentInner(element);
48823      close();
48824    }
48825  }
48826
48827  protected void composeNutritionOrderNutritionOrderSupplementComponentInner(NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
48828      composeBackbone(element);
48829      if (element.hasType()) {
48830        composeCodeableConcept("type", element.getType());
48831      }
48832      if (element.hasProductNameElement()) {
48833        composeStringCore("productName", element.getProductNameElement(), false);
48834        composeStringExtras("productName", element.getProductNameElement(), false);
48835      }
48836      if (element.hasSchedule()) {
48837        openArray("schedule");
48838        for (Timing e : element.getSchedule()) 
48839          composeTiming(null, e);
48840        closeArray();
48841      };
48842      if (element.hasQuantity()) {
48843        composeQuantity("quantity", element.getQuantity());
48844      }
48845      if (element.hasInstructionElement()) {
48846        composeStringCore("instruction", element.getInstructionElement(), false);
48847        composeStringExtras("instruction", element.getInstructionElement(), false);
48848      }
48849  }
48850
48851  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
48852    if (element != null) {
48853      open(name);
48854      composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(element);
48855      close();
48856    }
48857  }
48858
48859  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
48860      composeBackbone(element);
48861      if (element.hasBaseFormulaType()) {
48862        composeCodeableConcept("baseFormulaType", element.getBaseFormulaType());
48863      }
48864      if (element.hasBaseFormulaProductNameElement()) {
48865        composeStringCore("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
48866        composeStringExtras("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
48867      }
48868      if (element.hasAdditiveType()) {
48869        composeCodeableConcept("additiveType", element.getAdditiveType());
48870      }
48871      if (element.hasAdditiveProductNameElement()) {
48872        composeStringCore("additiveProductName", element.getAdditiveProductNameElement(), false);
48873        composeStringExtras("additiveProductName", element.getAdditiveProductNameElement(), false);
48874      }
48875      if (element.hasCaloricDensity()) {
48876        composeQuantity("caloricDensity", element.getCaloricDensity());
48877      }
48878      if (element.hasRouteofAdministration()) {
48879        composeCodeableConcept("routeofAdministration", element.getRouteofAdministration());
48880      }
48881      if (element.hasAdministration()) {
48882        openArray("administration");
48883        for (NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent e : element.getAdministration()) 
48884          composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(null, e);
48885        closeArray();
48886      };
48887      if (element.hasMaxVolumeToDeliver()) {
48888        composeQuantity("maxVolumeToDeliver", element.getMaxVolumeToDeliver());
48889      }
48890      if (element.hasAdministrationInstructionElement()) {
48891        composeStringCore("administrationInstruction", element.getAdministrationInstructionElement(), false);
48892        composeStringExtras("administrationInstruction", element.getAdministrationInstructionElement(), false);
48893      }
48894  }
48895
48896  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
48897    if (element != null) {
48898      open(name);
48899      composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(element);
48900      close();
48901    }
48902  }
48903
48904  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
48905      composeBackbone(element);
48906      if (element.hasSchedule()) {
48907        composeTiming("schedule", element.getSchedule());
48908      }
48909      if (element.hasQuantity()) {
48910        composeQuantity("quantity", element.getQuantity());
48911      }
48912      if (element.hasRate()) {
48913        composeType("rate", element.getRate());
48914      }
48915  }
48916
48917  protected void composeObservation(String name, Observation element) throws IOException {
48918    if (element != null) {
48919      prop("resourceType", name);
48920      composeObservationInner(element);
48921    }
48922  }
48923
48924  protected void composeObservationInner(Observation element) throws IOException {
48925      composeDomainResourceElements(element);
48926      if (element.hasIdentifier()) {
48927        openArray("identifier");
48928        for (Identifier e : element.getIdentifier()) 
48929          composeIdentifier(null, e);
48930        closeArray();
48931      };
48932      if (element.hasBasedOn()) {
48933        openArray("basedOn");
48934        for (Reference e : element.getBasedOn()) 
48935          composeReference(null, e);
48936        closeArray();
48937      };
48938      if (element.hasPartOf()) {
48939        openArray("partOf");
48940        for (Reference e : element.getPartOf()) 
48941          composeReference(null, e);
48942        closeArray();
48943      };
48944      if (element.hasStatusElement()) {
48945        composeEnumerationCore("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
48946        composeEnumerationExtras("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
48947      }
48948      if (element.hasCategory()) {
48949        openArray("category");
48950        for (CodeableConcept e : element.getCategory()) 
48951          composeCodeableConcept(null, e);
48952        closeArray();
48953      };
48954      if (element.hasCode()) {
48955        composeCodeableConcept("code", element.getCode());
48956      }
48957      if (element.hasSubject()) {
48958        composeReference("subject", element.getSubject());
48959      }
48960      if (element.hasFocus()) {
48961        openArray("focus");
48962        for (Reference e : element.getFocus()) 
48963          composeReference(null, e);
48964        closeArray();
48965      };
48966      if (element.hasEncounter()) {
48967        composeReference("encounter", element.getEncounter());
48968      }
48969      if (element.hasEffective()) {
48970        composeType("effective", element.getEffective());
48971      }
48972      if (element.hasIssuedElement()) {
48973        composeInstantCore("issued", element.getIssuedElement(), false);
48974        composeInstantExtras("issued", element.getIssuedElement(), false);
48975      }
48976      if (element.hasPerformer()) {
48977        openArray("performer");
48978        for (Reference e : element.getPerformer()) 
48979          composeReference(null, e);
48980        closeArray();
48981      };
48982      if (element.hasValue()) {
48983        composeType("value", element.getValue());
48984      }
48985      if (element.hasDataAbsentReason()) {
48986        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
48987      }
48988      if (element.hasInterpretation()) {
48989        openArray("interpretation");
48990        for (CodeableConcept e : element.getInterpretation()) 
48991          composeCodeableConcept(null, e);
48992        closeArray();
48993      };
48994      if (element.hasNote()) {
48995        openArray("note");
48996        for (Annotation e : element.getNote()) 
48997          composeAnnotation(null, e);
48998        closeArray();
48999      };
49000      if (element.hasBodySite()) {
49001        composeCodeableConcept("bodySite", element.getBodySite());
49002      }
49003      if (element.hasMethod()) {
49004        composeCodeableConcept("method", element.getMethod());
49005      }
49006      if (element.hasSpecimen()) {
49007        composeReference("specimen", element.getSpecimen());
49008      }
49009      if (element.hasDevice()) {
49010        composeReference("device", element.getDevice());
49011      }
49012      if (element.hasReferenceRange()) {
49013        openArray("referenceRange");
49014        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
49015          composeObservationObservationReferenceRangeComponent(null, e);
49016        closeArray();
49017      };
49018      if (element.hasHasMember()) {
49019        openArray("hasMember");
49020        for (Reference e : element.getHasMember()) 
49021          composeReference(null, e);
49022        closeArray();
49023      };
49024      if (element.hasDerivedFrom()) {
49025        openArray("derivedFrom");
49026        for (Reference e : element.getDerivedFrom()) 
49027          composeReference(null, e);
49028        closeArray();
49029      };
49030      if (element.hasComponent()) {
49031        openArray("component");
49032        for (Observation.ObservationComponentComponent e : element.getComponent()) 
49033          composeObservationObservationComponentComponent(null, e);
49034        closeArray();
49035      };
49036  }
49037
49038  protected void composeObservationObservationReferenceRangeComponent(String name, Observation.ObservationReferenceRangeComponent element) throws IOException {
49039    if (element != null) {
49040      open(name);
49041      composeObservationObservationReferenceRangeComponentInner(element);
49042      close();
49043    }
49044  }
49045
49046  protected void composeObservationObservationReferenceRangeComponentInner(Observation.ObservationReferenceRangeComponent element) throws IOException {
49047      composeBackbone(element);
49048      if (element.hasLow()) {
49049        composeQuantity("low", element.getLow());
49050      }
49051      if (element.hasHigh()) {
49052        composeQuantity("high", element.getHigh());
49053      }
49054      if (element.hasType()) {
49055        composeCodeableConcept("type", element.getType());
49056      }
49057      if (element.hasAppliesTo()) {
49058        openArray("appliesTo");
49059        for (CodeableConcept e : element.getAppliesTo()) 
49060          composeCodeableConcept(null, e);
49061        closeArray();
49062      };
49063      if (element.hasAge()) {
49064        composeRange("age", element.getAge());
49065      }
49066      if (element.hasTextElement()) {
49067        composeStringCore("text", element.getTextElement(), false);
49068        composeStringExtras("text", element.getTextElement(), false);
49069      }
49070  }
49071
49072  protected void composeObservationObservationComponentComponent(String name, Observation.ObservationComponentComponent element) throws IOException {
49073    if (element != null) {
49074      open(name);
49075      composeObservationObservationComponentComponentInner(element);
49076      close();
49077    }
49078  }
49079
49080  protected void composeObservationObservationComponentComponentInner(Observation.ObservationComponentComponent element) throws IOException {
49081      composeBackbone(element);
49082      if (element.hasCode()) {
49083        composeCodeableConcept("code", element.getCode());
49084      }
49085      if (element.hasValue()) {
49086        composeType("value", element.getValue());
49087      }
49088      if (element.hasDataAbsentReason()) {
49089        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
49090      }
49091      if (element.hasInterpretation()) {
49092        openArray("interpretation");
49093        for (CodeableConcept e : element.getInterpretation()) 
49094          composeCodeableConcept(null, e);
49095        closeArray();
49096      };
49097      if (element.hasReferenceRange()) {
49098        openArray("referenceRange");
49099        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
49100          composeObservationObservationReferenceRangeComponent(null, e);
49101        closeArray();
49102      };
49103  }
49104
49105  protected void composeObservationDefinition(String name, ObservationDefinition element) throws IOException {
49106    if (element != null) {
49107      prop("resourceType", name);
49108      composeObservationDefinitionInner(element);
49109    }
49110  }
49111
49112  protected void composeObservationDefinitionInner(ObservationDefinition element) throws IOException {
49113      composeDomainResourceElements(element);
49114      if (element.hasCategory()) {
49115        openArray("category");
49116        for (CodeableConcept e : element.getCategory()) 
49117          composeCodeableConcept(null, e);
49118        closeArray();
49119      };
49120      if (element.hasCode()) {
49121        composeCodeableConcept("code", element.getCode());
49122      }
49123      if (element.hasIdentifier()) {
49124        openArray("identifier");
49125        for (Identifier e : element.getIdentifier()) 
49126          composeIdentifier(null, e);
49127        closeArray();
49128      };
49129      if (element.hasPermittedDataType()) {
49130        openArray("permittedDataType");
49131        for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
49132          composeEnumerationCore(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
49133        closeArray();
49134        if (anyHasExtras(element.getPermittedDataType())) {
49135          openArray("_permittedDataType");
49136          for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
49137            composeEnumerationExtras(null, e, new ObservationDefinition.ObservationDataTypeEnumFactory(), true);
49138          closeArray();
49139        }
49140      };
49141      if (element.hasMultipleResultsAllowedElement()) {
49142        composeBooleanCore("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
49143        composeBooleanExtras("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
49144      }
49145      if (element.hasMethod()) {
49146        composeCodeableConcept("method", element.getMethod());
49147      }
49148      if (element.hasPreferredReportNameElement()) {
49149        composeStringCore("preferredReportName", element.getPreferredReportNameElement(), false);
49150        composeStringExtras("preferredReportName", element.getPreferredReportNameElement(), false);
49151      }
49152      if (element.hasQuantitativeDetails()) {
49153        composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponent("quantitativeDetails", element.getQuantitativeDetails());
49154      }
49155      if (element.hasQualifiedInterval()) {
49156        openArray("qualifiedInterval");
49157        for (ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent e : element.getQualifiedInterval()) 
49158          composeObservationDefinitionObservationDefinitionQualifiedIntervalComponent(null, e);
49159        closeArray();
49160      };
49161      if (element.hasValidCodedValueSet()) {
49162        composeReference("validCodedValueSet", element.getValidCodedValueSet());
49163      }
49164      if (element.hasNormalCodedValueSet()) {
49165        composeReference("normalCodedValueSet", element.getNormalCodedValueSet());
49166      }
49167      if (element.hasAbnormalCodedValueSet()) {
49168        composeReference("abnormalCodedValueSet", element.getAbnormalCodedValueSet());
49169      }
49170      if (element.hasCriticalCodedValueSet()) {
49171        composeReference("criticalCodedValueSet", element.getCriticalCodedValueSet());
49172      }
49173  }
49174
49175  protected void composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(String name, ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent element) throws IOException {
49176    if (element != null) {
49177      open(name);
49178      composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponentInner(element);
49179      close();
49180    }
49181  }
49182
49183  protected void composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponentInner(ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent element) throws IOException {
49184      composeBackbone(element);
49185      if (element.hasCustomaryUnit()) {
49186        composeCodeableConcept("customaryUnit", element.getCustomaryUnit());
49187      }
49188      if (element.hasUnit()) {
49189        composeCodeableConcept("unit", element.getUnit());
49190      }
49191      if (element.hasConversionFactorElement()) {
49192        composeDecimalCore("conversionFactor", element.getConversionFactorElement(), false);
49193        composeDecimalExtras("conversionFactor", element.getConversionFactorElement(), false);
49194      }
49195      if (element.hasDecimalPrecisionElement()) {
49196        composeIntegerCore("decimalPrecision", element.getDecimalPrecisionElement(), false);
49197        composeIntegerExtras("decimalPrecision", element.getDecimalPrecisionElement(), false);
49198      }
49199  }
49200
49201  protected void composeObservationDefinitionObservationDefinitionQualifiedIntervalComponent(String name, ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent element) throws IOException {
49202    if (element != null) {
49203      open(name);
49204      composeObservationDefinitionObservationDefinitionQualifiedIntervalComponentInner(element);
49205      close();
49206    }
49207  }
49208
49209  protected void composeObservationDefinitionObservationDefinitionQualifiedIntervalComponentInner(ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent element) throws IOException {
49210      composeBackbone(element);
49211      if (element.hasCategoryElement()) {
49212        composeEnumerationCore("category", element.getCategoryElement(), new ObservationDefinition.ObservationRangeCategoryEnumFactory(), false);
49213        composeEnumerationExtras("category", element.getCategoryElement(), new ObservationDefinition.ObservationRangeCategoryEnumFactory(), false);
49214      }
49215      if (element.hasRange()) {
49216        composeRange("range", element.getRange());
49217      }
49218      if (element.hasContext()) {
49219        composeCodeableConcept("context", element.getContext());
49220      }
49221      if (element.hasAppliesTo()) {
49222        openArray("appliesTo");
49223        for (CodeableConcept e : element.getAppliesTo()) 
49224          composeCodeableConcept(null, e);
49225        closeArray();
49226      };
49227      if (element.hasGenderElement()) {
49228        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
49229        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
49230      }
49231      if (element.hasAge()) {
49232        composeRange("age", element.getAge());
49233      }
49234      if (element.hasGestationalAge()) {
49235        composeRange("gestationalAge", element.getGestationalAge());
49236      }
49237      if (element.hasConditionElement()) {
49238        composeStringCore("condition", element.getConditionElement(), false);
49239        composeStringExtras("condition", element.getConditionElement(), false);
49240      }
49241  }
49242
49243  protected void composeOperationDefinition(String name, OperationDefinition element) throws IOException {
49244    if (element != null) {
49245      prop("resourceType", name);
49246      composeOperationDefinitionInner(element);
49247    }
49248  }
49249
49250  protected void composeOperationDefinitionInner(OperationDefinition element) throws IOException {
49251      composeDomainResourceElements(element);
49252      if (element.hasUrlElement()) {
49253        composeUriCore("url", element.getUrlElement(), false);
49254        composeUriExtras("url", element.getUrlElement(), false);
49255      }
49256      if (element.hasVersionElement()) {
49257        composeStringCore("version", element.getVersionElement(), false);
49258        composeStringExtras("version", element.getVersionElement(), false);
49259      }
49260      if (element.hasNameElement()) {
49261        composeStringCore("name", element.getNameElement(), false);
49262        composeStringExtras("name", element.getNameElement(), false);
49263      }
49264      if (element.hasTitleElement()) {
49265        composeStringCore("title", element.getTitleElement(), false);
49266        composeStringExtras("title", element.getTitleElement(), false);
49267      }
49268      if (element.hasStatusElement()) {
49269        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
49270        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
49271      }
49272      if (element.hasKindElement()) {
49273        composeEnumerationCore("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
49274        composeEnumerationExtras("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
49275      }
49276      if (element.hasExperimentalElement()) {
49277        composeBooleanCore("experimental", element.getExperimentalElement(), false);
49278        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
49279      }
49280      if (element.hasDateElement()) {
49281        composeDateTimeCore("date", element.getDateElement(), false);
49282        composeDateTimeExtras("date", element.getDateElement(), false);
49283      }
49284      if (element.hasPublisherElement()) {
49285        composeStringCore("publisher", element.getPublisherElement(), false);
49286        composeStringExtras("publisher", element.getPublisherElement(), false);
49287      }
49288      if (element.hasContact()) {
49289        openArray("contact");
49290        for (ContactDetail e : element.getContact()) 
49291          composeContactDetail(null, e);
49292        closeArray();
49293      };
49294      if (element.hasDescriptionElement()) {
49295        composeMarkdownCore("description", element.getDescriptionElement(), false);
49296        composeMarkdownExtras("description", element.getDescriptionElement(), false);
49297      }
49298      if (element.hasUseContext()) {
49299        openArray("useContext");
49300        for (UsageContext e : element.getUseContext()) 
49301          composeUsageContext(null, e);
49302        closeArray();
49303      };
49304      if (element.hasJurisdiction()) {
49305        openArray("jurisdiction");
49306        for (CodeableConcept e : element.getJurisdiction()) 
49307          composeCodeableConcept(null, e);
49308        closeArray();
49309      };
49310      if (element.hasPurposeElement()) {
49311        composeMarkdownCore("purpose", element.getPurposeElement(), false);
49312        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
49313      }
49314      if (element.hasAffectsStateElement()) {
49315        composeBooleanCore("affectsState", element.getAffectsStateElement(), false);
49316        composeBooleanExtras("affectsState", element.getAffectsStateElement(), false);
49317      }
49318      if (element.hasCodeElement()) {
49319        composeCodeCore("code", element.getCodeElement(), false);
49320        composeCodeExtras("code", element.getCodeElement(), false);
49321      }
49322      if (element.hasCommentElement()) {
49323        composeMarkdownCore("comment", element.getCommentElement(), false);
49324        composeMarkdownExtras("comment", element.getCommentElement(), false);
49325      }
49326      if (element.hasBaseElement()) {
49327        composeCanonicalCore("base", element.getBaseElement(), false);
49328        composeCanonicalExtras("base", element.getBaseElement(), false);
49329      }
49330      if (element.hasResource()) {
49331        openArray("resource");
49332        for (CodeType e : element.getResource()) 
49333          composeCodeCore(null, e, true);
49334        closeArray();
49335        if (anyHasExtras(element.getResource())) {
49336          openArray("_resource");
49337          for (CodeType e : element.getResource()) 
49338            composeCodeExtras(null, e, true);
49339          closeArray();
49340        }
49341      };
49342      if (element.hasSystemElement()) {
49343        composeBooleanCore("system", element.getSystemElement(), false);
49344        composeBooleanExtras("system", element.getSystemElement(), false);
49345      }
49346      if (element.hasTypeElement()) {
49347        composeBooleanCore("type", element.getTypeElement(), false);
49348        composeBooleanExtras("type", element.getTypeElement(), false);
49349      }
49350      if (element.hasInstanceElement()) {
49351        composeBooleanCore("instance", element.getInstanceElement(), false);
49352        composeBooleanExtras("instance", element.getInstanceElement(), false);
49353      }
49354      if (element.hasInputProfileElement()) {
49355        composeCanonicalCore("inputProfile", element.getInputProfileElement(), false);
49356        composeCanonicalExtras("inputProfile", element.getInputProfileElement(), false);
49357      }
49358      if (element.hasOutputProfileElement()) {
49359        composeCanonicalCore("outputProfile", element.getOutputProfileElement(), false);
49360        composeCanonicalExtras("outputProfile", element.getOutputProfileElement(), false);
49361      }
49362      if (element.hasParameter()) {
49363        openArray("parameter");
49364        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getParameter()) 
49365          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
49366        closeArray();
49367      };
49368      if (element.hasOverload()) {
49369        openArray("overload");
49370        for (OperationDefinition.OperationDefinitionOverloadComponent e : element.getOverload()) 
49371          composeOperationDefinitionOperationDefinitionOverloadComponent(null, e);
49372        closeArray();
49373      };
49374  }
49375
49376  protected void composeOperationDefinitionOperationDefinitionParameterComponent(String name, OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
49377    if (element != null) {
49378      open(name);
49379      composeOperationDefinitionOperationDefinitionParameterComponentInner(element);
49380      close();
49381    }
49382  }
49383
49384  protected void composeOperationDefinitionOperationDefinitionParameterComponentInner(OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
49385      composeBackbone(element);
49386      if (element.hasNameElement()) {
49387        composeCodeCore("name", element.getNameElement(), false);
49388        composeCodeExtras("name", element.getNameElement(), false);
49389      }
49390      if (element.hasUseElement()) {
49391        composeEnumerationCore("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
49392        composeEnumerationExtras("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
49393      }
49394      if (element.hasMinElement()) {
49395        composeIntegerCore("min", element.getMinElement(), false);
49396        composeIntegerExtras("min", element.getMinElement(), false);
49397      }
49398      if (element.hasMaxElement()) {
49399        composeStringCore("max", element.getMaxElement(), false);
49400        composeStringExtras("max", element.getMaxElement(), false);
49401      }
49402      if (element.hasDocumentationElement()) {
49403        composeStringCore("documentation", element.getDocumentationElement(), false);
49404        composeStringExtras("documentation", element.getDocumentationElement(), false);
49405      }
49406      if (element.hasTypeElement()) {
49407        composeCodeCore("type", element.getTypeElement(), false);
49408        composeCodeExtras("type", element.getTypeElement(), false);
49409      }
49410      if (element.hasTargetProfile()) {
49411        openArray("targetProfile");
49412        for (CanonicalType e : element.getTargetProfile()) 
49413          composeCanonicalCore(null, e, true);
49414        closeArray();
49415        if (anyHasExtras(element.getTargetProfile())) {
49416          openArray("_targetProfile");
49417          for (CanonicalType e : element.getTargetProfile()) 
49418            composeCanonicalExtras(null, e, true);
49419          closeArray();
49420        }
49421      };
49422      if (element.hasSearchTypeElement()) {
49423        composeEnumerationCore("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
49424        composeEnumerationExtras("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
49425      }
49426      if (element.hasBinding()) {
49427        composeOperationDefinitionOperationDefinitionParameterBindingComponent("binding", element.getBinding());
49428      }
49429      if (element.hasReferencedFrom()) {
49430        openArray("referencedFrom");
49431        for (OperationDefinition.OperationDefinitionParameterReferencedFromComponent e : element.getReferencedFrom()) 
49432          composeOperationDefinitionOperationDefinitionParameterReferencedFromComponent(null, e);
49433        closeArray();
49434      };
49435      if (element.hasPart()) {
49436        openArray("part");
49437        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getPart()) 
49438          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
49439        closeArray();
49440      };
49441  }
49442
49443  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponent(String name, OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
49444    if (element != null) {
49445      open(name);
49446      composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(element);
49447      close();
49448    }
49449  }
49450
49451  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
49452      composeBackbone(element);
49453      if (element.hasStrengthElement()) {
49454        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
49455        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
49456      }
49457      if (element.hasValueSetElement()) {
49458        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
49459        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
49460      }
49461  }
49462
49463  protected void composeOperationDefinitionOperationDefinitionParameterReferencedFromComponent(String name, OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
49464    if (element != null) {
49465      open(name);
49466      composeOperationDefinitionOperationDefinitionParameterReferencedFromComponentInner(element);
49467      close();
49468    }
49469  }
49470
49471  protected void composeOperationDefinitionOperationDefinitionParameterReferencedFromComponentInner(OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
49472      composeBackbone(element);
49473      if (element.hasSourceElement()) {
49474        composeStringCore("source", element.getSourceElement(), false);
49475        composeStringExtras("source", element.getSourceElement(), false);
49476      }
49477      if (element.hasSourceIdElement()) {
49478        composeStringCore("sourceId", element.getSourceIdElement(), false);
49479        composeStringExtras("sourceId", element.getSourceIdElement(), false);
49480      }
49481  }
49482
49483  protected void composeOperationDefinitionOperationDefinitionOverloadComponent(String name, OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
49484    if (element != null) {
49485      open(name);
49486      composeOperationDefinitionOperationDefinitionOverloadComponentInner(element);
49487      close();
49488    }
49489  }
49490
49491  protected void composeOperationDefinitionOperationDefinitionOverloadComponentInner(OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
49492      composeBackbone(element);
49493      if (element.hasParameterName()) {
49494        openArray("parameterName");
49495        for (StringType e : element.getParameterName()) 
49496          composeStringCore(null, e, true);
49497        closeArray();
49498        if (anyHasExtras(element.getParameterName())) {
49499          openArray("_parameterName");
49500          for (StringType e : element.getParameterName()) 
49501            composeStringExtras(null, e, true);
49502          closeArray();
49503        }
49504      };
49505      if (element.hasCommentElement()) {
49506        composeStringCore("comment", element.getCommentElement(), false);
49507        composeStringExtras("comment", element.getCommentElement(), false);
49508      }
49509  }
49510
49511  protected void composeOperationOutcome(String name, OperationOutcome element) throws IOException {
49512    if (element != null) {
49513      prop("resourceType", name);
49514      composeOperationOutcomeInner(element);
49515    }
49516  }
49517
49518  protected void composeOperationOutcomeInner(OperationOutcome element) throws IOException {
49519      composeDomainResourceElements(element);
49520      if (element.hasIssue()) {
49521        openArray("issue");
49522        for (OperationOutcome.OperationOutcomeIssueComponent e : element.getIssue()) 
49523          composeOperationOutcomeOperationOutcomeIssueComponent(null, e);
49524        closeArray();
49525      };
49526  }
49527
49528  protected void composeOperationOutcomeOperationOutcomeIssueComponent(String name, OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
49529    if (element != null) {
49530      open(name);
49531      composeOperationOutcomeOperationOutcomeIssueComponentInner(element);
49532      close();
49533    }
49534  }
49535
49536  protected void composeOperationOutcomeOperationOutcomeIssueComponentInner(OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
49537      composeBackbone(element);
49538      if (element.hasSeverityElement()) {
49539        composeEnumerationCore("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
49540        composeEnumerationExtras("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
49541      }
49542      if (element.hasCodeElement()) {
49543        composeEnumerationCore("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
49544        composeEnumerationExtras("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
49545      }
49546      if (element.hasDetails()) {
49547        composeCodeableConcept("details", element.getDetails());
49548      }
49549      if (element.hasDiagnosticsElement()) {
49550        composeStringCore("diagnostics", element.getDiagnosticsElement(), false);
49551        composeStringExtras("diagnostics", element.getDiagnosticsElement(), false);
49552      }
49553      if (element.hasLocation()) {
49554        openArray("location");
49555        for (StringType e : element.getLocation()) 
49556          composeStringCore(null, e, true);
49557        closeArray();
49558        if (anyHasExtras(element.getLocation())) {
49559          openArray("_location");
49560          for (StringType e : element.getLocation()) 
49561            composeStringExtras(null, e, true);
49562          closeArray();
49563        }
49564      };
49565      if (element.hasExpression()) {
49566        openArray("expression");
49567        for (StringType e : element.getExpression()) 
49568          composeStringCore(null, e, true);
49569        closeArray();
49570        if (anyHasExtras(element.getExpression())) {
49571          openArray("_expression");
49572          for (StringType e : element.getExpression()) 
49573            composeStringExtras(null, e, true);
49574          closeArray();
49575        }
49576      };
49577  }
49578
49579  protected void composeOrganization(String name, Organization element) throws IOException {
49580    if (element != null) {
49581      prop("resourceType", name);
49582      composeOrganizationInner(element);
49583    }
49584  }
49585
49586  protected void composeOrganizationInner(Organization element) throws IOException {
49587      composeDomainResourceElements(element);
49588      if (element.hasIdentifier()) {
49589        openArray("identifier");
49590        for (Identifier e : element.getIdentifier()) 
49591          composeIdentifier(null, e);
49592        closeArray();
49593      };
49594      if (element.hasActiveElement()) {
49595        composeBooleanCore("active", element.getActiveElement(), false);
49596        composeBooleanExtras("active", element.getActiveElement(), false);
49597      }
49598      if (element.hasType()) {
49599        openArray("type");
49600        for (CodeableConcept e : element.getType()) 
49601          composeCodeableConcept(null, e);
49602        closeArray();
49603      };
49604      if (element.hasNameElement()) {
49605        composeStringCore("name", element.getNameElement(), false);
49606        composeStringExtras("name", element.getNameElement(), false);
49607      }
49608      if (element.hasAlias()) {
49609        openArray("alias");
49610        for (StringType e : element.getAlias()) 
49611          composeStringCore(null, e, true);
49612        closeArray();
49613        if (anyHasExtras(element.getAlias())) {
49614          openArray("_alias");
49615          for (StringType e : element.getAlias()) 
49616            composeStringExtras(null, e, true);
49617          closeArray();
49618        }
49619      };
49620      if (element.hasTelecom()) {
49621        openArray("telecom");
49622        for (ContactPoint e : element.getTelecom()) 
49623          composeContactPoint(null, e);
49624        closeArray();
49625      };
49626      if (element.hasAddress()) {
49627        openArray("address");
49628        for (Address e : element.getAddress()) 
49629          composeAddress(null, e);
49630        closeArray();
49631      };
49632      if (element.hasPartOf()) {
49633        composeReference("partOf", element.getPartOf());
49634      }
49635      if (element.hasContact()) {
49636        openArray("contact");
49637        for (Organization.OrganizationContactComponent e : element.getContact()) 
49638          composeOrganizationOrganizationContactComponent(null, e);
49639        closeArray();
49640      };
49641      if (element.hasEndpoint()) {
49642        openArray("endpoint");
49643        for (Reference e : element.getEndpoint()) 
49644          composeReference(null, e);
49645        closeArray();
49646      };
49647  }
49648
49649  protected void composeOrganizationOrganizationContactComponent(String name, Organization.OrganizationContactComponent element) throws IOException {
49650    if (element != null) {
49651      open(name);
49652      composeOrganizationOrganizationContactComponentInner(element);
49653      close();
49654    }
49655  }
49656
49657  protected void composeOrganizationOrganizationContactComponentInner(Organization.OrganizationContactComponent element) throws IOException {
49658      composeBackbone(element);
49659      if (element.hasPurpose()) {
49660        composeCodeableConcept("purpose", element.getPurpose());
49661      }
49662      if (element.hasName()) {
49663        composeHumanName("name", element.getName());
49664      }
49665      if (element.hasTelecom()) {
49666        openArray("telecom");
49667        for (ContactPoint e : element.getTelecom()) 
49668          composeContactPoint(null, e);
49669        closeArray();
49670      };
49671      if (element.hasAddress()) {
49672        composeAddress("address", element.getAddress());
49673      }
49674  }
49675
49676  protected void composeOrganizationAffiliation(String name, OrganizationAffiliation element) throws IOException {
49677    if (element != null) {
49678      prop("resourceType", name);
49679      composeOrganizationAffiliationInner(element);
49680    }
49681  }
49682
49683  protected void composeOrganizationAffiliationInner(OrganizationAffiliation element) throws IOException {
49684      composeDomainResourceElements(element);
49685      if (element.hasIdentifier()) {
49686        openArray("identifier");
49687        for (Identifier e : element.getIdentifier()) 
49688          composeIdentifier(null, e);
49689        closeArray();
49690      };
49691      if (element.hasActiveElement()) {
49692        composeBooleanCore("active", element.getActiveElement(), false);
49693        composeBooleanExtras("active", element.getActiveElement(), false);
49694      }
49695      if (element.hasPeriod()) {
49696        composePeriod("period", element.getPeriod());
49697      }
49698      if (element.hasOrganization()) {
49699        composeReference("organization", element.getOrganization());
49700      }
49701      if (element.hasParticipatingOrganization()) {
49702        composeReference("participatingOrganization", element.getParticipatingOrganization());
49703      }
49704      if (element.hasNetwork()) {
49705        openArray("network");
49706        for (Reference e : element.getNetwork()) 
49707          composeReference(null, e);
49708        closeArray();
49709      };
49710      if (element.hasCode()) {
49711        openArray("code");
49712        for (CodeableConcept e : element.getCode()) 
49713          composeCodeableConcept(null, e);
49714        closeArray();
49715      };
49716      if (element.hasSpecialty()) {
49717        openArray("specialty");
49718        for (CodeableConcept e : element.getSpecialty()) 
49719          composeCodeableConcept(null, e);
49720        closeArray();
49721      };
49722      if (element.hasLocation()) {
49723        openArray("location");
49724        for (Reference e : element.getLocation()) 
49725          composeReference(null, e);
49726        closeArray();
49727      };
49728      if (element.hasHealthcareService()) {
49729        openArray("healthcareService");
49730        for (Reference e : element.getHealthcareService()) 
49731          composeReference(null, e);
49732        closeArray();
49733      };
49734      if (element.hasTelecom()) {
49735        openArray("telecom");
49736        for (ContactPoint e : element.getTelecom()) 
49737          composeContactPoint(null, e);
49738        closeArray();
49739      };
49740      if (element.hasEndpoint()) {
49741        openArray("endpoint");
49742        for (Reference e : element.getEndpoint()) 
49743          composeReference(null, e);
49744        closeArray();
49745      };
49746  }
49747
49748  protected void composePatient(String name, Patient element) throws IOException {
49749    if (element != null) {
49750      prop("resourceType", name);
49751      composePatientInner(element);
49752    }
49753  }
49754
49755  protected void composePatientInner(Patient element) throws IOException {
49756      composeDomainResourceElements(element);
49757      if (element.hasIdentifier()) {
49758        openArray("identifier");
49759        for (Identifier e : element.getIdentifier()) 
49760          composeIdentifier(null, e);
49761        closeArray();
49762      };
49763      if (element.hasActiveElement()) {
49764        composeBooleanCore("active", element.getActiveElement(), false);
49765        composeBooleanExtras("active", element.getActiveElement(), false);
49766      }
49767      if (element.hasName()) {
49768        openArray("name");
49769        for (HumanName e : element.getName()) 
49770          composeHumanName(null, e);
49771        closeArray();
49772      };
49773      if (element.hasTelecom()) {
49774        openArray("telecom");
49775        for (ContactPoint e : element.getTelecom()) 
49776          composeContactPoint(null, e);
49777        closeArray();
49778      };
49779      if (element.hasGenderElement()) {
49780        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
49781        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
49782      }
49783      if (element.hasBirthDateElement()) {
49784        composeDateCore("birthDate", element.getBirthDateElement(), false);
49785        composeDateExtras("birthDate", element.getBirthDateElement(), false);
49786      }
49787      if (element.hasDeceased()) {
49788        composeType("deceased", element.getDeceased());
49789      }
49790      if (element.hasAddress()) {
49791        openArray("address");
49792        for (Address e : element.getAddress()) 
49793          composeAddress(null, e);
49794        closeArray();
49795      };
49796      if (element.hasMaritalStatus()) {
49797        composeCodeableConcept("maritalStatus", element.getMaritalStatus());
49798      }
49799      if (element.hasMultipleBirth()) {
49800        composeType("multipleBirth", element.getMultipleBirth());
49801      }
49802      if (element.hasPhoto()) {
49803        openArray("photo");
49804        for (Attachment e : element.getPhoto()) 
49805          composeAttachment(null, e);
49806        closeArray();
49807      };
49808      if (element.hasContact()) {
49809        openArray("contact");
49810        for (Patient.ContactComponent e : element.getContact()) 
49811          composePatientContactComponent(null, e);
49812        closeArray();
49813      };
49814      if (element.hasCommunication()) {
49815        openArray("communication");
49816        for (Patient.PatientCommunicationComponent e : element.getCommunication()) 
49817          composePatientPatientCommunicationComponent(null, e);
49818        closeArray();
49819      };
49820      if (element.hasGeneralPractitioner()) {
49821        openArray("generalPractitioner");
49822        for (Reference e : element.getGeneralPractitioner()) 
49823          composeReference(null, e);
49824        closeArray();
49825      };
49826      if (element.hasManagingOrganization()) {
49827        composeReference("managingOrganization", element.getManagingOrganization());
49828      }
49829      if (element.hasLink()) {
49830        openArray("link");
49831        for (Patient.PatientLinkComponent e : element.getLink()) 
49832          composePatientPatientLinkComponent(null, e);
49833        closeArray();
49834      };
49835  }
49836
49837  protected void composePatientContactComponent(String name, Patient.ContactComponent element) throws IOException {
49838    if (element != null) {
49839      open(name);
49840      composePatientContactComponentInner(element);
49841      close();
49842    }
49843  }
49844
49845  protected void composePatientContactComponentInner(Patient.ContactComponent element) throws IOException {
49846      composeBackbone(element);
49847      if (element.hasRelationship()) {
49848        openArray("relationship");
49849        for (CodeableConcept e : element.getRelationship()) 
49850          composeCodeableConcept(null, e);
49851        closeArray();
49852      };
49853      if (element.hasName()) {
49854        composeHumanName("name", element.getName());
49855      }
49856      if (element.hasTelecom()) {
49857        openArray("telecom");
49858        for (ContactPoint e : element.getTelecom()) 
49859          composeContactPoint(null, e);
49860        closeArray();
49861      };
49862      if (element.hasAddress()) {
49863        composeAddress("address", element.getAddress());
49864      }
49865      if (element.hasGenderElement()) {
49866        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
49867        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
49868      }
49869      if (element.hasOrganization()) {
49870        composeReference("organization", element.getOrganization());
49871      }
49872      if (element.hasPeriod()) {
49873        composePeriod("period", element.getPeriod());
49874      }
49875  }
49876
49877  protected void composePatientPatientCommunicationComponent(String name, Patient.PatientCommunicationComponent element) throws IOException {
49878    if (element != null) {
49879      open(name);
49880      composePatientPatientCommunicationComponentInner(element);
49881      close();
49882    }
49883  }
49884
49885  protected void composePatientPatientCommunicationComponentInner(Patient.PatientCommunicationComponent element) throws IOException {
49886      composeBackbone(element);
49887      if (element.hasLanguage()) {
49888        composeCodeableConcept("language", element.getLanguage());
49889      }
49890      if (element.hasPreferredElement()) {
49891        composeBooleanCore("preferred", element.getPreferredElement(), false);
49892        composeBooleanExtras("preferred", element.getPreferredElement(), false);
49893      }
49894  }
49895
49896  protected void composePatientPatientLinkComponent(String name, Patient.PatientLinkComponent element) throws IOException {
49897    if (element != null) {
49898      open(name);
49899      composePatientPatientLinkComponentInner(element);
49900      close();
49901    }
49902  }
49903
49904  protected void composePatientPatientLinkComponentInner(Patient.PatientLinkComponent element) throws IOException {
49905      composeBackbone(element);
49906      if (element.hasOther()) {
49907        composeReference("other", element.getOther());
49908      }
49909      if (element.hasTypeElement()) {
49910        composeEnumerationCore("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
49911        composeEnumerationExtras("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
49912      }
49913  }
49914
49915  protected void composePaymentNotice(String name, PaymentNotice element) throws IOException {
49916    if (element != null) {
49917      prop("resourceType", name);
49918      composePaymentNoticeInner(element);
49919    }
49920  }
49921
49922  protected void composePaymentNoticeInner(PaymentNotice element) throws IOException {
49923      composeDomainResourceElements(element);
49924      if (element.hasIdentifier()) {
49925        openArray("identifier");
49926        for (Identifier e : element.getIdentifier()) 
49927          composeIdentifier(null, e);
49928        closeArray();
49929      };
49930      if (element.hasStatusElement()) {
49931        composeEnumerationCore("status", element.getStatusElement(), new PaymentNotice.PaymentNoticeStatusEnumFactory(), false);
49932        composeEnumerationExtras("status", element.getStatusElement(), new PaymentNotice.PaymentNoticeStatusEnumFactory(), false);
49933      }
49934      if (element.hasRequest()) {
49935        composeReference("request", element.getRequest());
49936      }
49937      if (element.hasResponse()) {
49938        composeReference("response", element.getResponse());
49939      }
49940      if (element.hasCreatedElement()) {
49941        composeDateTimeCore("created", element.getCreatedElement(), false);
49942        composeDateTimeExtras("created", element.getCreatedElement(), false);
49943      }
49944      if (element.hasProvider()) {
49945        composeReference("provider", element.getProvider());
49946      }
49947      if (element.hasPayment()) {
49948        composeReference("payment", element.getPayment());
49949      }
49950      if (element.hasPaymentDateElement()) {
49951        composeDateCore("paymentDate", element.getPaymentDateElement(), false);
49952        composeDateExtras("paymentDate", element.getPaymentDateElement(), false);
49953      }
49954      if (element.hasPayee()) {
49955        composeReference("payee", element.getPayee());
49956      }
49957      if (element.hasRecipient()) {
49958        composeReference("recipient", element.getRecipient());
49959      }
49960      if (element.hasAmount()) {
49961        composeMoney("amount", element.getAmount());
49962      }
49963      if (element.hasPaymentStatus()) {
49964        composeCodeableConcept("paymentStatus", element.getPaymentStatus());
49965      }
49966  }
49967
49968  protected void composePaymentReconciliation(String name, PaymentReconciliation element) throws IOException {
49969    if (element != null) {
49970      prop("resourceType", name);
49971      composePaymentReconciliationInner(element);
49972    }
49973  }
49974
49975  protected void composePaymentReconciliationInner(PaymentReconciliation element) throws IOException {
49976      composeDomainResourceElements(element);
49977      if (element.hasIdentifier()) {
49978        openArray("identifier");
49979        for (Identifier e : element.getIdentifier()) 
49980          composeIdentifier(null, e);
49981        closeArray();
49982      };
49983      if (element.hasStatusElement()) {
49984        composeEnumerationCore("status", element.getStatusElement(), new PaymentReconciliation.PaymentReconciliationStatusEnumFactory(), false);
49985        composeEnumerationExtras("status", element.getStatusElement(), new PaymentReconciliation.PaymentReconciliationStatusEnumFactory(), false);
49986      }
49987      if (element.hasPeriod()) {
49988        composePeriod("period", element.getPeriod());
49989      }
49990      if (element.hasCreatedElement()) {
49991        composeDateTimeCore("created", element.getCreatedElement(), false);
49992        composeDateTimeExtras("created", element.getCreatedElement(), false);
49993      }
49994      if (element.hasPaymentIssuer()) {
49995        composeReference("paymentIssuer", element.getPaymentIssuer());
49996      }
49997      if (element.hasRequest()) {
49998        composeReference("request", element.getRequest());
49999      }
50000      if (element.hasRequestor()) {
50001        composeReference("requestor", element.getRequestor());
50002      }
50003      if (element.hasOutcomeElement()) {
50004        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
50005        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
50006      }
50007      if (element.hasDispositionElement()) {
50008        composeStringCore("disposition", element.getDispositionElement(), false);
50009        composeStringExtras("disposition", element.getDispositionElement(), false);
50010      }
50011      if (element.hasPaymentDateElement()) {
50012        composeDateCore("paymentDate", element.getPaymentDateElement(), false);
50013        composeDateExtras("paymentDate", element.getPaymentDateElement(), false);
50014      }
50015      if (element.hasPaymentAmount()) {
50016        composeMoney("paymentAmount", element.getPaymentAmount());
50017      }
50018      if (element.hasPaymentIdentifier()) {
50019        composeIdentifier("paymentIdentifier", element.getPaymentIdentifier());
50020      }
50021      if (element.hasDetail()) {
50022        openArray("detail");
50023        for (PaymentReconciliation.DetailsComponent e : element.getDetail()) 
50024          composePaymentReconciliationDetailsComponent(null, e);
50025        closeArray();
50026      };
50027      if (element.hasFormCode()) {
50028        composeCodeableConcept("formCode", element.getFormCode());
50029      }
50030      if (element.hasProcessNote()) {
50031        openArray("processNote");
50032        for (PaymentReconciliation.NotesComponent e : element.getProcessNote()) 
50033          composePaymentReconciliationNotesComponent(null, e);
50034        closeArray();
50035      };
50036  }
50037
50038  protected void composePaymentReconciliationDetailsComponent(String name, PaymentReconciliation.DetailsComponent element) throws IOException {
50039    if (element != null) {
50040      open(name);
50041      composePaymentReconciliationDetailsComponentInner(element);
50042      close();
50043    }
50044  }
50045
50046  protected void composePaymentReconciliationDetailsComponentInner(PaymentReconciliation.DetailsComponent element) throws IOException {
50047      composeBackbone(element);
50048      if (element.hasIdentifier()) {
50049        composeIdentifier("identifier", element.getIdentifier());
50050      }
50051      if (element.hasPredecessor()) {
50052        composeIdentifier("predecessor", element.getPredecessor());
50053      }
50054      if (element.hasType()) {
50055        composeCodeableConcept("type", element.getType());
50056      }
50057      if (element.hasRequest()) {
50058        composeReference("request", element.getRequest());
50059      }
50060      if (element.hasSubmitter()) {
50061        composeReference("submitter", element.getSubmitter());
50062      }
50063      if (element.hasResponse()) {
50064        composeReference("response", element.getResponse());
50065      }
50066      if (element.hasDateElement()) {
50067        composeDateCore("date", element.getDateElement(), false);
50068        composeDateExtras("date", element.getDateElement(), false);
50069      }
50070      if (element.hasResponsible()) {
50071        composeReference("responsible", element.getResponsible());
50072      }
50073      if (element.hasPayee()) {
50074        composeReference("payee", element.getPayee());
50075      }
50076      if (element.hasAmount()) {
50077        composeMoney("amount", element.getAmount());
50078      }
50079  }
50080
50081  protected void composePaymentReconciliationNotesComponent(String name, PaymentReconciliation.NotesComponent element) throws IOException {
50082    if (element != null) {
50083      open(name);
50084      composePaymentReconciliationNotesComponentInner(element);
50085      close();
50086    }
50087  }
50088
50089  protected void composePaymentReconciliationNotesComponentInner(PaymentReconciliation.NotesComponent element) throws IOException {
50090      composeBackbone(element);
50091      if (element.hasTypeElement()) {
50092        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
50093        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
50094      }
50095      if (element.hasTextElement()) {
50096        composeStringCore("text", element.getTextElement(), false);
50097        composeStringExtras("text", element.getTextElement(), false);
50098      }
50099  }
50100
50101  protected void composePerson(String name, Person element) throws IOException {
50102    if (element != null) {
50103      prop("resourceType", name);
50104      composePersonInner(element);
50105    }
50106  }
50107
50108  protected void composePersonInner(Person element) throws IOException {
50109      composeDomainResourceElements(element);
50110      if (element.hasIdentifier()) {
50111        openArray("identifier");
50112        for (Identifier e : element.getIdentifier()) 
50113          composeIdentifier(null, e);
50114        closeArray();
50115      };
50116      if (element.hasName()) {
50117        openArray("name");
50118        for (HumanName e : element.getName()) 
50119          composeHumanName(null, e);
50120        closeArray();
50121      };
50122      if (element.hasTelecom()) {
50123        openArray("telecom");
50124        for (ContactPoint e : element.getTelecom()) 
50125          composeContactPoint(null, e);
50126        closeArray();
50127      };
50128      if (element.hasGenderElement()) {
50129        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
50130        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
50131      }
50132      if (element.hasBirthDateElement()) {
50133        composeDateCore("birthDate", element.getBirthDateElement(), false);
50134        composeDateExtras("birthDate", element.getBirthDateElement(), false);
50135      }
50136      if (element.hasAddress()) {
50137        openArray("address");
50138        for (Address e : element.getAddress()) 
50139          composeAddress(null, e);
50140        closeArray();
50141      };
50142      if (element.hasPhoto()) {
50143        composeAttachment("photo", element.getPhoto());
50144      }
50145      if (element.hasManagingOrganization()) {
50146        composeReference("managingOrganization", element.getManagingOrganization());
50147      }
50148      if (element.hasActiveElement()) {
50149        composeBooleanCore("active", element.getActiveElement(), false);
50150        composeBooleanExtras("active", element.getActiveElement(), false);
50151      }
50152      if (element.hasLink()) {
50153        openArray("link");
50154        for (Person.PersonLinkComponent e : element.getLink()) 
50155          composePersonPersonLinkComponent(null, e);
50156        closeArray();
50157      };
50158  }
50159
50160  protected void composePersonPersonLinkComponent(String name, Person.PersonLinkComponent element) throws IOException {
50161    if (element != null) {
50162      open(name);
50163      composePersonPersonLinkComponentInner(element);
50164      close();
50165    }
50166  }
50167
50168  protected void composePersonPersonLinkComponentInner(Person.PersonLinkComponent element) throws IOException {
50169      composeBackbone(element);
50170      if (element.hasTarget()) {
50171        composeReference("target", element.getTarget());
50172      }
50173      if (element.hasAssuranceElement()) {
50174        composeEnumerationCore("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
50175        composeEnumerationExtras("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
50176      }
50177  }
50178
50179  protected void composePlanDefinition(String name, PlanDefinition element) throws IOException {
50180    if (element != null) {
50181      prop("resourceType", name);
50182      composePlanDefinitionInner(element);
50183    }
50184  }
50185
50186  protected void composePlanDefinitionInner(PlanDefinition element) throws IOException {
50187      composeDomainResourceElements(element);
50188      if (element.hasUrlElement()) {
50189        composeUriCore("url", element.getUrlElement(), false);
50190        composeUriExtras("url", element.getUrlElement(), false);
50191      }
50192      if (element.hasIdentifier()) {
50193        openArray("identifier");
50194        for (Identifier e : element.getIdentifier()) 
50195          composeIdentifier(null, e);
50196        closeArray();
50197      };
50198      if (element.hasVersionElement()) {
50199        composeStringCore("version", element.getVersionElement(), false);
50200        composeStringExtras("version", element.getVersionElement(), false);
50201      }
50202      if (element.hasNameElement()) {
50203        composeStringCore("name", element.getNameElement(), false);
50204        composeStringExtras("name", element.getNameElement(), false);
50205      }
50206      if (element.hasTitleElement()) {
50207        composeStringCore("title", element.getTitleElement(), false);
50208        composeStringExtras("title", element.getTitleElement(), false);
50209      }
50210      if (element.hasSubtitleElement()) {
50211        composeStringCore("subtitle", element.getSubtitleElement(), false);
50212        composeStringExtras("subtitle", element.getSubtitleElement(), false);
50213      }
50214      if (element.hasType()) {
50215        composeCodeableConcept("type", element.getType());
50216      }
50217      if (element.hasStatusElement()) {
50218        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
50219        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
50220      }
50221      if (element.hasExperimentalElement()) {
50222        composeBooleanCore("experimental", element.getExperimentalElement(), false);
50223        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
50224      }
50225      if (element.hasSubject()) {
50226        composeType("subject", element.getSubject());
50227      }
50228      if (element.hasDateElement()) {
50229        composeDateTimeCore("date", element.getDateElement(), false);
50230        composeDateTimeExtras("date", element.getDateElement(), false);
50231      }
50232      if (element.hasPublisherElement()) {
50233        composeStringCore("publisher", element.getPublisherElement(), false);
50234        composeStringExtras("publisher", element.getPublisherElement(), false);
50235      }
50236      if (element.hasContact()) {
50237        openArray("contact");
50238        for (ContactDetail e : element.getContact()) 
50239          composeContactDetail(null, e);
50240        closeArray();
50241      };
50242      if (element.hasDescriptionElement()) {
50243        composeMarkdownCore("description", element.getDescriptionElement(), false);
50244        composeMarkdownExtras("description", element.getDescriptionElement(), false);
50245      }
50246      if (element.hasUseContext()) {
50247        openArray("useContext");
50248        for (UsageContext e : element.getUseContext()) 
50249          composeUsageContext(null, e);
50250        closeArray();
50251      };
50252      if (element.hasJurisdiction()) {
50253        openArray("jurisdiction");
50254        for (CodeableConcept e : element.getJurisdiction()) 
50255          composeCodeableConcept(null, e);
50256        closeArray();
50257      };
50258      if (element.hasPurposeElement()) {
50259        composeMarkdownCore("purpose", element.getPurposeElement(), false);
50260        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
50261      }
50262      if (element.hasUsageElement()) {
50263        composeStringCore("usage", element.getUsageElement(), false);
50264        composeStringExtras("usage", element.getUsageElement(), false);
50265      }
50266      if (element.hasCopyrightElement()) {
50267        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
50268        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
50269      }
50270      if (element.hasApprovalDateElement()) {
50271        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
50272        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
50273      }
50274      if (element.hasLastReviewDateElement()) {
50275        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
50276        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
50277      }
50278      if (element.hasEffectivePeriod()) {
50279        composePeriod("effectivePeriod", element.getEffectivePeriod());
50280      }
50281      if (element.hasTopic()) {
50282        openArray("topic");
50283        for (CodeableConcept e : element.getTopic()) 
50284          composeCodeableConcept(null, e);
50285        closeArray();
50286      };
50287      if (element.hasAuthor()) {
50288        openArray("author");
50289        for (ContactDetail e : element.getAuthor()) 
50290          composeContactDetail(null, e);
50291        closeArray();
50292      };
50293      if (element.hasEditor()) {
50294        openArray("editor");
50295        for (ContactDetail e : element.getEditor()) 
50296          composeContactDetail(null, e);
50297        closeArray();
50298      };
50299      if (element.hasReviewer()) {
50300        openArray("reviewer");
50301        for (ContactDetail e : element.getReviewer()) 
50302          composeContactDetail(null, e);
50303        closeArray();
50304      };
50305      if (element.hasEndorser()) {
50306        openArray("endorser");
50307        for (ContactDetail e : element.getEndorser()) 
50308          composeContactDetail(null, e);
50309        closeArray();
50310      };
50311      if (element.hasRelatedArtifact()) {
50312        openArray("relatedArtifact");
50313        for (RelatedArtifact e : element.getRelatedArtifact()) 
50314          composeRelatedArtifact(null, e);
50315        closeArray();
50316      };
50317      if (element.hasLibrary()) {
50318        openArray("library");
50319        for (CanonicalType e : element.getLibrary()) 
50320          composeCanonicalCore(null, e, true);
50321        closeArray();
50322        if (anyHasExtras(element.getLibrary())) {
50323          openArray("_library");
50324          for (CanonicalType e : element.getLibrary()) 
50325            composeCanonicalExtras(null, e, true);
50326          closeArray();
50327        }
50328      };
50329      if (element.hasGoal()) {
50330        openArray("goal");
50331        for (PlanDefinition.PlanDefinitionGoalComponent e : element.getGoal()) 
50332          composePlanDefinitionPlanDefinitionGoalComponent(null, e);
50333        closeArray();
50334      };
50335      if (element.hasAction()) {
50336        openArray("action");
50337        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
50338          composePlanDefinitionPlanDefinitionActionComponent(null, e);
50339        closeArray();
50340      };
50341  }
50342
50343  protected void composePlanDefinitionPlanDefinitionGoalComponent(String name, PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
50344    if (element != null) {
50345      open(name);
50346      composePlanDefinitionPlanDefinitionGoalComponentInner(element);
50347      close();
50348    }
50349  }
50350
50351  protected void composePlanDefinitionPlanDefinitionGoalComponentInner(PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
50352      composeBackbone(element);
50353      if (element.hasCategory()) {
50354        composeCodeableConcept("category", element.getCategory());
50355      }
50356      if (element.hasDescription()) {
50357        composeCodeableConcept("description", element.getDescription());
50358      }
50359      if (element.hasPriority()) {
50360        composeCodeableConcept("priority", element.getPriority());
50361      }
50362      if (element.hasStart()) {
50363        composeCodeableConcept("start", element.getStart());
50364      }
50365      if (element.hasAddresses()) {
50366        openArray("addresses");
50367        for (CodeableConcept e : element.getAddresses()) 
50368          composeCodeableConcept(null, e);
50369        closeArray();
50370      };
50371      if (element.hasDocumentation()) {
50372        openArray("documentation");
50373        for (RelatedArtifact e : element.getDocumentation()) 
50374          composeRelatedArtifact(null, e);
50375        closeArray();
50376      };
50377      if (element.hasTarget()) {
50378        openArray("target");
50379        for (PlanDefinition.PlanDefinitionGoalTargetComponent e : element.getTarget()) 
50380          composePlanDefinitionPlanDefinitionGoalTargetComponent(null, e);
50381        closeArray();
50382      };
50383  }
50384
50385  protected void composePlanDefinitionPlanDefinitionGoalTargetComponent(String name, PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
50386    if (element != null) {
50387      open(name);
50388      composePlanDefinitionPlanDefinitionGoalTargetComponentInner(element);
50389      close();
50390    }
50391  }
50392
50393  protected void composePlanDefinitionPlanDefinitionGoalTargetComponentInner(PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
50394      composeBackbone(element);
50395      if (element.hasMeasure()) {
50396        composeCodeableConcept("measure", element.getMeasure());
50397      }
50398      if (element.hasDetail()) {
50399        composeType("detail", element.getDetail());
50400      }
50401      if (element.hasDue()) {
50402        composeDuration("due", element.getDue());
50403      }
50404  }
50405
50406  protected void composePlanDefinitionPlanDefinitionActionComponent(String name, PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
50407    if (element != null) {
50408      open(name);
50409      composePlanDefinitionPlanDefinitionActionComponentInner(element);
50410      close();
50411    }
50412  }
50413
50414  protected void composePlanDefinitionPlanDefinitionActionComponentInner(PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
50415      composeBackbone(element);
50416      if (element.hasPrefixElement()) {
50417        composeStringCore("prefix", element.getPrefixElement(), false);
50418        composeStringExtras("prefix", element.getPrefixElement(), false);
50419      }
50420      if (element.hasTitleElement()) {
50421        composeStringCore("title", element.getTitleElement(), false);
50422        composeStringExtras("title", element.getTitleElement(), false);
50423      }
50424      if (element.hasDescriptionElement()) {
50425        composeStringCore("description", element.getDescriptionElement(), false);
50426        composeStringExtras("description", element.getDescriptionElement(), false);
50427      }
50428      if (element.hasTextEquivalentElement()) {
50429        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
50430        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
50431      }
50432      if (element.hasPriorityElement()) {
50433        composeEnumerationCore("priority", element.getPriorityElement(), new PlanDefinition.RequestPriorityEnumFactory(), false);
50434        composeEnumerationExtras("priority", element.getPriorityElement(), new PlanDefinition.RequestPriorityEnumFactory(), false);
50435      }
50436      if (element.hasCode()) {
50437        openArray("code");
50438        for (CodeableConcept e : element.getCode()) 
50439          composeCodeableConcept(null, e);
50440        closeArray();
50441      };
50442      if (element.hasReason()) {
50443        openArray("reason");
50444        for (CodeableConcept e : element.getReason()) 
50445          composeCodeableConcept(null, e);
50446        closeArray();
50447      };
50448      if (element.hasDocumentation()) {
50449        openArray("documentation");
50450        for (RelatedArtifact e : element.getDocumentation()) 
50451          composeRelatedArtifact(null, e);
50452        closeArray();
50453      };
50454      if (element.hasGoalId()) {
50455        openArray("goalId");
50456        for (IdType e : element.getGoalId()) 
50457          composeIdCore(null, e, true);
50458        closeArray();
50459        if (anyHasExtras(element.getGoalId())) {
50460          openArray("_goalId");
50461          for (IdType e : element.getGoalId()) 
50462            composeIdExtras(null, e, true);
50463          closeArray();
50464        }
50465      };
50466      if (element.hasSubject()) {
50467        composeType("subject", element.getSubject());
50468      }
50469      if (element.hasTrigger()) {
50470        openArray("trigger");
50471        for (TriggerDefinition e : element.getTrigger()) 
50472          composeTriggerDefinition(null, e);
50473        closeArray();
50474      };
50475      if (element.hasCondition()) {
50476        openArray("condition");
50477        for (PlanDefinition.PlanDefinitionActionConditionComponent e : element.getCondition()) 
50478          composePlanDefinitionPlanDefinitionActionConditionComponent(null, e);
50479        closeArray();
50480      };
50481      if (element.hasInput()) {
50482        openArray("input");
50483        for (DataRequirement e : element.getInput()) 
50484          composeDataRequirement(null, e);
50485        closeArray();
50486      };
50487      if (element.hasOutput()) {
50488        openArray("output");
50489        for (DataRequirement e : element.getOutput()) 
50490          composeDataRequirement(null, e);
50491        closeArray();
50492      };
50493      if (element.hasRelatedAction()) {
50494        openArray("relatedAction");
50495        for (PlanDefinition.PlanDefinitionActionRelatedActionComponent e : element.getRelatedAction()) 
50496          composePlanDefinitionPlanDefinitionActionRelatedActionComponent(null, e);
50497        closeArray();
50498      };
50499      if (element.hasTiming()) {
50500        composeType("timing", element.getTiming());
50501      }
50502      if (element.hasParticipant()) {
50503        openArray("participant");
50504        for (PlanDefinition.PlanDefinitionActionParticipantComponent e : element.getParticipant()) 
50505          composePlanDefinitionPlanDefinitionActionParticipantComponent(null, e);
50506        closeArray();
50507      };
50508      if (element.hasType()) {
50509        composeCodeableConcept("type", element.getType());
50510      }
50511      if (element.hasGroupingBehaviorElement()) {
50512        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new PlanDefinition.ActionGroupingBehaviorEnumFactory(), false);
50513        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new PlanDefinition.ActionGroupingBehaviorEnumFactory(), false);
50514      }
50515      if (element.hasSelectionBehaviorElement()) {
50516        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new PlanDefinition.ActionSelectionBehaviorEnumFactory(), false);
50517        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new PlanDefinition.ActionSelectionBehaviorEnumFactory(), false);
50518      }
50519      if (element.hasRequiredBehaviorElement()) {
50520        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new PlanDefinition.ActionRequiredBehaviorEnumFactory(), false);
50521        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new PlanDefinition.ActionRequiredBehaviorEnumFactory(), false);
50522      }
50523      if (element.hasPrecheckBehaviorElement()) {
50524        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new PlanDefinition.ActionPrecheckBehaviorEnumFactory(), false);
50525        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new PlanDefinition.ActionPrecheckBehaviorEnumFactory(), false);
50526      }
50527      if (element.hasCardinalityBehaviorElement()) {
50528        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new PlanDefinition.ActionCardinalityBehaviorEnumFactory(), false);
50529        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new PlanDefinition.ActionCardinalityBehaviorEnumFactory(), false);
50530      }
50531      if (element.hasDefinition()) {
50532        composeType("definition", element.getDefinition());
50533      }
50534      if (element.hasTransformElement()) {
50535        composeCanonicalCore("transform", element.getTransformElement(), false);
50536        composeCanonicalExtras("transform", element.getTransformElement(), false);
50537      }
50538      if (element.hasDynamicValue()) {
50539        openArray("dynamicValue");
50540        for (PlanDefinition.PlanDefinitionActionDynamicValueComponent e : element.getDynamicValue()) 
50541          composePlanDefinitionPlanDefinitionActionDynamicValueComponent(null, e);
50542        closeArray();
50543      };
50544      if (element.hasAction()) {
50545        openArray("action");
50546        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
50547          composePlanDefinitionPlanDefinitionActionComponent(null, e);
50548        closeArray();
50549      };
50550  }
50551
50552  protected void composePlanDefinitionPlanDefinitionActionConditionComponent(String name, PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
50553    if (element != null) {
50554      open(name);
50555      composePlanDefinitionPlanDefinitionActionConditionComponentInner(element);
50556      close();
50557    }
50558  }
50559
50560  protected void composePlanDefinitionPlanDefinitionActionConditionComponentInner(PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
50561      composeBackbone(element);
50562      if (element.hasKindElement()) {
50563        composeEnumerationCore("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory(), false);
50564        composeEnumerationExtras("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory(), false);
50565      }
50566      if (element.hasExpression()) {
50567        composeExpression("expression", element.getExpression());
50568      }
50569  }
50570
50571  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponent(String name, PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
50572    if (element != null) {
50573      open(name);
50574      composePlanDefinitionPlanDefinitionActionRelatedActionComponentInner(element);
50575      close();
50576    }
50577  }
50578
50579  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponentInner(PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
50580      composeBackbone(element);
50581      if (element.hasActionIdElement()) {
50582        composeIdCore("actionId", element.getActionIdElement(), false);
50583        composeIdExtras("actionId", element.getActionIdElement(), false);
50584      }
50585      if (element.hasRelationshipElement()) {
50586        composeEnumerationCore("relationship", element.getRelationshipElement(), new PlanDefinition.ActionRelationshipTypeEnumFactory(), false);
50587        composeEnumerationExtras("relationship", element.getRelationshipElement(), new PlanDefinition.ActionRelationshipTypeEnumFactory(), false);
50588      }
50589      if (element.hasOffset()) {
50590        composeType("offset", element.getOffset());
50591      }
50592  }
50593
50594  protected void composePlanDefinitionPlanDefinitionActionParticipantComponent(String name, PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
50595    if (element != null) {
50596      open(name);
50597      composePlanDefinitionPlanDefinitionActionParticipantComponentInner(element);
50598      close();
50599    }
50600  }
50601
50602  protected void composePlanDefinitionPlanDefinitionActionParticipantComponentInner(PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
50603      composeBackbone(element);
50604      if (element.hasTypeElement()) {
50605        composeEnumerationCore("type", element.getTypeElement(), new PlanDefinition.ActionParticipantTypeEnumFactory(), false);
50606        composeEnumerationExtras("type", element.getTypeElement(), new PlanDefinition.ActionParticipantTypeEnumFactory(), false);
50607      }
50608      if (element.hasRole()) {
50609        composeCodeableConcept("role", element.getRole());
50610      }
50611  }
50612
50613  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponent(String name, PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
50614    if (element != null) {
50615      open(name);
50616      composePlanDefinitionPlanDefinitionActionDynamicValueComponentInner(element);
50617      close();
50618    }
50619  }
50620
50621  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponentInner(PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
50622      composeBackbone(element);
50623      if (element.hasPathElement()) {
50624        composeStringCore("path", element.getPathElement(), false);
50625        composeStringExtras("path", element.getPathElement(), false);
50626      }
50627      if (element.hasExpression()) {
50628        composeExpression("expression", element.getExpression());
50629      }
50630  }
50631
50632  protected void composePractitioner(String name, Practitioner element) throws IOException {
50633    if (element != null) {
50634      prop("resourceType", name);
50635      composePractitionerInner(element);
50636    }
50637  }
50638
50639  protected void composePractitionerInner(Practitioner element) throws IOException {
50640      composeDomainResourceElements(element);
50641      if (element.hasIdentifier()) {
50642        openArray("identifier");
50643        for (Identifier e : element.getIdentifier()) 
50644          composeIdentifier(null, e);
50645        closeArray();
50646      };
50647      if (element.hasActiveElement()) {
50648        composeBooleanCore("active", element.getActiveElement(), false);
50649        composeBooleanExtras("active", element.getActiveElement(), false);
50650      }
50651      if (element.hasName()) {
50652        openArray("name");
50653        for (HumanName e : element.getName()) 
50654          composeHumanName(null, e);
50655        closeArray();
50656      };
50657      if (element.hasTelecom()) {
50658        openArray("telecom");
50659        for (ContactPoint e : element.getTelecom()) 
50660          composeContactPoint(null, e);
50661        closeArray();
50662      };
50663      if (element.hasAddress()) {
50664        openArray("address");
50665        for (Address e : element.getAddress()) 
50666          composeAddress(null, e);
50667        closeArray();
50668      };
50669      if (element.hasGenderElement()) {
50670        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
50671        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
50672      }
50673      if (element.hasBirthDateElement()) {
50674        composeDateCore("birthDate", element.getBirthDateElement(), false);
50675        composeDateExtras("birthDate", element.getBirthDateElement(), false);
50676      }
50677      if (element.hasPhoto()) {
50678        openArray("photo");
50679        for (Attachment e : element.getPhoto()) 
50680          composeAttachment(null, e);
50681        closeArray();
50682      };
50683      if (element.hasQualification()) {
50684        openArray("qualification");
50685        for (Practitioner.PractitionerQualificationComponent e : element.getQualification()) 
50686          composePractitionerPractitionerQualificationComponent(null, e);
50687        closeArray();
50688      };
50689      if (element.hasCommunication()) {
50690        openArray("communication");
50691        for (CodeableConcept e : element.getCommunication()) 
50692          composeCodeableConcept(null, e);
50693        closeArray();
50694      };
50695  }
50696
50697  protected void composePractitionerPractitionerQualificationComponent(String name, Practitioner.PractitionerQualificationComponent element) throws IOException {
50698    if (element != null) {
50699      open(name);
50700      composePractitionerPractitionerQualificationComponentInner(element);
50701      close();
50702    }
50703  }
50704
50705  protected void composePractitionerPractitionerQualificationComponentInner(Practitioner.PractitionerQualificationComponent element) throws IOException {
50706      composeBackbone(element);
50707      if (element.hasIdentifier()) {
50708        openArray("identifier");
50709        for (Identifier e : element.getIdentifier()) 
50710          composeIdentifier(null, e);
50711        closeArray();
50712      };
50713      if (element.hasCode()) {
50714        composeCodeableConcept("code", element.getCode());
50715      }
50716      if (element.hasPeriod()) {
50717        composePeriod("period", element.getPeriod());
50718      }
50719      if (element.hasIssuer()) {
50720        composeReference("issuer", element.getIssuer());
50721      }
50722  }
50723
50724  protected void composePractitionerRole(String name, PractitionerRole element) throws IOException {
50725    if (element != null) {
50726      prop("resourceType", name);
50727      composePractitionerRoleInner(element);
50728    }
50729  }
50730
50731  protected void composePractitionerRoleInner(PractitionerRole element) throws IOException {
50732      composeDomainResourceElements(element);
50733      if (element.hasIdentifier()) {
50734        openArray("identifier");
50735        for (Identifier e : element.getIdentifier()) 
50736          composeIdentifier(null, e);
50737        closeArray();
50738      };
50739      if (element.hasActiveElement()) {
50740        composeBooleanCore("active", element.getActiveElement(), false);
50741        composeBooleanExtras("active", element.getActiveElement(), false);
50742      }
50743      if (element.hasPeriod()) {
50744        composePeriod("period", element.getPeriod());
50745      }
50746      if (element.hasPractitioner()) {
50747        composeReference("practitioner", element.getPractitioner());
50748      }
50749      if (element.hasOrganization()) {
50750        composeReference("organization", element.getOrganization());
50751      }
50752      if (element.hasCode()) {
50753        openArray("code");
50754        for (CodeableConcept e : element.getCode()) 
50755          composeCodeableConcept(null, e);
50756        closeArray();
50757      };
50758      if (element.hasSpecialty()) {
50759        openArray("specialty");
50760        for (CodeableConcept e : element.getSpecialty()) 
50761          composeCodeableConcept(null, e);
50762        closeArray();
50763      };
50764      if (element.hasLocation()) {
50765        openArray("location");
50766        for (Reference e : element.getLocation()) 
50767          composeReference(null, e);
50768        closeArray();
50769      };
50770      if (element.hasHealthcareService()) {
50771        openArray("healthcareService");
50772        for (Reference e : element.getHealthcareService()) 
50773          composeReference(null, e);
50774        closeArray();
50775      };
50776      if (element.hasTelecom()) {
50777        openArray("telecom");
50778        for (ContactPoint e : element.getTelecom()) 
50779          composeContactPoint(null, e);
50780        closeArray();
50781      };
50782      if (element.hasAvailableTime()) {
50783        openArray("availableTime");
50784        for (PractitionerRole.PractitionerRoleAvailableTimeComponent e : element.getAvailableTime()) 
50785          composePractitionerRolePractitionerRoleAvailableTimeComponent(null, e);
50786        closeArray();
50787      };
50788      if (element.hasNotAvailable()) {
50789        openArray("notAvailable");
50790        for (PractitionerRole.PractitionerRoleNotAvailableComponent e : element.getNotAvailable()) 
50791          composePractitionerRolePractitionerRoleNotAvailableComponent(null, e);
50792        closeArray();
50793      };
50794      if (element.hasAvailabilityExceptionsElement()) {
50795        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
50796        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
50797      }
50798      if (element.hasEndpoint()) {
50799        openArray("endpoint");
50800        for (Reference e : element.getEndpoint()) 
50801          composeReference(null, e);
50802        closeArray();
50803      };
50804  }
50805
50806  protected void composePractitionerRolePractitionerRoleAvailableTimeComponent(String name, PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
50807    if (element != null) {
50808      open(name);
50809      composePractitionerRolePractitionerRoleAvailableTimeComponentInner(element);
50810      close();
50811    }
50812  }
50813
50814  protected void composePractitionerRolePractitionerRoleAvailableTimeComponentInner(PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
50815      composeBackbone(element);
50816      if (element.hasDaysOfWeek()) {
50817        openArray("daysOfWeek");
50818        for (Enumeration<PractitionerRole.DaysOfWeek> e : element.getDaysOfWeek()) 
50819          composeEnumerationCore(null, e, new PractitionerRole.DaysOfWeekEnumFactory(), true);
50820        closeArray();
50821        if (anyHasExtras(element.getDaysOfWeek())) {
50822          openArray("_daysOfWeek");
50823          for (Enumeration<PractitionerRole.DaysOfWeek> e : element.getDaysOfWeek()) 
50824            composeEnumerationExtras(null, e, new PractitionerRole.DaysOfWeekEnumFactory(), true);
50825          closeArray();
50826        }
50827      };
50828      if (element.hasAllDayElement()) {
50829        composeBooleanCore("allDay", element.getAllDayElement(), false);
50830        composeBooleanExtras("allDay", element.getAllDayElement(), false);
50831      }
50832      if (element.hasAvailableStartTimeElement()) {
50833        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
50834        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
50835      }
50836      if (element.hasAvailableEndTimeElement()) {
50837        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
50838        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
50839      }
50840  }
50841
50842  protected void composePractitionerRolePractitionerRoleNotAvailableComponent(String name, PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
50843    if (element != null) {
50844      open(name);
50845      composePractitionerRolePractitionerRoleNotAvailableComponentInner(element);
50846      close();
50847    }
50848  }
50849
50850  protected void composePractitionerRolePractitionerRoleNotAvailableComponentInner(PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
50851      composeBackbone(element);
50852      if (element.hasDescriptionElement()) {
50853        composeStringCore("description", element.getDescriptionElement(), false);
50854        composeStringExtras("description", element.getDescriptionElement(), false);
50855      }
50856      if (element.hasDuring()) {
50857        composePeriod("during", element.getDuring());
50858      }
50859  }
50860
50861  protected void composeProcedure(String name, Procedure element) throws IOException {
50862    if (element != null) {
50863      prop("resourceType", name);
50864      composeProcedureInner(element);
50865    }
50866  }
50867
50868  protected void composeProcedureInner(Procedure element) throws IOException {
50869      composeDomainResourceElements(element);
50870      if (element.hasIdentifier()) {
50871        openArray("identifier");
50872        for (Identifier e : element.getIdentifier()) 
50873          composeIdentifier(null, e);
50874        closeArray();
50875      };
50876      if (element.hasInstantiatesCanonical()) {
50877        openArray("instantiatesCanonical");
50878        for (CanonicalType e : element.getInstantiatesCanonical()) 
50879          composeCanonicalCore(null, e, true);
50880        closeArray();
50881        if (anyHasExtras(element.getInstantiatesCanonical())) {
50882          openArray("_instantiatesCanonical");
50883          for (CanonicalType e : element.getInstantiatesCanonical()) 
50884            composeCanonicalExtras(null, e, true);
50885          closeArray();
50886        }
50887      };
50888      if (element.hasInstantiatesUri()) {
50889        openArray("instantiatesUri");
50890        for (UriType e : element.getInstantiatesUri()) 
50891          composeUriCore(null, e, true);
50892        closeArray();
50893        if (anyHasExtras(element.getInstantiatesUri())) {
50894          openArray("_instantiatesUri");
50895          for (UriType e : element.getInstantiatesUri()) 
50896            composeUriExtras(null, e, true);
50897          closeArray();
50898        }
50899      };
50900      if (element.hasBasedOn()) {
50901        openArray("basedOn");
50902        for (Reference e : element.getBasedOn()) 
50903          composeReference(null, e);
50904        closeArray();
50905      };
50906      if (element.hasPartOf()) {
50907        openArray("partOf");
50908        for (Reference e : element.getPartOf()) 
50909          composeReference(null, e);
50910        closeArray();
50911      };
50912      if (element.hasStatusElement()) {
50913        composeEnumerationCore("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
50914        composeEnumerationExtras("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
50915      }
50916      if (element.hasStatusReason()) {
50917        composeCodeableConcept("statusReason", element.getStatusReason());
50918      }
50919      if (element.hasCategory()) {
50920        composeCodeableConcept("category", element.getCategory());
50921      }
50922      if (element.hasCode()) {
50923        composeCodeableConcept("code", element.getCode());
50924      }
50925      if (element.hasSubject()) {
50926        composeReference("subject", element.getSubject());
50927      }
50928      if (element.hasEncounter()) {
50929        composeReference("encounter", element.getEncounter());
50930      }
50931      if (element.hasPerformed()) {
50932        composeType("performed", element.getPerformed());
50933      }
50934      if (element.hasRecorder()) {
50935        composeReference("recorder", element.getRecorder());
50936      }
50937      if (element.hasAsserter()) {
50938        composeReference("asserter", element.getAsserter());
50939      }
50940      if (element.hasPerformer()) {
50941        openArray("performer");
50942        for (Procedure.ProcedurePerformerComponent e : element.getPerformer()) 
50943          composeProcedureProcedurePerformerComponent(null, e);
50944        closeArray();
50945      };
50946      if (element.hasLocation()) {
50947        composeReference("location", element.getLocation());
50948      }
50949      if (element.hasReasonCode()) {
50950        openArray("reasonCode");
50951        for (CodeableConcept e : element.getReasonCode()) 
50952          composeCodeableConcept(null, e);
50953        closeArray();
50954      };
50955      if (element.hasReasonReference()) {
50956        openArray("reasonReference");
50957        for (Reference e : element.getReasonReference()) 
50958          composeReference(null, e);
50959        closeArray();
50960      };
50961      if (element.hasBodySite()) {
50962        openArray("bodySite");
50963        for (CodeableConcept e : element.getBodySite()) 
50964          composeCodeableConcept(null, e);
50965        closeArray();
50966      };
50967      if (element.hasOutcome()) {
50968        composeCodeableConcept("outcome", element.getOutcome());
50969      }
50970      if (element.hasReport()) {
50971        openArray("report");
50972        for (Reference e : element.getReport()) 
50973          composeReference(null, e);
50974        closeArray();
50975      };
50976      if (element.hasComplication()) {
50977        openArray("complication");
50978        for (CodeableConcept e : element.getComplication()) 
50979          composeCodeableConcept(null, e);
50980        closeArray();
50981      };
50982      if (element.hasComplicationDetail()) {
50983        openArray("complicationDetail");
50984        for (Reference e : element.getComplicationDetail()) 
50985          composeReference(null, e);
50986        closeArray();
50987      };
50988      if (element.hasFollowUp()) {
50989        openArray("followUp");
50990        for (CodeableConcept e : element.getFollowUp()) 
50991          composeCodeableConcept(null, e);
50992        closeArray();
50993      };
50994      if (element.hasNote()) {
50995        openArray("note");
50996        for (Annotation e : element.getNote()) 
50997          composeAnnotation(null, e);
50998        closeArray();
50999      };
51000      if (element.hasFocalDevice()) {
51001        openArray("focalDevice");
51002        for (Procedure.ProcedureFocalDeviceComponent e : element.getFocalDevice()) 
51003          composeProcedureProcedureFocalDeviceComponent(null, e);
51004        closeArray();
51005      };
51006      if (element.hasUsedReference()) {
51007        openArray("usedReference");
51008        for (Reference e : element.getUsedReference()) 
51009          composeReference(null, e);
51010        closeArray();
51011      };
51012      if (element.hasUsedCode()) {
51013        openArray("usedCode");
51014        for (CodeableConcept e : element.getUsedCode()) 
51015          composeCodeableConcept(null, e);
51016        closeArray();
51017      };
51018  }
51019
51020  protected void composeProcedureProcedurePerformerComponent(String name, Procedure.ProcedurePerformerComponent element) throws IOException {
51021    if (element != null) {
51022      open(name);
51023      composeProcedureProcedurePerformerComponentInner(element);
51024      close();
51025    }
51026  }
51027
51028  protected void composeProcedureProcedurePerformerComponentInner(Procedure.ProcedurePerformerComponent element) throws IOException {
51029      composeBackbone(element);
51030      if (element.hasFunction()) {
51031        composeCodeableConcept("function", element.getFunction());
51032      }
51033      if (element.hasActor()) {
51034        composeReference("actor", element.getActor());
51035      }
51036      if (element.hasOnBehalfOf()) {
51037        composeReference("onBehalfOf", element.getOnBehalfOf());
51038      }
51039  }
51040
51041  protected void composeProcedureProcedureFocalDeviceComponent(String name, Procedure.ProcedureFocalDeviceComponent element) throws IOException {
51042    if (element != null) {
51043      open(name);
51044      composeProcedureProcedureFocalDeviceComponentInner(element);
51045      close();
51046    }
51047  }
51048
51049  protected void composeProcedureProcedureFocalDeviceComponentInner(Procedure.ProcedureFocalDeviceComponent element) throws IOException {
51050      composeBackbone(element);
51051      if (element.hasAction()) {
51052        composeCodeableConcept("action", element.getAction());
51053      }
51054      if (element.hasManipulated()) {
51055        composeReference("manipulated", element.getManipulated());
51056      }
51057  }
51058
51059  protected void composeProvenance(String name, Provenance element) throws IOException {
51060    if (element != null) {
51061      prop("resourceType", name);
51062      composeProvenanceInner(element);
51063    }
51064  }
51065
51066  protected void composeProvenanceInner(Provenance element) throws IOException {
51067      composeDomainResourceElements(element);
51068      if (element.hasTarget()) {
51069        openArray("target");
51070        for (Reference e : element.getTarget()) 
51071          composeReference(null, e);
51072        closeArray();
51073      };
51074      if (element.hasOccurred()) {
51075        composeType("occurred", element.getOccurred());
51076      }
51077      if (element.hasRecordedElement()) {
51078        composeInstantCore("recorded", element.getRecordedElement(), false);
51079        composeInstantExtras("recorded", element.getRecordedElement(), false);
51080      }
51081      if (element.hasPolicy()) {
51082        openArray("policy");
51083        for (UriType e : element.getPolicy()) 
51084          composeUriCore(null, e, true);
51085        closeArray();
51086        if (anyHasExtras(element.getPolicy())) {
51087          openArray("_policy");
51088          for (UriType e : element.getPolicy()) 
51089            composeUriExtras(null, e, true);
51090          closeArray();
51091        }
51092      };
51093      if (element.hasLocation()) {
51094        composeReference("location", element.getLocation());
51095      }
51096      if (element.hasReason()) {
51097        openArray("reason");
51098        for (CodeableConcept e : element.getReason()) 
51099          composeCodeableConcept(null, e);
51100        closeArray();
51101      };
51102      if (element.hasActivity()) {
51103        composeCodeableConcept("activity", element.getActivity());
51104      }
51105      if (element.hasAgent()) {
51106        openArray("agent");
51107        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
51108          composeProvenanceProvenanceAgentComponent(null, e);
51109        closeArray();
51110      };
51111      if (element.hasEntity()) {
51112        openArray("entity");
51113        for (Provenance.ProvenanceEntityComponent e : element.getEntity()) 
51114          composeProvenanceProvenanceEntityComponent(null, e);
51115        closeArray();
51116      };
51117      if (element.hasSignature()) {
51118        openArray("signature");
51119        for (Signature e : element.getSignature()) 
51120          composeSignature(null, e);
51121        closeArray();
51122      };
51123  }
51124
51125  protected void composeProvenanceProvenanceAgentComponent(String name, Provenance.ProvenanceAgentComponent element) throws IOException {
51126    if (element != null) {
51127      open(name);
51128      composeProvenanceProvenanceAgentComponentInner(element);
51129      close();
51130    }
51131  }
51132
51133  protected void composeProvenanceProvenanceAgentComponentInner(Provenance.ProvenanceAgentComponent element) throws IOException {
51134      composeBackbone(element);
51135      if (element.hasType()) {
51136        composeCodeableConcept("type", element.getType());
51137      }
51138      if (element.hasRole()) {
51139        openArray("role");
51140        for (CodeableConcept e : element.getRole()) 
51141          composeCodeableConcept(null, e);
51142        closeArray();
51143      };
51144      if (element.hasWho()) {
51145        composeReference("who", element.getWho());
51146      }
51147      if (element.hasOnBehalfOf()) {
51148        composeReference("onBehalfOf", element.getOnBehalfOf());
51149      }
51150  }
51151
51152  protected void composeProvenanceProvenanceEntityComponent(String name, Provenance.ProvenanceEntityComponent element) throws IOException {
51153    if (element != null) {
51154      open(name);
51155      composeProvenanceProvenanceEntityComponentInner(element);
51156      close();
51157    }
51158  }
51159
51160  protected void composeProvenanceProvenanceEntityComponentInner(Provenance.ProvenanceEntityComponent element) throws IOException {
51161      composeBackbone(element);
51162      if (element.hasRoleElement()) {
51163        composeEnumerationCore("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
51164        composeEnumerationExtras("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
51165      }
51166      if (element.hasWhat()) {
51167        composeReference("what", element.getWhat());
51168      }
51169      if (element.hasAgent()) {
51170        openArray("agent");
51171        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
51172          composeProvenanceProvenanceAgentComponent(null, e);
51173        closeArray();
51174      };
51175  }
51176
51177  protected void composeQuestionnaire(String name, Questionnaire element) throws IOException {
51178    if (element != null) {
51179      prop("resourceType", name);
51180      composeQuestionnaireInner(element);
51181    }
51182  }
51183
51184  protected void composeQuestionnaireInner(Questionnaire element) throws IOException {
51185      composeDomainResourceElements(element);
51186      if (element.hasUrlElement()) {
51187        composeUriCore("url", element.getUrlElement(), false);
51188        composeUriExtras("url", element.getUrlElement(), false);
51189      }
51190      if (element.hasIdentifier()) {
51191        openArray("identifier");
51192        for (Identifier e : element.getIdentifier()) 
51193          composeIdentifier(null, e);
51194        closeArray();
51195      };
51196      if (element.hasVersionElement()) {
51197        composeStringCore("version", element.getVersionElement(), false);
51198        composeStringExtras("version", element.getVersionElement(), false);
51199      }
51200      if (element.hasNameElement()) {
51201        composeStringCore("name", element.getNameElement(), false);
51202        composeStringExtras("name", element.getNameElement(), false);
51203      }
51204      if (element.hasTitleElement()) {
51205        composeStringCore("title", element.getTitleElement(), false);
51206        composeStringExtras("title", element.getTitleElement(), false);
51207      }
51208      if (element.hasDerivedFrom()) {
51209        openArray("derivedFrom");
51210        for (CanonicalType e : element.getDerivedFrom()) 
51211          composeCanonicalCore(null, e, true);
51212        closeArray();
51213        if (anyHasExtras(element.getDerivedFrom())) {
51214          openArray("_derivedFrom");
51215          for (CanonicalType e : element.getDerivedFrom()) 
51216            composeCanonicalExtras(null, e, true);
51217          closeArray();
51218        }
51219      };
51220      if (element.hasStatusElement()) {
51221        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51222        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51223      }
51224      if (element.hasExperimentalElement()) {
51225        composeBooleanCore("experimental", element.getExperimentalElement(), false);
51226        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
51227      }
51228      if (element.hasSubjectType()) {
51229        openArray("subjectType");
51230        for (CodeType e : element.getSubjectType()) 
51231          composeCodeCore(null, e, true);
51232        closeArray();
51233        if (anyHasExtras(element.getSubjectType())) {
51234          openArray("_subjectType");
51235          for (CodeType e : element.getSubjectType()) 
51236            composeCodeExtras(null, e, true);
51237          closeArray();
51238        }
51239      };
51240      if (element.hasDateElement()) {
51241        composeDateTimeCore("date", element.getDateElement(), false);
51242        composeDateTimeExtras("date", element.getDateElement(), false);
51243      }
51244      if (element.hasPublisherElement()) {
51245        composeStringCore("publisher", element.getPublisherElement(), false);
51246        composeStringExtras("publisher", element.getPublisherElement(), false);
51247      }
51248      if (element.hasContact()) {
51249        openArray("contact");
51250        for (ContactDetail e : element.getContact()) 
51251          composeContactDetail(null, e);
51252        closeArray();
51253      };
51254      if (element.hasDescriptionElement()) {
51255        composeMarkdownCore("description", element.getDescriptionElement(), false);
51256        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51257      }
51258      if (element.hasUseContext()) {
51259        openArray("useContext");
51260        for (UsageContext e : element.getUseContext()) 
51261          composeUsageContext(null, e);
51262        closeArray();
51263      };
51264      if (element.hasJurisdiction()) {
51265        openArray("jurisdiction");
51266        for (CodeableConcept e : element.getJurisdiction()) 
51267          composeCodeableConcept(null, e);
51268        closeArray();
51269      };
51270      if (element.hasPurposeElement()) {
51271        composeMarkdownCore("purpose", element.getPurposeElement(), false);
51272        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
51273      }
51274      if (element.hasCopyrightElement()) {
51275        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
51276        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
51277      }
51278      if (element.hasApprovalDateElement()) {
51279        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
51280        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
51281      }
51282      if (element.hasLastReviewDateElement()) {
51283        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
51284        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
51285      }
51286      if (element.hasEffectivePeriod()) {
51287        composePeriod("effectivePeriod", element.getEffectivePeriod());
51288      }
51289      if (element.hasCode()) {
51290        openArray("code");
51291        for (Coding e : element.getCode()) 
51292          composeCoding(null, e);
51293        closeArray();
51294      };
51295      if (element.hasItem()) {
51296        openArray("item");
51297        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
51298          composeQuestionnaireQuestionnaireItemComponent(null, e);
51299        closeArray();
51300      };
51301  }
51302
51303  protected void composeQuestionnaireQuestionnaireItemComponent(String name, Questionnaire.QuestionnaireItemComponent element) throws IOException {
51304    if (element != null) {
51305      open(name);
51306      composeQuestionnaireQuestionnaireItemComponentInner(element);
51307      close();
51308    }
51309  }
51310
51311  protected void composeQuestionnaireQuestionnaireItemComponentInner(Questionnaire.QuestionnaireItemComponent element) throws IOException {
51312      composeBackbone(element);
51313      if (element.hasLinkIdElement()) {
51314        composeStringCore("linkId", element.getLinkIdElement(), false);
51315        composeStringExtras("linkId", element.getLinkIdElement(), false);
51316      }
51317      if (element.hasDefinitionElement()) {
51318        composeUriCore("definition", element.getDefinitionElement(), false);
51319        composeUriExtras("definition", element.getDefinitionElement(), false);
51320      }
51321      if (element.hasCode()) {
51322        openArray("code");
51323        for (Coding e : element.getCode()) 
51324          composeCoding(null, e);
51325        closeArray();
51326      };
51327      if (element.hasPrefixElement()) {
51328        composeStringCore("prefix", element.getPrefixElement(), false);
51329        composeStringExtras("prefix", element.getPrefixElement(), false);
51330      }
51331      if (element.hasTextElement()) {
51332        composeStringCore("text", element.getTextElement(), false);
51333        composeStringExtras("text", element.getTextElement(), false);
51334      }
51335      if (element.hasTypeElement()) {
51336        composeEnumerationCore("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
51337        composeEnumerationExtras("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
51338      }
51339      if (element.hasEnableWhen()) {
51340        openArray("enableWhen");
51341        for (Questionnaire.QuestionnaireItemEnableWhenComponent e : element.getEnableWhen()) 
51342          composeQuestionnaireQuestionnaireItemEnableWhenComponent(null, e);
51343        closeArray();
51344      };
51345      if (element.hasEnableBehaviorElement()) {
51346        composeEnumerationCore("enableBehavior", element.getEnableBehaviorElement(), new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
51347        composeEnumerationExtras("enableBehavior", element.getEnableBehaviorElement(), new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
51348      }
51349      if (element.hasRequiredElement()) {
51350        composeBooleanCore("required", element.getRequiredElement(), false);
51351        composeBooleanExtras("required", element.getRequiredElement(), false);
51352      }
51353      if (element.hasRepeatsElement()) {
51354        composeBooleanCore("repeats", element.getRepeatsElement(), false);
51355        composeBooleanExtras("repeats", element.getRepeatsElement(), false);
51356      }
51357      if (element.hasReadOnlyElement()) {
51358        composeBooleanCore("readOnly", element.getReadOnlyElement(), false);
51359        composeBooleanExtras("readOnly", element.getReadOnlyElement(), false);
51360      }
51361      if (element.hasMaxLengthElement()) {
51362        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
51363        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
51364      }
51365      if (element.hasAnswerValueSetElement()) {
51366        composeCanonicalCore("answerValueSet", element.getAnswerValueSetElement(), false);
51367        composeCanonicalExtras("answerValueSet", element.getAnswerValueSetElement(), false);
51368      }
51369      if (element.hasAnswerOption()) {
51370        openArray("answerOption");
51371        for (Questionnaire.QuestionnaireItemAnswerOptionComponent e : element.getAnswerOption()) 
51372          composeQuestionnaireQuestionnaireItemAnswerOptionComponent(null, e);
51373        closeArray();
51374      };
51375      if (element.hasInitial()) {
51376        openArray("initial");
51377        for (Questionnaire.QuestionnaireItemInitialComponent e : element.getInitial()) 
51378          composeQuestionnaireQuestionnaireItemInitialComponent(null, e);
51379        closeArray();
51380      };
51381      if (element.hasItem()) {
51382        openArray("item");
51383        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
51384          composeQuestionnaireQuestionnaireItemComponent(null, e);
51385        closeArray();
51386      };
51387  }
51388
51389  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponent(String name, Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
51390    if (element != null) {
51391      open(name);
51392      composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(element);
51393      close();
51394    }
51395  }
51396
51397  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
51398      composeBackbone(element);
51399      if (element.hasQuestionElement()) {
51400        composeStringCore("question", element.getQuestionElement(), false);
51401        composeStringExtras("question", element.getQuestionElement(), false);
51402      }
51403      if (element.hasOperatorElement()) {
51404        composeEnumerationCore("operator", element.getOperatorElement(), new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
51405        composeEnumerationExtras("operator", element.getOperatorElement(), new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
51406      }
51407      if (element.hasAnswer()) {
51408        composeType("answer", element.getAnswer());
51409      }
51410  }
51411
51412  protected void composeQuestionnaireQuestionnaireItemAnswerOptionComponent(String name, Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
51413    if (element != null) {
51414      open(name);
51415      composeQuestionnaireQuestionnaireItemAnswerOptionComponentInner(element);
51416      close();
51417    }
51418  }
51419
51420  protected void composeQuestionnaireQuestionnaireItemAnswerOptionComponentInner(Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
51421      composeBackbone(element);
51422      if (element.hasValue()) {
51423        composeType("value", element.getValue());
51424      }
51425      if (element.hasInitialSelectedElement()) {
51426        composeBooleanCore("initialSelected", element.getInitialSelectedElement(), false);
51427        composeBooleanExtras("initialSelected", element.getInitialSelectedElement(), false);
51428      }
51429  }
51430
51431  protected void composeQuestionnaireQuestionnaireItemInitialComponent(String name, Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
51432    if (element != null) {
51433      open(name);
51434      composeQuestionnaireQuestionnaireItemInitialComponentInner(element);
51435      close();
51436    }
51437  }
51438
51439  protected void composeQuestionnaireQuestionnaireItemInitialComponentInner(Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
51440      composeBackbone(element);
51441      if (element.hasValue()) {
51442        composeType("value", element.getValue());
51443      }
51444  }
51445
51446  protected void composeQuestionnaireResponse(String name, QuestionnaireResponse element) throws IOException {
51447    if (element != null) {
51448      prop("resourceType", name);
51449      composeQuestionnaireResponseInner(element);
51450    }
51451  }
51452
51453  protected void composeQuestionnaireResponseInner(QuestionnaireResponse element) throws IOException {
51454      composeDomainResourceElements(element);
51455      if (element.hasIdentifier()) {
51456        composeIdentifier("identifier", element.getIdentifier());
51457      }
51458      if (element.hasBasedOn()) {
51459        openArray("basedOn");
51460        for (Reference e : element.getBasedOn()) 
51461          composeReference(null, e);
51462        closeArray();
51463      };
51464      if (element.hasPartOf()) {
51465        openArray("partOf");
51466        for (Reference e : element.getPartOf()) 
51467          composeReference(null, e);
51468        closeArray();
51469      };
51470      if (element.hasQuestionnaireElement()) {
51471        composeCanonicalCore("questionnaire", element.getQuestionnaireElement(), false);
51472        composeCanonicalExtras("questionnaire", element.getQuestionnaireElement(), false);
51473      }
51474      if (element.hasStatusElement()) {
51475        composeEnumerationCore("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
51476        composeEnumerationExtras("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
51477      }
51478      if (element.hasSubject()) {
51479        composeReference("subject", element.getSubject());
51480      }
51481      if (element.hasEncounter()) {
51482        composeReference("encounter", element.getEncounter());
51483      }
51484      if (element.hasAuthoredElement()) {
51485        composeDateTimeCore("authored", element.getAuthoredElement(), false);
51486        composeDateTimeExtras("authored", element.getAuthoredElement(), false);
51487      }
51488      if (element.hasAuthor()) {
51489        composeReference("author", element.getAuthor());
51490      }
51491      if (element.hasSource()) {
51492        composeReference("source", element.getSource());
51493      }
51494      if (element.hasItem()) {
51495        openArray("item");
51496        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
51497          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
51498        closeArray();
51499      };
51500  }
51501
51502  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
51503    if (element != null) {
51504      open(name);
51505      composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(element);
51506      close();
51507    }
51508  }
51509
51510  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
51511      composeBackbone(element);
51512      if (element.hasLinkIdElement()) {
51513        composeStringCore("linkId", element.getLinkIdElement(), false);
51514        composeStringExtras("linkId", element.getLinkIdElement(), false);
51515      }
51516      if (element.hasDefinitionElement()) {
51517        composeUriCore("definition", element.getDefinitionElement(), false);
51518        composeUriExtras("definition", element.getDefinitionElement(), false);
51519      }
51520      if (element.hasTextElement()) {
51521        composeStringCore("text", element.getTextElement(), false);
51522        composeStringExtras("text", element.getTextElement(), false);
51523      }
51524      if (element.hasAnswer()) {
51525        openArray("answer");
51526        for (QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent e : element.getAnswer()) 
51527          composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(null, e);
51528        closeArray();
51529      };
51530      if (element.hasItem()) {
51531        openArray("item");
51532        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
51533          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
51534        closeArray();
51535      };
51536  }
51537
51538  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
51539    if (element != null) {
51540      open(name);
51541      composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(element);
51542      close();
51543    }
51544  }
51545
51546  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
51547      composeBackbone(element);
51548      if (element.hasValue()) {
51549        composeType("value", element.getValue());
51550      }
51551      if (element.hasItem()) {
51552        openArray("item");
51553        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
51554          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
51555        closeArray();
51556      };
51557  }
51558
51559  protected void composeRelatedPerson(String name, RelatedPerson element) throws IOException {
51560    if (element != null) {
51561      prop("resourceType", name);
51562      composeRelatedPersonInner(element);
51563    }
51564  }
51565
51566  protected void composeRelatedPersonInner(RelatedPerson element) throws IOException {
51567      composeDomainResourceElements(element);
51568      if (element.hasIdentifier()) {
51569        openArray("identifier");
51570        for (Identifier e : element.getIdentifier()) 
51571          composeIdentifier(null, e);
51572        closeArray();
51573      };
51574      if (element.hasActiveElement()) {
51575        composeBooleanCore("active", element.getActiveElement(), false);
51576        composeBooleanExtras("active", element.getActiveElement(), false);
51577      }
51578      if (element.hasPatient()) {
51579        composeReference("patient", element.getPatient());
51580      }
51581      if (element.hasRelationship()) {
51582        openArray("relationship");
51583        for (CodeableConcept e : element.getRelationship()) 
51584          composeCodeableConcept(null, e);
51585        closeArray();
51586      };
51587      if (element.hasName()) {
51588        openArray("name");
51589        for (HumanName e : element.getName()) 
51590          composeHumanName(null, e);
51591        closeArray();
51592      };
51593      if (element.hasTelecom()) {
51594        openArray("telecom");
51595        for (ContactPoint e : element.getTelecom()) 
51596          composeContactPoint(null, e);
51597        closeArray();
51598      };
51599      if (element.hasGenderElement()) {
51600        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
51601        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
51602      }
51603      if (element.hasBirthDateElement()) {
51604        composeDateCore("birthDate", element.getBirthDateElement(), false);
51605        composeDateExtras("birthDate", element.getBirthDateElement(), false);
51606      }
51607      if (element.hasAddress()) {
51608        openArray("address");
51609        for (Address e : element.getAddress()) 
51610          composeAddress(null, e);
51611        closeArray();
51612      };
51613      if (element.hasPhoto()) {
51614        openArray("photo");
51615        for (Attachment e : element.getPhoto()) 
51616          composeAttachment(null, e);
51617        closeArray();
51618      };
51619      if (element.hasPeriod()) {
51620        composePeriod("period", element.getPeriod());
51621      }
51622      if (element.hasCommunication()) {
51623        openArray("communication");
51624        for (RelatedPerson.RelatedPersonCommunicationComponent e : element.getCommunication()) 
51625          composeRelatedPersonRelatedPersonCommunicationComponent(null, e);
51626        closeArray();
51627      };
51628  }
51629
51630  protected void composeRelatedPersonRelatedPersonCommunicationComponent(String name, RelatedPerson.RelatedPersonCommunicationComponent element) throws IOException {
51631    if (element != null) {
51632      open(name);
51633      composeRelatedPersonRelatedPersonCommunicationComponentInner(element);
51634      close();
51635    }
51636  }
51637
51638  protected void composeRelatedPersonRelatedPersonCommunicationComponentInner(RelatedPerson.RelatedPersonCommunicationComponent element) throws IOException {
51639      composeBackbone(element);
51640      if (element.hasLanguage()) {
51641        composeCodeableConcept("language", element.getLanguage());
51642      }
51643      if (element.hasPreferredElement()) {
51644        composeBooleanCore("preferred", element.getPreferredElement(), false);
51645        composeBooleanExtras("preferred", element.getPreferredElement(), false);
51646      }
51647  }
51648
51649  protected void composeRequestGroup(String name, RequestGroup element) throws IOException {
51650    if (element != null) {
51651      prop("resourceType", name);
51652      composeRequestGroupInner(element);
51653    }
51654  }
51655
51656  protected void composeRequestGroupInner(RequestGroup element) throws IOException {
51657      composeDomainResourceElements(element);
51658      if (element.hasIdentifier()) {
51659        openArray("identifier");
51660        for (Identifier e : element.getIdentifier()) 
51661          composeIdentifier(null, e);
51662        closeArray();
51663      };
51664      if (element.hasInstantiatesCanonical()) {
51665        openArray("instantiatesCanonical");
51666        for (CanonicalType e : element.getInstantiatesCanonical()) 
51667          composeCanonicalCore(null, e, true);
51668        closeArray();
51669        if (anyHasExtras(element.getInstantiatesCanonical())) {
51670          openArray("_instantiatesCanonical");
51671          for (CanonicalType e : element.getInstantiatesCanonical()) 
51672            composeCanonicalExtras(null, e, true);
51673          closeArray();
51674        }
51675      };
51676      if (element.hasInstantiatesUri()) {
51677        openArray("instantiatesUri");
51678        for (UriType e : element.getInstantiatesUri()) 
51679          composeUriCore(null, e, true);
51680        closeArray();
51681        if (anyHasExtras(element.getInstantiatesUri())) {
51682          openArray("_instantiatesUri");
51683          for (UriType e : element.getInstantiatesUri()) 
51684            composeUriExtras(null, e, true);
51685          closeArray();
51686        }
51687      };
51688      if (element.hasBasedOn()) {
51689        openArray("basedOn");
51690        for (Reference e : element.getBasedOn()) 
51691          composeReference(null, e);
51692        closeArray();
51693      };
51694      if (element.hasReplaces()) {
51695        openArray("replaces");
51696        for (Reference e : element.getReplaces()) 
51697          composeReference(null, e);
51698        closeArray();
51699      };
51700      if (element.hasGroupIdentifier()) {
51701        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
51702      }
51703      if (element.hasStatusElement()) {
51704        composeEnumerationCore("status", element.getStatusElement(), new RequestGroup.RequestStatusEnumFactory(), false);
51705        composeEnumerationExtras("status", element.getStatusElement(), new RequestGroup.RequestStatusEnumFactory(), false);
51706      }
51707      if (element.hasIntentElement()) {
51708        composeEnumerationCore("intent", element.getIntentElement(), new RequestGroup.RequestIntentEnumFactory(), false);
51709        composeEnumerationExtras("intent", element.getIntentElement(), new RequestGroup.RequestIntentEnumFactory(), false);
51710      }
51711      if (element.hasPriorityElement()) {
51712        composeEnumerationCore("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
51713        composeEnumerationExtras("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
51714      }
51715      if (element.hasCode()) {
51716        composeCodeableConcept("code", element.getCode());
51717      }
51718      if (element.hasSubject()) {
51719        composeReference("subject", element.getSubject());
51720      }
51721      if (element.hasEncounter()) {
51722        composeReference("encounter", element.getEncounter());
51723      }
51724      if (element.hasAuthoredOnElement()) {
51725        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
51726        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
51727      }
51728      if (element.hasAuthor()) {
51729        composeReference("author", element.getAuthor());
51730      }
51731      if (element.hasReasonCode()) {
51732        openArray("reasonCode");
51733        for (CodeableConcept e : element.getReasonCode()) 
51734          composeCodeableConcept(null, e);
51735        closeArray();
51736      };
51737      if (element.hasReasonReference()) {
51738        openArray("reasonReference");
51739        for (Reference e : element.getReasonReference()) 
51740          composeReference(null, e);
51741        closeArray();
51742      };
51743      if (element.hasNote()) {
51744        openArray("note");
51745        for (Annotation e : element.getNote()) 
51746          composeAnnotation(null, e);
51747        closeArray();
51748      };
51749      if (element.hasAction()) {
51750        openArray("action");
51751        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
51752          composeRequestGroupRequestGroupActionComponent(null, e);
51753        closeArray();
51754      };
51755  }
51756
51757  protected void composeRequestGroupRequestGroupActionComponent(String name, RequestGroup.RequestGroupActionComponent element) throws IOException {
51758    if (element != null) {
51759      open(name);
51760      composeRequestGroupRequestGroupActionComponentInner(element);
51761      close();
51762    }
51763  }
51764
51765  protected void composeRequestGroupRequestGroupActionComponentInner(RequestGroup.RequestGroupActionComponent element) throws IOException {
51766      composeBackbone(element);
51767      if (element.hasPrefixElement()) {
51768        composeStringCore("prefix", element.getPrefixElement(), false);
51769        composeStringExtras("prefix", element.getPrefixElement(), false);
51770      }
51771      if (element.hasTitleElement()) {
51772        composeStringCore("title", element.getTitleElement(), false);
51773        composeStringExtras("title", element.getTitleElement(), false);
51774      }
51775      if (element.hasDescriptionElement()) {
51776        composeStringCore("description", element.getDescriptionElement(), false);
51777        composeStringExtras("description", element.getDescriptionElement(), false);
51778      }
51779      if (element.hasTextEquivalentElement()) {
51780        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
51781        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
51782      }
51783      if (element.hasPriorityElement()) {
51784        composeEnumerationCore("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
51785        composeEnumerationExtras("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
51786      }
51787      if (element.hasCode()) {
51788        openArray("code");
51789        for (CodeableConcept e : element.getCode()) 
51790          composeCodeableConcept(null, e);
51791        closeArray();
51792      };
51793      if (element.hasDocumentation()) {
51794        openArray("documentation");
51795        for (RelatedArtifact e : element.getDocumentation()) 
51796          composeRelatedArtifact(null, e);
51797        closeArray();
51798      };
51799      if (element.hasCondition()) {
51800        openArray("condition");
51801        for (RequestGroup.RequestGroupActionConditionComponent e : element.getCondition()) 
51802          composeRequestGroupRequestGroupActionConditionComponent(null, e);
51803        closeArray();
51804      };
51805      if (element.hasRelatedAction()) {
51806        openArray("relatedAction");
51807        for (RequestGroup.RequestGroupActionRelatedActionComponent e : element.getRelatedAction()) 
51808          composeRequestGroupRequestGroupActionRelatedActionComponent(null, e);
51809        closeArray();
51810      };
51811      if (element.hasTiming()) {
51812        composeType("timing", element.getTiming());
51813      }
51814      if (element.hasParticipant()) {
51815        openArray("participant");
51816        for (Reference e : element.getParticipant()) 
51817          composeReference(null, e);
51818        closeArray();
51819      };
51820      if (element.hasType()) {
51821        composeCodeableConcept("type", element.getType());
51822      }
51823      if (element.hasGroupingBehaviorElement()) {
51824        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new RequestGroup.ActionGroupingBehaviorEnumFactory(), false);
51825        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new RequestGroup.ActionGroupingBehaviorEnumFactory(), false);
51826      }
51827      if (element.hasSelectionBehaviorElement()) {
51828        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new RequestGroup.ActionSelectionBehaviorEnumFactory(), false);
51829        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new RequestGroup.ActionSelectionBehaviorEnumFactory(), false);
51830      }
51831      if (element.hasRequiredBehaviorElement()) {
51832        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new RequestGroup.ActionRequiredBehaviorEnumFactory(), false);
51833        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new RequestGroup.ActionRequiredBehaviorEnumFactory(), false);
51834      }
51835      if (element.hasPrecheckBehaviorElement()) {
51836        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new RequestGroup.ActionPrecheckBehaviorEnumFactory(), false);
51837        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new RequestGroup.ActionPrecheckBehaviorEnumFactory(), false);
51838      }
51839      if (element.hasCardinalityBehaviorElement()) {
51840        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new RequestGroup.ActionCardinalityBehaviorEnumFactory(), false);
51841        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new RequestGroup.ActionCardinalityBehaviorEnumFactory(), false);
51842      }
51843      if (element.hasResource()) {
51844        composeReference("resource", element.getResource());
51845      }
51846      if (element.hasAction()) {
51847        openArray("action");
51848        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
51849          composeRequestGroupRequestGroupActionComponent(null, e);
51850        closeArray();
51851      };
51852  }
51853
51854  protected void composeRequestGroupRequestGroupActionConditionComponent(String name, RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
51855    if (element != null) {
51856      open(name);
51857      composeRequestGroupRequestGroupActionConditionComponentInner(element);
51858      close();
51859    }
51860  }
51861
51862  protected void composeRequestGroupRequestGroupActionConditionComponentInner(RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
51863      composeBackbone(element);
51864      if (element.hasKindElement()) {
51865        composeEnumerationCore("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory(), false);
51866        composeEnumerationExtras("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory(), false);
51867      }
51868      if (element.hasExpression()) {
51869        composeExpression("expression", element.getExpression());
51870      }
51871  }
51872
51873  protected void composeRequestGroupRequestGroupActionRelatedActionComponent(String name, RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
51874    if (element != null) {
51875      open(name);
51876      composeRequestGroupRequestGroupActionRelatedActionComponentInner(element);
51877      close();
51878    }
51879  }
51880
51881  protected void composeRequestGroupRequestGroupActionRelatedActionComponentInner(RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
51882      composeBackbone(element);
51883      if (element.hasActionIdElement()) {
51884        composeIdCore("actionId", element.getActionIdElement(), false);
51885        composeIdExtras("actionId", element.getActionIdElement(), false);
51886      }
51887      if (element.hasRelationshipElement()) {
51888        composeEnumerationCore("relationship", element.getRelationshipElement(), new RequestGroup.ActionRelationshipTypeEnumFactory(), false);
51889        composeEnumerationExtras("relationship", element.getRelationshipElement(), new RequestGroup.ActionRelationshipTypeEnumFactory(), false);
51890      }
51891      if (element.hasOffset()) {
51892        composeType("offset", element.getOffset());
51893      }
51894  }
51895
51896  protected void composeResearchDefinition(String name, ResearchDefinition element) throws IOException {
51897    if (element != null) {
51898      prop("resourceType", name);
51899      composeResearchDefinitionInner(element);
51900    }
51901  }
51902
51903  protected void composeResearchDefinitionInner(ResearchDefinition element) throws IOException {
51904      composeDomainResourceElements(element);
51905      if (element.hasUrlElement()) {
51906        composeUriCore("url", element.getUrlElement(), false);
51907        composeUriExtras("url", element.getUrlElement(), false);
51908      }
51909      if (element.hasIdentifier()) {
51910        openArray("identifier");
51911        for (Identifier e : element.getIdentifier()) 
51912          composeIdentifier(null, e);
51913        closeArray();
51914      };
51915      if (element.hasVersionElement()) {
51916        composeStringCore("version", element.getVersionElement(), false);
51917        composeStringExtras("version", element.getVersionElement(), false);
51918      }
51919      if (element.hasNameElement()) {
51920        composeStringCore("name", element.getNameElement(), false);
51921        composeStringExtras("name", element.getNameElement(), false);
51922      }
51923      if (element.hasTitleElement()) {
51924        composeStringCore("title", element.getTitleElement(), false);
51925        composeStringExtras("title", element.getTitleElement(), false);
51926      }
51927      if (element.hasShortTitleElement()) {
51928        composeStringCore("shortTitle", element.getShortTitleElement(), false);
51929        composeStringExtras("shortTitle", element.getShortTitleElement(), false);
51930      }
51931      if (element.hasSubtitleElement()) {
51932        composeStringCore("subtitle", element.getSubtitleElement(), false);
51933        composeStringExtras("subtitle", element.getSubtitleElement(), false);
51934      }
51935      if (element.hasStatusElement()) {
51936        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51937        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51938      }
51939      if (element.hasExperimentalElement()) {
51940        composeBooleanCore("experimental", element.getExperimentalElement(), false);
51941        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
51942      }
51943      if (element.hasSubject()) {
51944        composeType("subject", element.getSubject());
51945      }
51946      if (element.hasDateElement()) {
51947        composeDateTimeCore("date", element.getDateElement(), false);
51948        composeDateTimeExtras("date", element.getDateElement(), false);
51949      }
51950      if (element.hasPublisherElement()) {
51951        composeStringCore("publisher", element.getPublisherElement(), false);
51952        composeStringExtras("publisher", element.getPublisherElement(), false);
51953      }
51954      if (element.hasContact()) {
51955        openArray("contact");
51956        for (ContactDetail e : element.getContact()) 
51957          composeContactDetail(null, e);
51958        closeArray();
51959      };
51960      if (element.hasDescriptionElement()) {
51961        composeMarkdownCore("description", element.getDescriptionElement(), false);
51962        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51963      }
51964      if (element.hasComment()) {
51965        openArray("comment");
51966        for (StringType e : element.getComment()) 
51967          composeStringCore(null, e, true);
51968        closeArray();
51969        if (anyHasExtras(element.getComment())) {
51970          openArray("_comment");
51971          for (StringType e : element.getComment()) 
51972            composeStringExtras(null, e, true);
51973          closeArray();
51974        }
51975      };
51976      if (element.hasUseContext()) {
51977        openArray("useContext");
51978        for (UsageContext e : element.getUseContext()) 
51979          composeUsageContext(null, e);
51980        closeArray();
51981      };
51982      if (element.hasJurisdiction()) {
51983        openArray("jurisdiction");
51984        for (CodeableConcept e : element.getJurisdiction()) 
51985          composeCodeableConcept(null, e);
51986        closeArray();
51987      };
51988      if (element.hasPurposeElement()) {
51989        composeMarkdownCore("purpose", element.getPurposeElement(), false);
51990        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
51991      }
51992      if (element.hasUsageElement()) {
51993        composeStringCore("usage", element.getUsageElement(), false);
51994        composeStringExtras("usage", element.getUsageElement(), false);
51995      }
51996      if (element.hasCopyrightElement()) {
51997        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
51998        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
51999      }
52000      if (element.hasApprovalDateElement()) {
52001        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
52002        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
52003      }
52004      if (element.hasLastReviewDateElement()) {
52005        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
52006        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
52007      }
52008      if (element.hasEffectivePeriod()) {
52009        composePeriod("effectivePeriod", element.getEffectivePeriod());
52010      }
52011      if (element.hasTopic()) {
52012        openArray("topic");
52013        for (CodeableConcept e : element.getTopic()) 
52014          composeCodeableConcept(null, e);
52015        closeArray();
52016      };
52017      if (element.hasAuthor()) {
52018        openArray("author");
52019        for (ContactDetail e : element.getAuthor()) 
52020          composeContactDetail(null, e);
52021        closeArray();
52022      };
52023      if (element.hasEditor()) {
52024        openArray("editor");
52025        for (ContactDetail e : element.getEditor()) 
52026          composeContactDetail(null, e);
52027        closeArray();
52028      };
52029      if (element.hasReviewer()) {
52030        openArray("reviewer");
52031        for (ContactDetail e : element.getReviewer()) 
52032          composeContactDetail(null, e);
52033        closeArray();
52034      };
52035      if (element.hasEndorser()) {
52036        openArray("endorser");
52037        for (ContactDetail e : element.getEndorser()) 
52038          composeContactDetail(null, e);
52039        closeArray();
52040      };
52041      if (element.hasRelatedArtifact()) {
52042        openArray("relatedArtifact");
52043        for (RelatedArtifact e : element.getRelatedArtifact()) 
52044          composeRelatedArtifact(null, e);
52045        closeArray();
52046      };
52047      if (element.hasLibrary()) {
52048        openArray("library");
52049        for (CanonicalType e : element.getLibrary()) 
52050          composeCanonicalCore(null, e, true);
52051        closeArray();
52052        if (anyHasExtras(element.getLibrary())) {
52053          openArray("_library");
52054          for (CanonicalType e : element.getLibrary()) 
52055            composeCanonicalExtras(null, e, true);
52056          closeArray();
52057        }
52058      };
52059      if (element.hasPopulation()) {
52060        composeReference("population", element.getPopulation());
52061      }
52062      if (element.hasExposure()) {
52063        composeReference("exposure", element.getExposure());
52064      }
52065      if (element.hasExposureAlternative()) {
52066        composeReference("exposureAlternative", element.getExposureAlternative());
52067      }
52068      if (element.hasOutcome()) {
52069        composeReference("outcome", element.getOutcome());
52070      }
52071  }
52072
52073  protected void composeResearchElementDefinition(String name, ResearchElementDefinition element) throws IOException {
52074    if (element != null) {
52075      prop("resourceType", name);
52076      composeResearchElementDefinitionInner(element);
52077    }
52078  }
52079
52080  protected void composeResearchElementDefinitionInner(ResearchElementDefinition element) throws IOException {
52081      composeDomainResourceElements(element);
52082      if (element.hasUrlElement()) {
52083        composeUriCore("url", element.getUrlElement(), false);
52084        composeUriExtras("url", element.getUrlElement(), false);
52085      }
52086      if (element.hasIdentifier()) {
52087        openArray("identifier");
52088        for (Identifier e : element.getIdentifier()) 
52089          composeIdentifier(null, e);
52090        closeArray();
52091      };
52092      if (element.hasVersionElement()) {
52093        composeStringCore("version", element.getVersionElement(), false);
52094        composeStringExtras("version", element.getVersionElement(), false);
52095      }
52096      if (element.hasNameElement()) {
52097        composeStringCore("name", element.getNameElement(), false);
52098        composeStringExtras("name", element.getNameElement(), false);
52099      }
52100      if (element.hasTitleElement()) {
52101        composeStringCore("title", element.getTitleElement(), false);
52102        composeStringExtras("title", element.getTitleElement(), false);
52103      }
52104      if (element.hasShortTitleElement()) {
52105        composeStringCore("shortTitle", element.getShortTitleElement(), false);
52106        composeStringExtras("shortTitle", element.getShortTitleElement(), false);
52107      }
52108      if (element.hasSubtitleElement()) {
52109        composeStringCore("subtitle", element.getSubtitleElement(), false);
52110        composeStringExtras("subtitle", element.getSubtitleElement(), false);
52111      }
52112      if (element.hasStatusElement()) {
52113        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52114        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52115      }
52116      if (element.hasExperimentalElement()) {
52117        composeBooleanCore("experimental", element.getExperimentalElement(), false);
52118        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
52119      }
52120      if (element.hasSubject()) {
52121        composeType("subject", element.getSubject());
52122      }
52123      if (element.hasDateElement()) {
52124        composeDateTimeCore("date", element.getDateElement(), false);
52125        composeDateTimeExtras("date", element.getDateElement(), false);
52126      }
52127      if (element.hasPublisherElement()) {
52128        composeStringCore("publisher", element.getPublisherElement(), false);
52129        composeStringExtras("publisher", element.getPublisherElement(), false);
52130      }
52131      if (element.hasContact()) {
52132        openArray("contact");
52133        for (ContactDetail e : element.getContact()) 
52134          composeContactDetail(null, e);
52135        closeArray();
52136      };
52137      if (element.hasDescriptionElement()) {
52138        composeMarkdownCore("description", element.getDescriptionElement(), false);
52139        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52140      }
52141      if (element.hasComment()) {
52142        openArray("comment");
52143        for (StringType e : element.getComment()) 
52144          composeStringCore(null, e, true);
52145        closeArray();
52146        if (anyHasExtras(element.getComment())) {
52147          openArray("_comment");
52148          for (StringType e : element.getComment()) 
52149            composeStringExtras(null, e, true);
52150          closeArray();
52151        }
52152      };
52153      if (element.hasUseContext()) {
52154        openArray("useContext");
52155        for (UsageContext e : element.getUseContext()) 
52156          composeUsageContext(null, e);
52157        closeArray();
52158      };
52159      if (element.hasJurisdiction()) {
52160        openArray("jurisdiction");
52161        for (CodeableConcept e : element.getJurisdiction()) 
52162          composeCodeableConcept(null, e);
52163        closeArray();
52164      };
52165      if (element.hasPurposeElement()) {
52166        composeMarkdownCore("purpose", element.getPurposeElement(), false);
52167        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
52168      }
52169      if (element.hasUsageElement()) {
52170        composeStringCore("usage", element.getUsageElement(), false);
52171        composeStringExtras("usage", element.getUsageElement(), false);
52172      }
52173      if (element.hasCopyrightElement()) {
52174        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
52175        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
52176      }
52177      if (element.hasApprovalDateElement()) {
52178        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
52179        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
52180      }
52181      if (element.hasLastReviewDateElement()) {
52182        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
52183        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
52184      }
52185      if (element.hasEffectivePeriod()) {
52186        composePeriod("effectivePeriod", element.getEffectivePeriod());
52187      }
52188      if (element.hasTopic()) {
52189        openArray("topic");
52190        for (CodeableConcept e : element.getTopic()) 
52191          composeCodeableConcept(null, e);
52192        closeArray();
52193      };
52194      if (element.hasAuthor()) {
52195        openArray("author");
52196        for (ContactDetail e : element.getAuthor()) 
52197          composeContactDetail(null, e);
52198        closeArray();
52199      };
52200      if (element.hasEditor()) {
52201        openArray("editor");
52202        for (ContactDetail e : element.getEditor()) 
52203          composeContactDetail(null, e);
52204        closeArray();
52205      };
52206      if (element.hasReviewer()) {
52207        openArray("reviewer");
52208        for (ContactDetail e : element.getReviewer()) 
52209          composeContactDetail(null, e);
52210        closeArray();
52211      };
52212      if (element.hasEndorser()) {
52213        openArray("endorser");
52214        for (ContactDetail e : element.getEndorser()) 
52215          composeContactDetail(null, e);
52216        closeArray();
52217      };
52218      if (element.hasRelatedArtifact()) {
52219        openArray("relatedArtifact");
52220        for (RelatedArtifact e : element.getRelatedArtifact()) 
52221          composeRelatedArtifact(null, e);
52222        closeArray();
52223      };
52224      if (element.hasLibrary()) {
52225        openArray("library");
52226        for (CanonicalType e : element.getLibrary()) 
52227          composeCanonicalCore(null, e, true);
52228        closeArray();
52229        if (anyHasExtras(element.getLibrary())) {
52230          openArray("_library");
52231          for (CanonicalType e : element.getLibrary()) 
52232            composeCanonicalExtras(null, e, true);
52233          closeArray();
52234        }
52235      };
52236      if (element.hasTypeElement()) {
52237        composeEnumerationCore("type", element.getTypeElement(), new ResearchElementDefinition.ResearchElementTypeEnumFactory(), false);
52238        composeEnumerationExtras("type", element.getTypeElement(), new ResearchElementDefinition.ResearchElementTypeEnumFactory(), false);
52239      }
52240      if (element.hasVariableTypeElement()) {
52241        composeEnumerationCore("variableType", element.getVariableTypeElement(), new ResearchElementDefinition.VariableTypeEnumFactory(), false);
52242        composeEnumerationExtras("variableType", element.getVariableTypeElement(), new ResearchElementDefinition.VariableTypeEnumFactory(), false);
52243      }
52244      if (element.hasCharacteristic()) {
52245        openArray("characteristic");
52246        for (ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent e : element.getCharacteristic()) 
52247          composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponent(null, e);
52248        closeArray();
52249      };
52250  }
52251
52252  protected void composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponent(String name, ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent element) throws IOException {
52253    if (element != null) {
52254      open(name);
52255      composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponentInner(element);
52256      close();
52257    }
52258  }
52259
52260  protected void composeResearchElementDefinitionResearchElementDefinitionCharacteristicComponentInner(ResearchElementDefinition.ResearchElementDefinitionCharacteristicComponent element) throws IOException {
52261      composeBackbone(element);
52262      if (element.hasDefinition()) {
52263        composeType("definition", element.getDefinition());
52264      }
52265      if (element.hasUsageContext()) {
52266        openArray("usageContext");
52267        for (UsageContext e : element.getUsageContext()) 
52268          composeUsageContext(null, e);
52269        closeArray();
52270      };
52271      if (element.hasExcludeElement()) {
52272        composeBooleanCore("exclude", element.getExcludeElement(), false);
52273        composeBooleanExtras("exclude", element.getExcludeElement(), false);
52274      }
52275      if (element.hasUnitOfMeasure()) {
52276        composeCodeableConcept("unitOfMeasure", element.getUnitOfMeasure());
52277      }
52278      if (element.hasStudyEffectiveDescriptionElement()) {
52279        composeStringCore("studyEffectiveDescription", element.getStudyEffectiveDescriptionElement(), false);
52280        composeStringExtras("studyEffectiveDescription", element.getStudyEffectiveDescriptionElement(), false);
52281      }
52282      if (element.hasStudyEffective()) {
52283        composeType("studyEffective", element.getStudyEffective());
52284      }
52285      if (element.hasStudyEffectiveTimeFromStart()) {
52286        composeDuration("studyEffectiveTimeFromStart", element.getStudyEffectiveTimeFromStart());
52287      }
52288      if (element.hasStudyEffectiveGroupMeasureElement()) {
52289        composeEnumerationCore("studyEffectiveGroupMeasure", element.getStudyEffectiveGroupMeasureElement(), new ResearchElementDefinition.GroupMeasureEnumFactory(), false);
52290        composeEnumerationExtras("studyEffectiveGroupMeasure", element.getStudyEffectiveGroupMeasureElement(), new ResearchElementDefinition.GroupMeasureEnumFactory(), false);
52291      }
52292      if (element.hasParticipantEffectiveDescriptionElement()) {
52293        composeStringCore("participantEffectiveDescription", element.getParticipantEffectiveDescriptionElement(), false);
52294        composeStringExtras("participantEffectiveDescription", element.getParticipantEffectiveDescriptionElement(), false);
52295      }
52296      if (element.hasParticipantEffective()) {
52297        composeType("participantEffective", element.getParticipantEffective());
52298      }
52299      if (element.hasParticipantEffectiveTimeFromStart()) {
52300        composeDuration("participantEffectiveTimeFromStart", element.getParticipantEffectiveTimeFromStart());
52301      }
52302      if (element.hasParticipantEffectiveGroupMeasureElement()) {
52303        composeEnumerationCore("participantEffectiveGroupMeasure", element.getParticipantEffectiveGroupMeasureElement(), new ResearchElementDefinition.GroupMeasureEnumFactory(), false);
52304        composeEnumerationExtras("participantEffectiveGroupMeasure", element.getParticipantEffectiveGroupMeasureElement(), new ResearchElementDefinition.GroupMeasureEnumFactory(), false);
52305      }
52306  }
52307
52308  protected void composeResearchStudy(String name, ResearchStudy element) throws IOException {
52309    if (element != null) {
52310      prop("resourceType", name);
52311      composeResearchStudyInner(element);
52312    }
52313  }
52314
52315  protected void composeResearchStudyInner(ResearchStudy element) throws IOException {
52316      composeDomainResourceElements(element);
52317      if (element.hasIdentifier()) {
52318        openArray("identifier");
52319        for (Identifier e : element.getIdentifier()) 
52320          composeIdentifier(null, e);
52321        closeArray();
52322      };
52323      if (element.hasTitleElement()) {
52324        composeStringCore("title", element.getTitleElement(), false);
52325        composeStringExtras("title", element.getTitleElement(), false);
52326      }
52327      if (element.hasProtocol()) {
52328        openArray("protocol");
52329        for (Reference e : element.getProtocol()) 
52330          composeReference(null, e);
52331        closeArray();
52332      };
52333      if (element.hasPartOf()) {
52334        openArray("partOf");
52335        for (Reference e : element.getPartOf()) 
52336          composeReference(null, e);
52337        closeArray();
52338      };
52339      if (element.hasStatusElement()) {
52340        composeEnumerationCore("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
52341        composeEnumerationExtras("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
52342      }
52343      if (element.hasPrimaryPurposeType()) {
52344        composeCodeableConcept("primaryPurposeType", element.getPrimaryPurposeType());
52345      }
52346      if (element.hasPhase()) {
52347        composeCodeableConcept("phase", element.getPhase());
52348      }
52349      if (element.hasCategory()) {
52350        openArray("category");
52351        for (CodeableConcept e : element.getCategory()) 
52352          composeCodeableConcept(null, e);
52353        closeArray();
52354      };
52355      if (element.hasFocus()) {
52356        openArray("focus");
52357        for (CodeableConcept e : element.getFocus()) 
52358          composeCodeableConcept(null, e);
52359        closeArray();
52360      };
52361      if (element.hasCondition()) {
52362        openArray("condition");
52363        for (CodeableConcept e : element.getCondition()) 
52364          composeCodeableConcept(null, e);
52365        closeArray();
52366      };
52367      if (element.hasContact()) {
52368        openArray("contact");
52369        for (ContactDetail e : element.getContact()) 
52370          composeContactDetail(null, e);
52371        closeArray();
52372      };
52373      if (element.hasRelatedArtifact()) {
52374        openArray("relatedArtifact");
52375        for (RelatedArtifact e : element.getRelatedArtifact()) 
52376          composeRelatedArtifact(null, e);
52377        closeArray();
52378      };
52379      if (element.hasKeyword()) {
52380        openArray("keyword");
52381        for (CodeableConcept e : element.getKeyword()) 
52382          composeCodeableConcept(null, e);
52383        closeArray();
52384      };
52385      if (element.hasLocation()) {
52386        openArray("location");
52387        for (CodeableConcept e : element.getLocation()) 
52388          composeCodeableConcept(null, e);
52389        closeArray();
52390      };
52391      if (element.hasDescriptionElement()) {
52392        composeMarkdownCore("description", element.getDescriptionElement(), false);
52393        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52394      }
52395      if (element.hasEnrollment()) {
52396        openArray("enrollment");
52397        for (Reference e : element.getEnrollment()) 
52398          composeReference(null, e);
52399        closeArray();
52400      };
52401      if (element.hasPeriod()) {
52402        composePeriod("period", element.getPeriod());
52403      }
52404      if (element.hasSponsor()) {
52405        composeReference("sponsor", element.getSponsor());
52406      }
52407      if (element.hasPrincipalInvestigator()) {
52408        composeReference("principalInvestigator", element.getPrincipalInvestigator());
52409      }
52410      if (element.hasSite()) {
52411        openArray("site");
52412        for (Reference e : element.getSite()) 
52413          composeReference(null, e);
52414        closeArray();
52415      };
52416      if (element.hasReasonStopped()) {
52417        composeCodeableConcept("reasonStopped", element.getReasonStopped());
52418      }
52419      if (element.hasNote()) {
52420        openArray("note");
52421        for (Annotation e : element.getNote()) 
52422          composeAnnotation(null, e);
52423        closeArray();
52424      };
52425      if (element.hasArm()) {
52426        openArray("arm");
52427        for (ResearchStudy.ResearchStudyArmComponent e : element.getArm()) 
52428          composeResearchStudyResearchStudyArmComponent(null, e);
52429        closeArray();
52430      };
52431      if (element.hasObjective()) {
52432        openArray("objective");
52433        for (ResearchStudy.ResearchStudyObjectiveComponent e : element.getObjective()) 
52434          composeResearchStudyResearchStudyObjectiveComponent(null, e);
52435        closeArray();
52436      };
52437  }
52438
52439  protected void composeResearchStudyResearchStudyArmComponent(String name, ResearchStudy.ResearchStudyArmComponent element) throws IOException {
52440    if (element != null) {
52441      open(name);
52442      composeResearchStudyResearchStudyArmComponentInner(element);
52443      close();
52444    }
52445  }
52446
52447  protected void composeResearchStudyResearchStudyArmComponentInner(ResearchStudy.ResearchStudyArmComponent element) throws IOException {
52448      composeBackbone(element);
52449      if (element.hasNameElement()) {
52450        composeStringCore("name", element.getNameElement(), false);
52451        composeStringExtras("name", element.getNameElement(), false);
52452      }
52453      if (element.hasType()) {
52454        composeCodeableConcept("type", element.getType());
52455      }
52456      if (element.hasDescriptionElement()) {
52457        composeStringCore("description", element.getDescriptionElement(), false);
52458        composeStringExtras("description", element.getDescriptionElement(), false);
52459      }
52460  }
52461
52462  protected void composeResearchStudyResearchStudyObjectiveComponent(String name, ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
52463    if (element != null) {
52464      open(name);
52465      composeResearchStudyResearchStudyObjectiveComponentInner(element);
52466      close();
52467    }
52468  }
52469
52470  protected void composeResearchStudyResearchStudyObjectiveComponentInner(ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
52471      composeBackbone(element);
52472      if (element.hasNameElement()) {
52473        composeStringCore("name", element.getNameElement(), false);
52474        composeStringExtras("name", element.getNameElement(), false);
52475      }
52476      if (element.hasType()) {
52477        composeCodeableConcept("type", element.getType());
52478      }
52479  }
52480
52481  protected void composeResearchSubject(String name, ResearchSubject element) throws IOException {
52482    if (element != null) {
52483      prop("resourceType", name);
52484      composeResearchSubjectInner(element);
52485    }
52486  }
52487
52488  protected void composeResearchSubjectInner(ResearchSubject element) throws IOException {
52489      composeDomainResourceElements(element);
52490      if (element.hasIdentifier()) {
52491        openArray("identifier");
52492        for (Identifier e : element.getIdentifier()) 
52493          composeIdentifier(null, e);
52494        closeArray();
52495      };
52496      if (element.hasStatusElement()) {
52497        composeEnumerationCore("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
52498        composeEnumerationExtras("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
52499      }
52500      if (element.hasPeriod()) {
52501        composePeriod("period", element.getPeriod());
52502      }
52503      if (element.hasStudy()) {
52504        composeReference("study", element.getStudy());
52505      }
52506      if (element.hasIndividual()) {
52507        composeReference("individual", element.getIndividual());
52508      }
52509      if (element.hasAssignedArmElement()) {
52510        composeStringCore("assignedArm", element.getAssignedArmElement(), false);
52511        composeStringExtras("assignedArm", element.getAssignedArmElement(), false);
52512      }
52513      if (element.hasActualArmElement()) {
52514        composeStringCore("actualArm", element.getActualArmElement(), false);
52515        composeStringExtras("actualArm", element.getActualArmElement(), false);
52516      }
52517      if (element.hasConsent()) {
52518        composeReference("consent", element.getConsent());
52519      }
52520  }
52521
52522  protected void composeRiskAssessment(String name, RiskAssessment element) throws IOException {
52523    if (element != null) {
52524      prop("resourceType", name);
52525      composeRiskAssessmentInner(element);
52526    }
52527  }
52528
52529  protected void composeRiskAssessmentInner(RiskAssessment element) throws IOException {
52530      composeDomainResourceElements(element);
52531      if (element.hasIdentifier()) {
52532        openArray("identifier");
52533        for (Identifier e : element.getIdentifier()) 
52534          composeIdentifier(null, e);
52535        closeArray();
52536      };
52537      if (element.hasBasedOn()) {
52538        composeReference("basedOn", element.getBasedOn());
52539      }
52540      if (element.hasParent()) {
52541        composeReference("parent", element.getParent());
52542      }
52543      if (element.hasStatusElement()) {
52544        composeEnumerationCore("status", element.getStatusElement(), new RiskAssessment.RiskAssessmentStatusEnumFactory(), false);
52545        composeEnumerationExtras("status", element.getStatusElement(), new RiskAssessment.RiskAssessmentStatusEnumFactory(), false);
52546      }
52547      if (element.hasMethod()) {
52548        composeCodeableConcept("method", element.getMethod());
52549      }
52550      if (element.hasCode()) {
52551        composeCodeableConcept("code", element.getCode());
52552      }
52553      if (element.hasSubject()) {
52554        composeReference("subject", element.getSubject());
52555      }
52556      if (element.hasEncounter()) {
52557        composeReference("encounter", element.getEncounter());
52558      }
52559      if (element.hasOccurrence()) {
52560        composeType("occurrence", element.getOccurrence());
52561      }
52562      if (element.hasCondition()) {
52563        composeReference("condition", element.getCondition());
52564      }
52565      if (element.hasPerformer()) {
52566        composeReference("performer", element.getPerformer());
52567      }
52568      if (element.hasReasonCode()) {
52569        openArray("reasonCode");
52570        for (CodeableConcept e : element.getReasonCode()) 
52571          composeCodeableConcept(null, e);
52572        closeArray();
52573      };
52574      if (element.hasReasonReference()) {
52575        openArray("reasonReference");
52576        for (Reference e : element.getReasonReference()) 
52577          composeReference(null, e);
52578        closeArray();
52579      };
52580      if (element.hasBasis()) {
52581        openArray("basis");
52582        for (Reference e : element.getBasis()) 
52583          composeReference(null, e);
52584        closeArray();
52585      };
52586      if (element.hasPrediction()) {
52587        openArray("prediction");
52588        for (RiskAssessment.RiskAssessmentPredictionComponent e : element.getPrediction()) 
52589          composeRiskAssessmentRiskAssessmentPredictionComponent(null, e);
52590        closeArray();
52591      };
52592      if (element.hasMitigationElement()) {
52593        composeStringCore("mitigation", element.getMitigationElement(), false);
52594        composeStringExtras("mitigation", element.getMitigationElement(), false);
52595      }
52596      if (element.hasNote()) {
52597        openArray("note");
52598        for (Annotation e : element.getNote()) 
52599          composeAnnotation(null, e);
52600        closeArray();
52601      };
52602  }
52603
52604  protected void composeRiskAssessmentRiskAssessmentPredictionComponent(String name, RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
52605    if (element != null) {
52606      open(name);
52607      composeRiskAssessmentRiskAssessmentPredictionComponentInner(element);
52608      close();
52609    }
52610  }
52611
52612  protected void composeRiskAssessmentRiskAssessmentPredictionComponentInner(RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
52613      composeBackbone(element);
52614      if (element.hasOutcome()) {
52615        composeCodeableConcept("outcome", element.getOutcome());
52616      }
52617      if (element.hasProbability()) {
52618        composeType("probability", element.getProbability());
52619      }
52620      if (element.hasQualitativeRisk()) {
52621        composeCodeableConcept("qualitativeRisk", element.getQualitativeRisk());
52622      }
52623      if (element.hasRelativeRiskElement()) {
52624        composeDecimalCore("relativeRisk", element.getRelativeRiskElement(), false);
52625        composeDecimalExtras("relativeRisk", element.getRelativeRiskElement(), false);
52626      }
52627      if (element.hasWhen()) {
52628        composeType("when", element.getWhen());
52629      }
52630      if (element.hasRationaleElement()) {
52631        composeStringCore("rationale", element.getRationaleElement(), false);
52632        composeStringExtras("rationale", element.getRationaleElement(), false);
52633      }
52634  }
52635
52636  protected void composeRiskEvidenceSynthesis(String name, RiskEvidenceSynthesis element) throws IOException {
52637    if (element != null) {
52638      prop("resourceType", name);
52639      composeRiskEvidenceSynthesisInner(element);
52640    }
52641  }
52642
52643  protected void composeRiskEvidenceSynthesisInner(RiskEvidenceSynthesis element) throws IOException {
52644      composeDomainResourceElements(element);
52645      if (element.hasUrlElement()) {
52646        composeUriCore("url", element.getUrlElement(), false);
52647        composeUriExtras("url", element.getUrlElement(), false);
52648      }
52649      if (element.hasIdentifier()) {
52650        openArray("identifier");
52651        for (Identifier e : element.getIdentifier()) 
52652          composeIdentifier(null, e);
52653        closeArray();
52654      };
52655      if (element.hasVersionElement()) {
52656        composeStringCore("version", element.getVersionElement(), false);
52657        composeStringExtras("version", element.getVersionElement(), false);
52658      }
52659      if (element.hasNameElement()) {
52660        composeStringCore("name", element.getNameElement(), false);
52661        composeStringExtras("name", element.getNameElement(), false);
52662      }
52663      if (element.hasTitleElement()) {
52664        composeStringCore("title", element.getTitleElement(), false);
52665        composeStringExtras("title", element.getTitleElement(), false);
52666      }
52667      if (element.hasStatusElement()) {
52668        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52669        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
52670      }
52671      if (element.hasDateElement()) {
52672        composeDateTimeCore("date", element.getDateElement(), false);
52673        composeDateTimeExtras("date", element.getDateElement(), false);
52674      }
52675      if (element.hasPublisherElement()) {
52676        composeStringCore("publisher", element.getPublisherElement(), false);
52677        composeStringExtras("publisher", element.getPublisherElement(), false);
52678      }
52679      if (element.hasContact()) {
52680        openArray("contact");
52681        for (ContactDetail e : element.getContact()) 
52682          composeContactDetail(null, e);
52683        closeArray();
52684      };
52685      if (element.hasDescriptionElement()) {
52686        composeMarkdownCore("description", element.getDescriptionElement(), false);
52687        composeMarkdownExtras("description", element.getDescriptionElement(), false);
52688      }
52689      if (element.hasNote()) {
52690        openArray("note");
52691        for (Annotation e : element.getNote()) 
52692          composeAnnotation(null, e);
52693        closeArray();
52694      };
52695      if (element.hasUseContext()) {
52696        openArray("useContext");
52697        for (UsageContext e : element.getUseContext()) 
52698          composeUsageContext(null, e);
52699        closeArray();
52700      };
52701      if (element.hasJurisdiction()) {
52702        openArray("jurisdiction");
52703        for (CodeableConcept e : element.getJurisdiction()) 
52704          composeCodeableConcept(null, e);
52705        closeArray();
52706      };
52707      if (element.hasCopyrightElement()) {
52708        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
52709        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
52710      }
52711      if (element.hasApprovalDateElement()) {
52712        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
52713        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
52714      }
52715      if (element.hasLastReviewDateElement()) {
52716        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
52717        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
52718      }
52719      if (element.hasEffectivePeriod()) {
52720        composePeriod("effectivePeriod", element.getEffectivePeriod());
52721      }
52722      if (element.hasTopic()) {
52723        openArray("topic");
52724        for (CodeableConcept e : element.getTopic()) 
52725          composeCodeableConcept(null, e);
52726        closeArray();
52727      };
52728      if (element.hasAuthor()) {
52729        openArray("author");
52730        for (ContactDetail e : element.getAuthor()) 
52731          composeContactDetail(null, e);
52732        closeArray();
52733      };
52734      if (element.hasEditor()) {
52735        openArray("editor");
52736        for (ContactDetail e : element.getEditor()) 
52737          composeContactDetail(null, e);
52738        closeArray();
52739      };
52740      if (element.hasReviewer()) {
52741        openArray("reviewer");
52742        for (ContactDetail e : element.getReviewer()) 
52743          composeContactDetail(null, e);
52744        closeArray();
52745      };
52746      if (element.hasEndorser()) {
52747        openArray("endorser");
52748        for (ContactDetail e : element.getEndorser()) 
52749          composeContactDetail(null, e);
52750        closeArray();
52751      };
52752      if (element.hasRelatedArtifact()) {
52753        openArray("relatedArtifact");
52754        for (RelatedArtifact e : element.getRelatedArtifact()) 
52755          composeRelatedArtifact(null, e);
52756        closeArray();
52757      };
52758      if (element.hasSynthesisType()) {
52759        composeCodeableConcept("synthesisType", element.getSynthesisType());
52760      }
52761      if (element.hasStudyType()) {
52762        composeCodeableConcept("studyType", element.getStudyType());
52763      }
52764      if (element.hasPopulation()) {
52765        composeReference("population", element.getPopulation());
52766      }
52767      if (element.hasExposure()) {
52768        composeReference("exposure", element.getExposure());
52769      }
52770      if (element.hasOutcome()) {
52771        composeReference("outcome", element.getOutcome());
52772      }
52773      if (element.hasSampleSize()) {
52774        composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent("sampleSize", element.getSampleSize());
52775      }
52776      if (element.hasRiskEstimate()) {
52777        composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent("riskEstimate", element.getRiskEstimate());
52778      }
52779      if (element.hasCertainty()) {
52780        openArray("certainty");
52781        for (RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent e : element.getCertainty()) 
52782          composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent(null, e);
52783        closeArray();
52784      };
52785  }
52786
52787  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponent(String name, RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent element) throws IOException {
52788    if (element != null) {
52789      open(name);
52790      composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentInner(element);
52791      close();
52792    }
52793  }
52794
52795  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisSampleSizeComponentInner(RiskEvidenceSynthesis.RiskEvidenceSynthesisSampleSizeComponent element) throws IOException {
52796      composeBackbone(element);
52797      if (element.hasDescriptionElement()) {
52798        composeStringCore("description", element.getDescriptionElement(), false);
52799        composeStringExtras("description", element.getDescriptionElement(), false);
52800      }
52801      if (element.hasNumberOfStudiesElement()) {
52802        composeIntegerCore("numberOfStudies", element.getNumberOfStudiesElement(), false);
52803        composeIntegerExtras("numberOfStudies", element.getNumberOfStudiesElement(), false);
52804      }
52805      if (element.hasNumberOfParticipantsElement()) {
52806        composeIntegerCore("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
52807        composeIntegerExtras("numberOfParticipants", element.getNumberOfParticipantsElement(), false);
52808      }
52809  }
52810
52811  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponent(String name, RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent element) throws IOException {
52812    if (element != null) {
52813      open(name);
52814      composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentInner(element);
52815      close();
52816    }
52817  }
52818
52819  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimateComponentInner(RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimateComponent element) throws IOException {
52820      composeBackbone(element);
52821      if (element.hasDescriptionElement()) {
52822        composeStringCore("description", element.getDescriptionElement(), false);
52823        composeStringExtras("description", element.getDescriptionElement(), false);
52824      }
52825      if (element.hasType()) {
52826        composeCodeableConcept("type", element.getType());
52827      }
52828      if (element.hasValueElement()) {
52829        composeDecimalCore("value", element.getValueElement(), false);
52830        composeDecimalExtras("value", element.getValueElement(), false);
52831      }
52832      if (element.hasUnitOfMeasure()) {
52833        composeCodeableConcept("unitOfMeasure", element.getUnitOfMeasure());
52834      }
52835      if (element.hasDenominatorCountElement()) {
52836        composeIntegerCore("denominatorCount", element.getDenominatorCountElement(), false);
52837        composeIntegerExtras("denominatorCount", element.getDenominatorCountElement(), false);
52838      }
52839      if (element.hasNumeratorCountElement()) {
52840        composeIntegerCore("numeratorCount", element.getNumeratorCountElement(), false);
52841        composeIntegerExtras("numeratorCount", element.getNumeratorCountElement(), false);
52842      }
52843      if (element.hasPrecisionEstimate()) {
52844        openArray("precisionEstimate");
52845        for (RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent e : element.getPrecisionEstimate()) 
52846          composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(null, e);
52847        closeArray();
52848      };
52849  }
52850
52851  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent(String name, RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent element) throws IOException {
52852    if (element != null) {
52853      open(name);
52854      composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentInner(element);
52855      close();
52856    }
52857  }
52858
52859  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponentInner(RiskEvidenceSynthesis.RiskEvidenceSynthesisRiskEstimatePrecisionEstimateComponent element) throws IOException {
52860      composeBackbone(element);
52861      if (element.hasType()) {
52862        composeCodeableConcept("type", element.getType());
52863      }
52864      if (element.hasLevelElement()) {
52865        composeDecimalCore("level", element.getLevelElement(), false);
52866        composeDecimalExtras("level", element.getLevelElement(), false);
52867      }
52868      if (element.hasFromElement()) {
52869        composeDecimalCore("from", element.getFromElement(), false);
52870        composeDecimalExtras("from", element.getFromElement(), false);
52871      }
52872      if (element.hasToElement()) {
52873        composeDecimalCore("to", element.getToElement(), false);
52874        composeDecimalExtras("to", element.getToElement(), false);
52875      }
52876  }
52877
52878  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponent(String name, RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent element) throws IOException {
52879    if (element != null) {
52880      open(name);
52881      composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentInner(element);
52882      close();
52883    }
52884  }
52885
52886  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyComponentInner(RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyComponent element) throws IOException {
52887      composeBackbone(element);
52888      if (element.hasRating()) {
52889        openArray("rating");
52890        for (CodeableConcept e : element.getRating()) 
52891          composeCodeableConcept(null, e);
52892        closeArray();
52893      };
52894      if (element.hasNote()) {
52895        openArray("note");
52896        for (Annotation e : element.getNote()) 
52897          composeAnnotation(null, e);
52898        closeArray();
52899      };
52900      if (element.hasCertaintySubcomponent()) {
52901        openArray("certaintySubcomponent");
52902        for (RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent e : element.getCertaintySubcomponent()) 
52903          composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(null, e);
52904        closeArray();
52905      };
52906  }
52907
52908  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent(String name, RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent element) throws IOException {
52909    if (element != null) {
52910      open(name);
52911      composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentInner(element);
52912      close();
52913    }
52914  }
52915
52916  protected void composeRiskEvidenceSynthesisRiskEvidenceSynthesisCertaintyCertaintySubcomponentComponentInner(RiskEvidenceSynthesis.RiskEvidenceSynthesisCertaintyCertaintySubcomponentComponent element) throws IOException {
52917      composeBackbone(element);
52918      if (element.hasType()) {
52919        composeCodeableConcept("type", element.getType());
52920      }
52921      if (element.hasRating()) {
52922        openArray("rating");
52923        for (CodeableConcept e : element.getRating()) 
52924          composeCodeableConcept(null, e);
52925        closeArray();
52926      };
52927      if (element.hasNote()) {
52928        openArray("note");
52929        for (Annotation e : element.getNote()) 
52930          composeAnnotation(null, e);
52931        closeArray();
52932      };
52933  }
52934
52935  protected void composeSchedule(String name, Schedule element) throws IOException {
52936    if (element != null) {
52937      prop("resourceType", name);
52938      composeScheduleInner(element);
52939    }
52940  }
52941
52942  protected void composeScheduleInner(Schedule element) throws IOException {
52943      composeDomainResourceElements(element);
52944      if (element.hasIdentifier()) {
52945        openArray("identifier");
52946        for (Identifier e : element.getIdentifier()) 
52947          composeIdentifier(null, e);
52948        closeArray();
52949      };
52950      if (element.hasActiveElement()) {
52951        composeBooleanCore("active", element.getActiveElement(), false);
52952        composeBooleanExtras("active", element.getActiveElement(), false);
52953      }
52954      if (element.hasServiceCategory()) {
52955        openArray("serviceCategory");
52956        for (CodeableConcept e : element.getServiceCategory()) 
52957          composeCodeableConcept(null, e);
52958        closeArray();
52959      };
52960      if (element.hasServiceType()) {
52961        openArray("serviceType");
52962        for (CodeableConcept e : element.getServiceType()) 
52963          composeCodeableConcept(null, e);
52964        closeArray();
52965      };
52966      if (element.hasSpecialty()) {
52967        openArray("specialty");
52968        for (CodeableConcept e : element.getSpecialty()) 
52969          composeCodeableConcept(null, e);
52970        closeArray();
52971      };
52972      if (element.hasActor()) {
52973        openArray("actor");
52974        for (Reference e : element.getActor()) 
52975          composeReference(null, e);
52976        closeArray();
52977      };
52978      if (element.hasPlanningHorizon()) {
52979        composePeriod("planningHorizon", element.getPlanningHorizon());
52980      }
52981      if (element.hasCommentElement()) {
52982        composeStringCore("comment", element.getCommentElement(), false);
52983        composeStringExtras("comment", element.getCommentElement(), false);
52984      }
52985  }
52986
52987  protected void composeSearchParameter(String name, SearchParameter element) throws IOException {
52988    if (element != null) {
52989      prop("resourceType", name);
52990      composeSearchParameterInner(element);
52991    }
52992  }
52993
52994  protected void composeSearchParameterInner(SearchParameter element) throws IOException {
52995      composeDomainResourceElements(element);
52996      if (element.hasUrlElement()) {
52997        composeUriCore("url", element.getUrlElement(), false);
52998        composeUriExtras("url", element.getUrlElement(), false);
52999      }
53000      if (element.hasVersionElement()) {
53001        composeStringCore("version", element.getVersionElement(), false);
53002        composeStringExtras("version", element.getVersionElement(), false);
53003      }
53004      if (element.hasNameElement()) {
53005        composeStringCore("name", element.getNameElement(), false);
53006        composeStringExtras("name", element.getNameElement(), false);
53007      }
53008      if (element.hasDerivedFromElement()) {
53009        composeCanonicalCore("derivedFrom", element.getDerivedFromElement(), false);
53010        composeCanonicalExtras("derivedFrom", element.getDerivedFromElement(), false);
53011      }
53012      if (element.hasStatusElement()) {
53013        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53014        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53015      }
53016      if (element.hasExperimentalElement()) {
53017        composeBooleanCore("experimental", element.getExperimentalElement(), false);
53018        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
53019      }
53020      if (element.hasDateElement()) {
53021        composeDateTimeCore("date", element.getDateElement(), false);
53022        composeDateTimeExtras("date", element.getDateElement(), false);
53023      }
53024      if (element.hasPublisherElement()) {
53025        composeStringCore("publisher", element.getPublisherElement(), false);
53026        composeStringExtras("publisher", element.getPublisherElement(), false);
53027      }
53028      if (element.hasContact()) {
53029        openArray("contact");
53030        for (ContactDetail e : element.getContact()) 
53031          composeContactDetail(null, e);
53032        closeArray();
53033      };
53034      if (element.hasDescriptionElement()) {
53035        composeMarkdownCore("description", element.getDescriptionElement(), false);
53036        composeMarkdownExtras("description", element.getDescriptionElement(), false);
53037      }
53038      if (element.hasUseContext()) {
53039        openArray("useContext");
53040        for (UsageContext e : element.getUseContext()) 
53041          composeUsageContext(null, e);
53042        closeArray();
53043      };
53044      if (element.hasJurisdiction()) {
53045        openArray("jurisdiction");
53046        for (CodeableConcept e : element.getJurisdiction()) 
53047          composeCodeableConcept(null, e);
53048        closeArray();
53049      };
53050      if (element.hasPurposeElement()) {
53051        composeMarkdownCore("purpose", element.getPurposeElement(), false);
53052        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
53053      }
53054      if (element.hasCodeElement()) {
53055        composeCodeCore("code", element.getCodeElement(), false);
53056        composeCodeExtras("code", element.getCodeElement(), false);
53057      }
53058      if (element.hasBase()) {
53059        openArray("base");
53060        for (CodeType e : element.getBase()) 
53061          composeCodeCore(null, e, true);
53062        closeArray();
53063        if (anyHasExtras(element.getBase())) {
53064          openArray("_base");
53065          for (CodeType e : element.getBase()) 
53066            composeCodeExtras(null, e, true);
53067          closeArray();
53068        }
53069      };
53070      if (element.hasTypeElement()) {
53071        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
53072        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
53073      }
53074      if (element.hasExpressionElement()) {
53075        composeStringCore("expression", element.getExpressionElement(), false);
53076        composeStringExtras("expression", element.getExpressionElement(), false);
53077      }
53078      if (element.hasXpathElement()) {
53079        composeStringCore("xpath", element.getXpathElement(), false);
53080        composeStringExtras("xpath", element.getXpathElement(), false);
53081      }
53082      if (element.hasXpathUsageElement()) {
53083        composeEnumerationCore("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
53084        composeEnumerationExtras("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
53085      }
53086      if (element.hasTarget()) {
53087        openArray("target");
53088        for (CodeType e : element.getTarget()) 
53089          composeCodeCore(null, e, true);
53090        closeArray();
53091        if (anyHasExtras(element.getTarget())) {
53092          openArray("_target");
53093          for (CodeType e : element.getTarget()) 
53094            composeCodeExtras(null, e, true);
53095          closeArray();
53096        }
53097      };
53098      if (element.hasMultipleOrElement()) {
53099        composeBooleanCore("multipleOr", element.getMultipleOrElement(), false);
53100        composeBooleanExtras("multipleOr", element.getMultipleOrElement(), false);
53101      }
53102      if (element.hasMultipleAndElement()) {
53103        composeBooleanCore("multipleAnd", element.getMultipleAndElement(), false);
53104        composeBooleanExtras("multipleAnd", element.getMultipleAndElement(), false);
53105      }
53106      if (element.hasComparator()) {
53107        openArray("comparator");
53108        for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
53109          composeEnumerationCore(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
53110        closeArray();
53111        if (anyHasExtras(element.getComparator())) {
53112          openArray("_comparator");
53113          for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
53114            composeEnumerationExtras(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
53115          closeArray();
53116        }
53117      };
53118      if (element.hasModifier()) {
53119        openArray("modifier");
53120        for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
53121          composeEnumerationCore(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
53122        closeArray();
53123        if (anyHasExtras(element.getModifier())) {
53124          openArray("_modifier");
53125          for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
53126            composeEnumerationExtras(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
53127          closeArray();
53128        }
53129      };
53130      if (element.hasChain()) {
53131        openArray("chain");
53132        for (StringType e : element.getChain()) 
53133          composeStringCore(null, e, true);
53134        closeArray();
53135        if (anyHasExtras(element.getChain())) {
53136          openArray("_chain");
53137          for (StringType e : element.getChain()) 
53138            composeStringExtras(null, e, true);
53139          closeArray();
53140        }
53141      };
53142      if (element.hasComponent()) {
53143        openArray("component");
53144        for (SearchParameter.SearchParameterComponentComponent e : element.getComponent()) 
53145          composeSearchParameterSearchParameterComponentComponent(null, e);
53146        closeArray();
53147      };
53148  }
53149
53150  protected void composeSearchParameterSearchParameterComponentComponent(String name, SearchParameter.SearchParameterComponentComponent element) throws IOException {
53151    if (element != null) {
53152      open(name);
53153      composeSearchParameterSearchParameterComponentComponentInner(element);
53154      close();
53155    }
53156  }
53157
53158  protected void composeSearchParameterSearchParameterComponentComponentInner(SearchParameter.SearchParameterComponentComponent element) throws IOException {
53159      composeBackbone(element);
53160      if (element.hasDefinitionElement()) {
53161        composeCanonicalCore("definition", element.getDefinitionElement(), false);
53162        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
53163      }
53164      if (element.hasExpressionElement()) {
53165        composeStringCore("expression", element.getExpressionElement(), false);
53166        composeStringExtras("expression", element.getExpressionElement(), false);
53167      }
53168  }
53169
53170  protected void composeServiceRequest(String name, ServiceRequest element) throws IOException {
53171    if (element != null) {
53172      prop("resourceType", name);
53173      composeServiceRequestInner(element);
53174    }
53175  }
53176
53177  protected void composeServiceRequestInner(ServiceRequest element) throws IOException {
53178      composeDomainResourceElements(element);
53179      if (element.hasIdentifier()) {
53180        openArray("identifier");
53181        for (Identifier e : element.getIdentifier()) 
53182          composeIdentifier(null, e);
53183        closeArray();
53184      };
53185      if (element.hasInstantiatesCanonical()) {
53186        openArray("instantiatesCanonical");
53187        for (CanonicalType e : element.getInstantiatesCanonical()) 
53188          composeCanonicalCore(null, e, true);
53189        closeArray();
53190        if (anyHasExtras(element.getInstantiatesCanonical())) {
53191          openArray("_instantiatesCanonical");
53192          for (CanonicalType e : element.getInstantiatesCanonical()) 
53193            composeCanonicalExtras(null, e, true);
53194          closeArray();
53195        }
53196      };
53197      if (element.hasInstantiatesUri()) {
53198        openArray("instantiatesUri");
53199        for (UriType e : element.getInstantiatesUri()) 
53200          composeUriCore(null, e, true);
53201        closeArray();
53202        if (anyHasExtras(element.getInstantiatesUri())) {
53203          openArray("_instantiatesUri");
53204          for (UriType e : element.getInstantiatesUri()) 
53205            composeUriExtras(null, e, true);
53206          closeArray();
53207        }
53208      };
53209      if (element.hasBasedOn()) {
53210        openArray("basedOn");
53211        for (Reference e : element.getBasedOn()) 
53212          composeReference(null, e);
53213        closeArray();
53214      };
53215      if (element.hasReplaces()) {
53216        openArray("replaces");
53217        for (Reference e : element.getReplaces()) 
53218          composeReference(null, e);
53219        closeArray();
53220      };
53221      if (element.hasRequisition()) {
53222        composeIdentifier("requisition", element.getRequisition());
53223      }
53224      if (element.hasStatusElement()) {
53225        composeEnumerationCore("status", element.getStatusElement(), new ServiceRequest.ServiceRequestStatusEnumFactory(), false);
53226        composeEnumerationExtras("status", element.getStatusElement(), new ServiceRequest.ServiceRequestStatusEnumFactory(), false);
53227      }
53228      if (element.hasIntentElement()) {
53229        composeEnumerationCore("intent", element.getIntentElement(), new ServiceRequest.ServiceRequestIntentEnumFactory(), false);
53230        composeEnumerationExtras("intent", element.getIntentElement(), new ServiceRequest.ServiceRequestIntentEnumFactory(), false);
53231      }
53232      if (element.hasCategory()) {
53233        openArray("category");
53234        for (CodeableConcept e : element.getCategory()) 
53235          composeCodeableConcept(null, e);
53236        closeArray();
53237      };
53238      if (element.hasPriorityElement()) {
53239        composeEnumerationCore("priority", element.getPriorityElement(), new ServiceRequest.ServiceRequestPriorityEnumFactory(), false);
53240        composeEnumerationExtras("priority", element.getPriorityElement(), new ServiceRequest.ServiceRequestPriorityEnumFactory(), false);
53241      }
53242      if (element.hasDoNotPerformElement()) {
53243        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
53244        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
53245      }
53246      if (element.hasCode()) {
53247        composeCodeableConcept("code", element.getCode());
53248      }
53249      if (element.hasOrderDetail()) {
53250        openArray("orderDetail");
53251        for (CodeableConcept e : element.getOrderDetail()) 
53252          composeCodeableConcept(null, e);
53253        closeArray();
53254      };
53255      if (element.hasQuantity()) {
53256        composeType("quantity", element.getQuantity());
53257      }
53258      if (element.hasSubject()) {
53259        composeReference("subject", element.getSubject());
53260      }
53261      if (element.hasEncounter()) {
53262        composeReference("encounter", element.getEncounter());
53263      }
53264      if (element.hasOccurrence()) {
53265        composeType("occurrence", element.getOccurrence());
53266      }
53267      if (element.hasAsNeeded()) {
53268        composeType("asNeeded", element.getAsNeeded());
53269      }
53270      if (element.hasAuthoredOnElement()) {
53271        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
53272        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
53273      }
53274      if (element.hasRequester()) {
53275        composeReference("requester", element.getRequester());
53276      }
53277      if (element.hasPerformerType()) {
53278        composeCodeableConcept("performerType", element.getPerformerType());
53279      }
53280      if (element.hasPerformer()) {
53281        openArray("performer");
53282        for (Reference e : element.getPerformer()) 
53283          composeReference(null, e);
53284        closeArray();
53285      };
53286      if (element.hasLocationCode()) {
53287        openArray("locationCode");
53288        for (CodeableConcept e : element.getLocationCode()) 
53289          composeCodeableConcept(null, e);
53290        closeArray();
53291      };
53292      if (element.hasLocationReference()) {
53293        openArray("locationReference");
53294        for (Reference e : element.getLocationReference()) 
53295          composeReference(null, e);
53296        closeArray();
53297      };
53298      if (element.hasReasonCode()) {
53299        openArray("reasonCode");
53300        for (CodeableConcept e : element.getReasonCode()) 
53301          composeCodeableConcept(null, e);
53302        closeArray();
53303      };
53304      if (element.hasReasonReference()) {
53305        openArray("reasonReference");
53306        for (Reference e : element.getReasonReference()) 
53307          composeReference(null, e);
53308        closeArray();
53309      };
53310      if (element.hasInsurance()) {
53311        openArray("insurance");
53312        for (Reference e : element.getInsurance()) 
53313          composeReference(null, e);
53314        closeArray();
53315      };
53316      if (element.hasSupportingInfo()) {
53317        openArray("supportingInfo");
53318        for (Reference e : element.getSupportingInfo()) 
53319          composeReference(null, e);
53320        closeArray();
53321      };
53322      if (element.hasSpecimen()) {
53323        openArray("specimen");
53324        for (Reference e : element.getSpecimen()) 
53325          composeReference(null, e);
53326        closeArray();
53327      };
53328      if (element.hasBodySite()) {
53329        openArray("bodySite");
53330        for (CodeableConcept e : element.getBodySite()) 
53331          composeCodeableConcept(null, e);
53332        closeArray();
53333      };
53334      if (element.hasNote()) {
53335        openArray("note");
53336        for (Annotation e : element.getNote()) 
53337          composeAnnotation(null, e);
53338        closeArray();
53339      };
53340      if (element.hasPatientInstructionElement()) {
53341        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
53342        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
53343      }
53344      if (element.hasRelevantHistory()) {
53345        openArray("relevantHistory");
53346        for (Reference e : element.getRelevantHistory()) 
53347          composeReference(null, e);
53348        closeArray();
53349      };
53350  }
53351
53352  protected void composeSlot(String name, Slot element) throws IOException {
53353    if (element != null) {
53354      prop("resourceType", name);
53355      composeSlotInner(element);
53356    }
53357  }
53358
53359  protected void composeSlotInner(Slot element) throws IOException {
53360      composeDomainResourceElements(element);
53361      if (element.hasIdentifier()) {
53362        openArray("identifier");
53363        for (Identifier e : element.getIdentifier()) 
53364          composeIdentifier(null, e);
53365        closeArray();
53366      };
53367      if (element.hasServiceCategory()) {
53368        openArray("serviceCategory");
53369        for (CodeableConcept e : element.getServiceCategory()) 
53370          composeCodeableConcept(null, e);
53371        closeArray();
53372      };
53373      if (element.hasServiceType()) {
53374        openArray("serviceType");
53375        for (CodeableConcept e : element.getServiceType()) 
53376          composeCodeableConcept(null, e);
53377        closeArray();
53378      };
53379      if (element.hasSpecialty()) {
53380        openArray("specialty");
53381        for (CodeableConcept e : element.getSpecialty()) 
53382          composeCodeableConcept(null, e);
53383        closeArray();
53384      };
53385      if (element.hasAppointmentType()) {
53386        composeCodeableConcept("appointmentType", element.getAppointmentType());
53387      }
53388      if (element.hasSchedule()) {
53389        composeReference("schedule", element.getSchedule());
53390      }
53391      if (element.hasStatusElement()) {
53392        composeEnumerationCore("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
53393        composeEnumerationExtras("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
53394      }
53395      if (element.hasStartElement()) {
53396        composeInstantCore("start", element.getStartElement(), false);
53397        composeInstantExtras("start", element.getStartElement(), false);
53398      }
53399      if (element.hasEndElement()) {
53400        composeInstantCore("end", element.getEndElement(), false);
53401        composeInstantExtras("end", element.getEndElement(), false);
53402      }
53403      if (element.hasOverbookedElement()) {
53404        composeBooleanCore("overbooked", element.getOverbookedElement(), false);
53405        composeBooleanExtras("overbooked", element.getOverbookedElement(), false);
53406      }
53407      if (element.hasCommentElement()) {
53408        composeStringCore("comment", element.getCommentElement(), false);
53409        composeStringExtras("comment", element.getCommentElement(), false);
53410      }
53411  }
53412
53413  protected void composeSpecimen(String name, Specimen element) throws IOException {
53414    if (element != null) {
53415      prop("resourceType", name);
53416      composeSpecimenInner(element);
53417    }
53418  }
53419
53420  protected void composeSpecimenInner(Specimen element) throws IOException {
53421      composeDomainResourceElements(element);
53422      if (element.hasIdentifier()) {
53423        openArray("identifier");
53424        for (Identifier e : element.getIdentifier()) 
53425          composeIdentifier(null, e);
53426        closeArray();
53427      };
53428      if (element.hasAccessionIdentifier()) {
53429        composeIdentifier("accessionIdentifier", element.getAccessionIdentifier());
53430      }
53431      if (element.hasStatusElement()) {
53432        composeEnumerationCore("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
53433        composeEnumerationExtras("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
53434      }
53435      if (element.hasType()) {
53436        composeCodeableConcept("type", element.getType());
53437      }
53438      if (element.hasSubject()) {
53439        composeReference("subject", element.getSubject());
53440      }
53441      if (element.hasReceivedTimeElement()) {
53442        composeDateTimeCore("receivedTime", element.getReceivedTimeElement(), false);
53443        composeDateTimeExtras("receivedTime", element.getReceivedTimeElement(), false);
53444      }
53445      if (element.hasParent()) {
53446        openArray("parent");
53447        for (Reference e : element.getParent()) 
53448          composeReference(null, e);
53449        closeArray();
53450      };
53451      if (element.hasRequest()) {
53452        openArray("request");
53453        for (Reference e : element.getRequest()) 
53454          composeReference(null, e);
53455        closeArray();
53456      };
53457      if (element.hasCollection()) {
53458        composeSpecimenSpecimenCollectionComponent("collection", element.getCollection());
53459      }
53460      if (element.hasProcessing()) {
53461        openArray("processing");
53462        for (Specimen.SpecimenProcessingComponent e : element.getProcessing()) 
53463          composeSpecimenSpecimenProcessingComponent(null, e);
53464        closeArray();
53465      };
53466      if (element.hasContainer()) {
53467        openArray("container");
53468        for (Specimen.SpecimenContainerComponent e : element.getContainer()) 
53469          composeSpecimenSpecimenContainerComponent(null, e);
53470        closeArray();
53471      };
53472      if (element.hasCondition()) {
53473        openArray("condition");
53474        for (CodeableConcept e : element.getCondition()) 
53475          composeCodeableConcept(null, e);
53476        closeArray();
53477      };
53478      if (element.hasNote()) {
53479        openArray("note");
53480        for (Annotation e : element.getNote()) 
53481          composeAnnotation(null, e);
53482        closeArray();
53483      };
53484  }
53485
53486  protected void composeSpecimenSpecimenCollectionComponent(String name, Specimen.SpecimenCollectionComponent element) throws IOException {
53487    if (element != null) {
53488      open(name);
53489      composeSpecimenSpecimenCollectionComponentInner(element);
53490      close();
53491    }
53492  }
53493
53494  protected void composeSpecimenSpecimenCollectionComponentInner(Specimen.SpecimenCollectionComponent element) throws IOException {
53495      composeBackbone(element);
53496      if (element.hasCollector()) {
53497        composeReference("collector", element.getCollector());
53498      }
53499      if (element.hasCollected()) {
53500        composeType("collected", element.getCollected());
53501      }
53502      if (element.hasDuration()) {
53503        composeDuration("duration", element.getDuration());
53504      }
53505      if (element.hasQuantity()) {
53506        composeQuantity("quantity", element.getQuantity());
53507      }
53508      if (element.hasMethod()) {
53509        composeCodeableConcept("method", element.getMethod());
53510      }
53511      if (element.hasBodySite()) {
53512        composeCodeableConcept("bodySite", element.getBodySite());
53513      }
53514      if (element.hasFastingStatus()) {
53515        composeType("fastingStatus", element.getFastingStatus());
53516      }
53517  }
53518
53519  protected void composeSpecimenSpecimenProcessingComponent(String name, Specimen.SpecimenProcessingComponent element) throws IOException {
53520    if (element != null) {
53521      open(name);
53522      composeSpecimenSpecimenProcessingComponentInner(element);
53523      close();
53524    }
53525  }
53526
53527  protected void composeSpecimenSpecimenProcessingComponentInner(Specimen.SpecimenProcessingComponent element) throws IOException {
53528      composeBackbone(element);
53529      if (element.hasDescriptionElement()) {
53530        composeStringCore("description", element.getDescriptionElement(), false);
53531        composeStringExtras("description", element.getDescriptionElement(), false);
53532      }
53533      if (element.hasProcedure()) {
53534        composeCodeableConcept("procedure", element.getProcedure());
53535      }
53536      if (element.hasAdditive()) {
53537        openArray("additive");
53538        for (Reference e : element.getAdditive()) 
53539          composeReference(null, e);
53540        closeArray();
53541      };
53542      if (element.hasTime()) {
53543        composeType("time", element.getTime());
53544      }
53545  }
53546
53547  protected void composeSpecimenSpecimenContainerComponent(String name, Specimen.SpecimenContainerComponent element) throws IOException {
53548    if (element != null) {
53549      open(name);
53550      composeSpecimenSpecimenContainerComponentInner(element);
53551      close();
53552    }
53553  }
53554
53555  protected void composeSpecimenSpecimenContainerComponentInner(Specimen.SpecimenContainerComponent element) throws IOException {
53556      composeBackbone(element);
53557      if (element.hasIdentifier()) {
53558        openArray("identifier");
53559        for (Identifier e : element.getIdentifier()) 
53560          composeIdentifier(null, e);
53561        closeArray();
53562      };
53563      if (element.hasDescriptionElement()) {
53564        composeStringCore("description", element.getDescriptionElement(), false);
53565        composeStringExtras("description", element.getDescriptionElement(), false);
53566      }
53567      if (element.hasType()) {
53568        composeCodeableConcept("type", element.getType());
53569      }
53570      if (element.hasCapacity()) {
53571        composeQuantity("capacity", element.getCapacity());
53572      }
53573      if (element.hasSpecimenQuantity()) {
53574        composeQuantity("specimenQuantity", element.getSpecimenQuantity());
53575      }
53576      if (element.hasAdditive()) {
53577        composeType("additive", element.getAdditive());
53578      }
53579  }
53580
53581  protected void composeSpecimenDefinition(String name, SpecimenDefinition element) throws IOException {
53582    if (element != null) {
53583      prop("resourceType", name);
53584      composeSpecimenDefinitionInner(element);
53585    }
53586  }
53587
53588  protected void composeSpecimenDefinitionInner(SpecimenDefinition element) throws IOException {
53589      composeDomainResourceElements(element);
53590      if (element.hasIdentifier()) {
53591        composeIdentifier("identifier", element.getIdentifier());
53592      }
53593      if (element.hasTypeCollected()) {
53594        composeCodeableConcept("typeCollected", element.getTypeCollected());
53595      }
53596      if (element.hasPatientPreparation()) {
53597        openArray("patientPreparation");
53598        for (CodeableConcept e : element.getPatientPreparation()) 
53599          composeCodeableConcept(null, e);
53600        closeArray();
53601      };
53602      if (element.hasTimeAspectElement()) {
53603        composeStringCore("timeAspect", element.getTimeAspectElement(), false);
53604        composeStringExtras("timeAspect", element.getTimeAspectElement(), false);
53605      }
53606      if (element.hasCollection()) {
53607        openArray("collection");
53608        for (CodeableConcept e : element.getCollection()) 
53609          composeCodeableConcept(null, e);
53610        closeArray();
53611      };
53612      if (element.hasTypeTested()) {
53613        openArray("typeTested");
53614        for (SpecimenDefinition.SpecimenDefinitionTypeTestedComponent e : element.getTypeTested()) 
53615          composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(null, e);
53616        closeArray();
53617      };
53618  }
53619
53620  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
53621    if (element != null) {
53622      open(name);
53623      composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponentInner(element);
53624      close();
53625    }
53626  }
53627
53628  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
53629      composeBackbone(element);
53630      if (element.hasIsDerivedElement()) {
53631        composeBooleanCore("isDerived", element.getIsDerivedElement(), false);
53632        composeBooleanExtras("isDerived", element.getIsDerivedElement(), false);
53633      }
53634      if (element.hasType()) {
53635        composeCodeableConcept("type", element.getType());
53636      }
53637      if (element.hasPreferenceElement()) {
53638        composeEnumerationCore("preference", element.getPreferenceElement(), new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
53639        composeEnumerationExtras("preference", element.getPreferenceElement(), new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
53640      }
53641      if (element.hasContainer()) {
53642        composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent("container", element.getContainer());
53643      }
53644      if (element.hasRequirementElement()) {
53645        composeStringCore("requirement", element.getRequirementElement(), false);
53646        composeStringExtras("requirement", element.getRequirementElement(), false);
53647      }
53648      if (element.hasRetentionTime()) {
53649        composeDuration("retentionTime", element.getRetentionTime());
53650      }
53651      if (element.hasRejectionCriterion()) {
53652        openArray("rejectionCriterion");
53653        for (CodeableConcept e : element.getRejectionCriterion()) 
53654          composeCodeableConcept(null, e);
53655        closeArray();
53656      };
53657      if (element.hasHandling()) {
53658        openArray("handling");
53659        for (SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent e : element.getHandling()) 
53660          composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(null, e);
53661        closeArray();
53662      };
53663  }
53664
53665  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
53666    if (element != null) {
53667      open(name);
53668      composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentInner(element);
53669      close();
53670    }
53671  }
53672
53673  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
53674      composeBackbone(element);
53675      if (element.hasMaterial()) {
53676        composeCodeableConcept("material", element.getMaterial());
53677      }
53678      if (element.hasType()) {
53679        composeCodeableConcept("type", element.getType());
53680      }
53681      if (element.hasCap()) {
53682        composeCodeableConcept("cap", element.getCap());
53683      }
53684      if (element.hasDescriptionElement()) {
53685        composeStringCore("description", element.getDescriptionElement(), false);
53686        composeStringExtras("description", element.getDescriptionElement(), false);
53687      }
53688      if (element.hasCapacity()) {
53689        composeQuantity("capacity", element.getCapacity());
53690      }
53691      if (element.hasMinimumVolume()) {
53692        composeType("minimumVolume", element.getMinimumVolume());
53693      }
53694      if (element.hasAdditive()) {
53695        openArray("additive");
53696        for (SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent e : element.getAdditive()) 
53697          composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(null, e);
53698        closeArray();
53699      };
53700      if (element.hasPreparationElement()) {
53701        composeStringCore("preparation", element.getPreparationElement(), false);
53702        composeStringExtras("preparation", element.getPreparationElement(), false);
53703      }
53704  }
53705
53706  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
53707    if (element != null) {
53708      open(name);
53709      composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentInner(element);
53710      close();
53711    }
53712  }
53713
53714  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
53715      composeBackbone(element);
53716      if (element.hasAdditive()) {
53717        composeType("additive", element.getAdditive());
53718      }
53719  }
53720
53721  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
53722    if (element != null) {
53723      open(name);
53724      composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentInner(element);
53725      close();
53726    }
53727  }
53728
53729  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
53730      composeBackbone(element);
53731      if (element.hasTemperatureQualifier()) {
53732        composeCodeableConcept("temperatureQualifier", element.getTemperatureQualifier());
53733      }
53734      if (element.hasTemperatureRange()) {
53735        composeRange("temperatureRange", element.getTemperatureRange());
53736      }
53737      if (element.hasMaxDuration()) {
53738        composeDuration("maxDuration", element.getMaxDuration());
53739      }
53740      if (element.hasInstructionElement()) {
53741        composeStringCore("instruction", element.getInstructionElement(), false);
53742        composeStringExtras("instruction", element.getInstructionElement(), false);
53743      }
53744  }
53745
53746  protected void composeStructureDefinition(String name, StructureDefinition element) throws IOException {
53747    if (element != null) {
53748      prop("resourceType", name);
53749      composeStructureDefinitionInner(element);
53750    }
53751  }
53752
53753  protected void composeStructureDefinitionInner(StructureDefinition element) throws IOException {
53754      composeDomainResourceElements(element);
53755      if (element.hasUrlElement()) {
53756        composeUriCore("url", element.getUrlElement(), false);
53757        composeUriExtras("url", element.getUrlElement(), false);
53758      }
53759      if (element.hasIdentifier()) {
53760        openArray("identifier");
53761        for (Identifier e : element.getIdentifier()) 
53762          composeIdentifier(null, e);
53763        closeArray();
53764      };
53765      if (element.hasVersionElement()) {
53766        composeStringCore("version", element.getVersionElement(), false);
53767        composeStringExtras("version", element.getVersionElement(), false);
53768      }
53769      if (element.hasNameElement()) {
53770        composeStringCore("name", element.getNameElement(), false);
53771        composeStringExtras("name", element.getNameElement(), false);
53772      }
53773      if (element.hasTitleElement()) {
53774        composeStringCore("title", element.getTitleElement(), false);
53775        composeStringExtras("title", element.getTitleElement(), false);
53776      }
53777      if (element.hasStatusElement()) {
53778        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53779        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53780      }
53781      if (element.hasExperimentalElement()) {
53782        composeBooleanCore("experimental", element.getExperimentalElement(), false);
53783        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
53784      }
53785      if (element.hasDateElement()) {
53786        composeDateTimeCore("date", element.getDateElement(), false);
53787        composeDateTimeExtras("date", element.getDateElement(), false);
53788      }
53789      if (element.hasPublisherElement()) {
53790        composeStringCore("publisher", element.getPublisherElement(), false);
53791        composeStringExtras("publisher", element.getPublisherElement(), false);
53792      }
53793      if (element.hasContact()) {
53794        openArray("contact");
53795        for (ContactDetail e : element.getContact()) 
53796          composeContactDetail(null, e);
53797        closeArray();
53798      };
53799      if (element.hasDescriptionElement()) {
53800        composeMarkdownCore("description", element.getDescriptionElement(), false);
53801        composeMarkdownExtras("description", element.getDescriptionElement(), false);
53802      }
53803      if (element.hasUseContext()) {
53804        openArray("useContext");
53805        for (UsageContext e : element.getUseContext()) 
53806          composeUsageContext(null, e);
53807        closeArray();
53808      };
53809      if (element.hasJurisdiction()) {
53810        openArray("jurisdiction");
53811        for (CodeableConcept e : element.getJurisdiction()) 
53812          composeCodeableConcept(null, e);
53813        closeArray();
53814      };
53815      if (element.hasPurposeElement()) {
53816        composeMarkdownCore("purpose", element.getPurposeElement(), false);
53817        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
53818      }
53819      if (element.hasCopyrightElement()) {
53820        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
53821        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
53822      }
53823      if (element.hasKeyword()) {
53824        openArray("keyword");
53825        for (Coding e : element.getKeyword()) 
53826          composeCoding(null, e);
53827        closeArray();
53828      };
53829      if (element.hasFhirVersionElement()) {
53830        composeEnumerationCore("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
53831        composeEnumerationExtras("fhirVersion", element.getFhirVersionElement(), new Enumerations.FHIRVersionEnumFactory(), false);
53832      }
53833      if (element.hasMapping()) {
53834        openArray("mapping");
53835        for (StructureDefinition.StructureDefinitionMappingComponent e : element.getMapping()) 
53836          composeStructureDefinitionStructureDefinitionMappingComponent(null, e);
53837        closeArray();
53838      };
53839      if (element.hasKindElement()) {
53840        composeEnumerationCore("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
53841        composeEnumerationExtras("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
53842      }
53843      if (element.hasAbstractElement()) {
53844        composeBooleanCore("abstract", element.getAbstractElement(), false);
53845        composeBooleanExtras("abstract", element.getAbstractElement(), false);
53846      }
53847      if (element.hasContext()) {
53848        openArray("context");
53849        for (StructureDefinition.StructureDefinitionContextComponent e : element.getContext()) 
53850          composeStructureDefinitionStructureDefinitionContextComponent(null, e);
53851        closeArray();
53852      };
53853      if (element.hasContextInvariant()) {
53854        openArray("contextInvariant");
53855        for (StringType e : element.getContextInvariant()) 
53856          composeStringCore(null, e, true);
53857        closeArray();
53858        if (anyHasExtras(element.getContextInvariant())) {
53859          openArray("_contextInvariant");
53860          for (StringType e : element.getContextInvariant()) 
53861            composeStringExtras(null, e, true);
53862          closeArray();
53863        }
53864      };
53865      if (element.hasTypeElement()) {
53866        composeUriCore("type", element.getTypeElement(), false);
53867        composeUriExtras("type", element.getTypeElement(), false);
53868      }
53869      if (element.hasBaseDefinitionElement()) {
53870        composeCanonicalCore("baseDefinition", element.getBaseDefinitionElement(), false);
53871        composeCanonicalExtras("baseDefinition", element.getBaseDefinitionElement(), false);
53872      }
53873      if (element.hasDerivationElement()) {
53874        composeEnumerationCore("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
53875        composeEnumerationExtras("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
53876      }
53877      if (element.hasSnapshot()) {
53878        composeStructureDefinitionStructureDefinitionSnapshotComponent("snapshot", element.getSnapshot());
53879      }
53880      if (element.hasDifferential()) {
53881        composeStructureDefinitionStructureDefinitionDifferentialComponent("differential", element.getDifferential());
53882      }
53883  }
53884
53885  protected void composeStructureDefinitionStructureDefinitionMappingComponent(String name, StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
53886    if (element != null) {
53887      open(name);
53888      composeStructureDefinitionStructureDefinitionMappingComponentInner(element);
53889      close();
53890    }
53891  }
53892
53893  protected void composeStructureDefinitionStructureDefinitionMappingComponentInner(StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
53894      composeBackbone(element);
53895      if (element.hasIdentityElement()) {
53896        composeIdCore("identity", element.getIdentityElement(), false);
53897        composeIdExtras("identity", element.getIdentityElement(), false);
53898      }
53899      if (element.hasUriElement()) {
53900        composeUriCore("uri", element.getUriElement(), false);
53901        composeUriExtras("uri", element.getUriElement(), false);
53902      }
53903      if (element.hasNameElement()) {
53904        composeStringCore("name", element.getNameElement(), false);
53905        composeStringExtras("name", element.getNameElement(), false);
53906      }
53907      if (element.hasCommentElement()) {
53908        composeStringCore("comment", element.getCommentElement(), false);
53909        composeStringExtras("comment", element.getCommentElement(), false);
53910      }
53911  }
53912
53913  protected void composeStructureDefinitionStructureDefinitionContextComponent(String name, StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
53914    if (element != null) {
53915      open(name);
53916      composeStructureDefinitionStructureDefinitionContextComponentInner(element);
53917      close();
53918    }
53919  }
53920
53921  protected void composeStructureDefinitionStructureDefinitionContextComponentInner(StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
53922      composeBackbone(element);
53923      if (element.hasTypeElement()) {
53924        composeEnumerationCore("type", element.getTypeElement(), new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
53925        composeEnumerationExtras("type", element.getTypeElement(), new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
53926      }
53927      if (element.hasExpressionElement()) {
53928        composeStringCore("expression", element.getExpressionElement(), false);
53929        composeStringExtras("expression", element.getExpressionElement(), false);
53930      }
53931  }
53932
53933  protected void composeStructureDefinitionStructureDefinitionSnapshotComponent(String name, StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
53934    if (element != null) {
53935      open(name);
53936      composeStructureDefinitionStructureDefinitionSnapshotComponentInner(element);
53937      close();
53938    }
53939  }
53940
53941  protected void composeStructureDefinitionStructureDefinitionSnapshotComponentInner(StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
53942      composeBackbone(element);
53943      if (element.hasElement()) {
53944        openArray("element");
53945        for (ElementDefinition e : element.getElement()) 
53946          composeElementDefinition(null, e);
53947        closeArray();
53948      };
53949  }
53950
53951  protected void composeStructureDefinitionStructureDefinitionDifferentialComponent(String name, StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
53952    if (element != null) {
53953      open(name);
53954      composeStructureDefinitionStructureDefinitionDifferentialComponentInner(element);
53955      close();
53956    }
53957  }
53958
53959  protected void composeStructureDefinitionStructureDefinitionDifferentialComponentInner(StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
53960      composeBackbone(element);
53961      if (element.hasElement()) {
53962        openArray("element");
53963        for (ElementDefinition e : element.getElement()) 
53964          composeElementDefinition(null, e);
53965        closeArray();
53966      };
53967  }
53968
53969  protected void composeStructureMap(String name, StructureMap element) throws IOException {
53970    if (element != null) {
53971      prop("resourceType", name);
53972      composeStructureMapInner(element);
53973    }
53974  }
53975
53976  protected void composeStructureMapInner(StructureMap element) throws IOException {
53977      composeDomainResourceElements(element);
53978      if (element.hasUrlElement()) {
53979        composeUriCore("url", element.getUrlElement(), false);
53980        composeUriExtras("url", element.getUrlElement(), false);
53981      }
53982      if (element.hasIdentifier()) {
53983        openArray("identifier");
53984        for (Identifier e : element.getIdentifier()) 
53985          composeIdentifier(null, e);
53986        closeArray();
53987      };
53988      if (element.hasVersionElement()) {
53989        composeStringCore("version", element.getVersionElement(), false);
53990        composeStringExtras("version", element.getVersionElement(), false);
53991      }
53992      if (element.hasNameElement()) {
53993        composeStringCore("name", element.getNameElement(), false);
53994        composeStringExtras("name", element.getNameElement(), false);
53995      }
53996      if (element.hasTitleElement()) {
53997        composeStringCore("title", element.getTitleElement(), false);
53998        composeStringExtras("title", element.getTitleElement(), false);
53999      }
54000      if (element.hasStatusElement()) {
54001        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
54002        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
54003      }
54004      if (element.hasExperimentalElement()) {
54005        composeBooleanCore("experimental", element.getExperimentalElement(), false);
54006        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
54007      }
54008      if (element.hasDateElement()) {
54009        composeDateTimeCore("date", element.getDateElement(), false);
54010        composeDateTimeExtras("date", element.getDateElement(), false);
54011      }
54012      if (element.hasPublisherElement()) {
54013        composeStringCore("publisher", element.getPublisherElement(), false);
54014        composeStringExtras("publisher", element.getPublisherElement(), false);
54015      }
54016      if (element.hasContact()) {
54017        openArray("contact");
54018        for (ContactDetail e : element.getContact()) 
54019          composeContactDetail(null, e);
54020        closeArray();
54021      };
54022      if (element.hasDescriptionElement()) {
54023        composeMarkdownCore("description", element.getDescriptionElement(), false);
54024        composeMarkdownExtras("description", element.getDescriptionElement(), false);
54025      }
54026      if (element.hasUseContext()) {
54027        openArray("useContext");
54028        for (UsageContext e : element.getUseContext()) 
54029          composeUsageContext(null, e);
54030        closeArray();
54031      };
54032      if (element.hasJurisdiction()) {
54033        openArray("jurisdiction");
54034        for (CodeableConcept e : element.getJurisdiction()) 
54035          composeCodeableConcept(null, e);
54036        closeArray();
54037      };
54038      if (element.hasPurposeElement()) {
54039        composeMarkdownCore("purpose", element.getPurposeElement(), false);
54040        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
54041      }
54042      if (element.hasCopyrightElement()) {
54043        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
54044        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
54045      }
54046      if (element.hasStructure()) {
54047        openArray("structure");
54048        for (StructureMap.StructureMapStructureComponent e : element.getStructure()) 
54049          composeStructureMapStructureMapStructureComponent(null, e);
54050        closeArray();
54051      };
54052      if (element.hasImport()) {
54053        openArray("import");
54054        for (CanonicalType e : element.getImport()) 
54055          composeCanonicalCore(null, e, true);
54056        closeArray();
54057        if (anyHasExtras(element.getImport())) {
54058          openArray("_import");
54059          for (CanonicalType e : element.getImport()) 
54060            composeCanonicalExtras(null, e, true);
54061          closeArray();
54062        }
54063      };
54064      if (element.hasGroup()) {
54065        openArray("group");
54066        for (StructureMap.StructureMapGroupComponent e : element.getGroup()) 
54067          composeStructureMapStructureMapGroupComponent(null, e);
54068        closeArray();
54069      };
54070  }
54071
54072  protected void composeStructureMapStructureMapStructureComponent(String name, StructureMap.StructureMapStructureComponent element) throws IOException {
54073    if (element != null) {
54074      open(name);
54075      composeStructureMapStructureMapStructureComponentInner(element);
54076      close();
54077    }
54078  }
54079
54080  protected void composeStructureMapStructureMapStructureComponentInner(StructureMap.StructureMapStructureComponent element) throws IOException {
54081      composeBackbone(element);
54082      if (element.hasUrlElement()) {
54083        composeCanonicalCore("url", element.getUrlElement(), false);
54084        composeCanonicalExtras("url", element.getUrlElement(), false);
54085      }
54086      if (element.hasModeElement()) {
54087        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
54088        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
54089      }
54090      if (element.hasAliasElement()) {
54091        composeStringCore("alias", element.getAliasElement(), false);
54092        composeStringExtras("alias", element.getAliasElement(), false);
54093      }
54094      if (element.hasDocumentationElement()) {
54095        composeStringCore("documentation", element.getDocumentationElement(), false);
54096        composeStringExtras("documentation", element.getDocumentationElement(), false);
54097      }
54098  }
54099
54100  protected void composeStructureMapStructureMapGroupComponent(String name, StructureMap.StructureMapGroupComponent element) throws IOException {
54101    if (element != null) {
54102      open(name);
54103      composeStructureMapStructureMapGroupComponentInner(element);
54104      close();
54105    }
54106  }
54107
54108  protected void composeStructureMapStructureMapGroupComponentInner(StructureMap.StructureMapGroupComponent element) throws IOException {
54109      composeBackbone(element);
54110      if (element.hasNameElement()) {
54111        composeIdCore("name", element.getNameElement(), false);
54112        composeIdExtras("name", element.getNameElement(), false);
54113      }
54114      if (element.hasExtendsElement()) {
54115        composeIdCore("extends", element.getExtendsElement(), false);
54116        composeIdExtras("extends", element.getExtendsElement(), false);
54117      }
54118      if (element.hasTypeModeElement()) {
54119        composeEnumerationCore("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
54120        composeEnumerationExtras("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
54121      }
54122      if (element.hasDocumentationElement()) {
54123        composeStringCore("documentation", element.getDocumentationElement(), false);
54124        composeStringExtras("documentation", element.getDocumentationElement(), false);
54125      }
54126      if (element.hasInput()) {
54127        openArray("input");
54128        for (StructureMap.StructureMapGroupInputComponent e : element.getInput()) 
54129          composeStructureMapStructureMapGroupInputComponent(null, e);
54130        closeArray();
54131      };
54132      if (element.hasRule()) {
54133        openArray("rule");
54134        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
54135          composeStructureMapStructureMapGroupRuleComponent(null, e);
54136        closeArray();
54137      };
54138  }
54139
54140  protected void composeStructureMapStructureMapGroupInputComponent(String name, StructureMap.StructureMapGroupInputComponent element) throws IOException {
54141    if (element != null) {
54142      open(name);
54143      composeStructureMapStructureMapGroupInputComponentInner(element);
54144      close();
54145    }
54146  }
54147
54148  protected void composeStructureMapStructureMapGroupInputComponentInner(StructureMap.StructureMapGroupInputComponent element) throws IOException {
54149      composeBackbone(element);
54150      if (element.hasNameElement()) {
54151        composeIdCore("name", element.getNameElement(), false);
54152        composeIdExtras("name", element.getNameElement(), false);
54153      }
54154      if (element.hasTypeElement()) {
54155        composeStringCore("type", element.getTypeElement(), false);
54156        composeStringExtras("type", element.getTypeElement(), false);
54157      }
54158      if (element.hasModeElement()) {
54159        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
54160        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
54161      }
54162      if (element.hasDocumentationElement()) {
54163        composeStringCore("documentation", element.getDocumentationElement(), false);
54164        composeStringExtras("documentation", element.getDocumentationElement(), false);
54165      }
54166  }
54167
54168  protected void composeStructureMapStructureMapGroupRuleComponent(String name, StructureMap.StructureMapGroupRuleComponent element) throws IOException {
54169    if (element != null) {
54170      open(name);
54171      composeStructureMapStructureMapGroupRuleComponentInner(element);
54172      close();
54173    }
54174  }
54175
54176  protected void composeStructureMapStructureMapGroupRuleComponentInner(StructureMap.StructureMapGroupRuleComponent element) throws IOException {
54177      composeBackbone(element);
54178      if (element.hasNameElement()) {
54179        composeIdCore("name", element.getNameElement(), false);
54180        composeIdExtras("name", element.getNameElement(), false);
54181      }
54182      if (element.hasSource()) {
54183        openArray("source");
54184        for (StructureMap.StructureMapGroupRuleSourceComponent e : element.getSource()) 
54185          composeStructureMapStructureMapGroupRuleSourceComponent(null, e);
54186        closeArray();
54187      };
54188      if (element.hasTarget()) {
54189        openArray("target");
54190        for (StructureMap.StructureMapGroupRuleTargetComponent e : element.getTarget()) 
54191          composeStructureMapStructureMapGroupRuleTargetComponent(null, e);
54192        closeArray();
54193      };
54194      if (element.hasRule()) {
54195        openArray("rule");
54196        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
54197          composeStructureMapStructureMapGroupRuleComponent(null, e);
54198        closeArray();
54199      };
54200      if (element.hasDependent()) {
54201        openArray("dependent");
54202        for (StructureMap.StructureMapGroupRuleDependentComponent e : element.getDependent()) 
54203          composeStructureMapStructureMapGroupRuleDependentComponent(null, e);
54204        closeArray();
54205      };
54206      if (element.hasDocumentationElement()) {
54207        composeStringCore("documentation", element.getDocumentationElement(), false);
54208        composeStringExtras("documentation", element.getDocumentationElement(), false);
54209      }
54210  }
54211
54212  protected void composeStructureMapStructureMapGroupRuleSourceComponent(String name, StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
54213    if (element != null) {
54214      open(name);
54215      composeStructureMapStructureMapGroupRuleSourceComponentInner(element);
54216      close();
54217    }
54218  }
54219
54220  protected void composeStructureMapStructureMapGroupRuleSourceComponentInner(StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
54221      composeBackbone(element);
54222      if (element.hasContextElement()) {
54223        composeIdCore("context", element.getContextElement(), false);
54224        composeIdExtras("context", element.getContextElement(), false);
54225      }
54226      if (element.hasMinElement()) {
54227        composeIntegerCore("min", element.getMinElement(), false);
54228        composeIntegerExtras("min", element.getMinElement(), false);
54229      }
54230      if (element.hasMaxElement()) {
54231        composeStringCore("max", element.getMaxElement(), false);
54232        composeStringExtras("max", element.getMaxElement(), false);
54233      }
54234      if (element.hasTypeElement()) {
54235        composeStringCore("type", element.getTypeElement(), false);
54236        composeStringExtras("type", element.getTypeElement(), false);
54237      }
54238      if (element.hasDefaultValue()) {
54239        composeType("defaultValue", element.getDefaultValue());
54240      }
54241      if (element.hasElementElement()) {
54242        composeStringCore("element", element.getElementElement(), false);
54243        composeStringExtras("element", element.getElementElement(), false);
54244      }
54245      if (element.hasListModeElement()) {
54246        composeEnumerationCore("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
54247        composeEnumerationExtras("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
54248      }
54249      if (element.hasVariableElement()) {
54250        composeIdCore("variable", element.getVariableElement(), false);
54251        composeIdExtras("variable", element.getVariableElement(), false);
54252      }
54253      if (element.hasConditionElement()) {
54254        composeStringCore("condition", element.getConditionElement(), false);
54255        composeStringExtras("condition", element.getConditionElement(), false);
54256      }
54257      if (element.hasCheckElement()) {
54258        composeStringCore("check", element.getCheckElement(), false);
54259        composeStringExtras("check", element.getCheckElement(), false);
54260      }
54261      if (element.hasLogMessageElement()) {
54262        composeStringCore("logMessage", element.getLogMessageElement(), false);
54263        composeStringExtras("logMessage", element.getLogMessageElement(), false);
54264      }
54265  }
54266
54267  protected void composeStructureMapStructureMapGroupRuleTargetComponent(String name, StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
54268    if (element != null) {
54269      open(name);
54270      composeStructureMapStructureMapGroupRuleTargetComponentInner(element);
54271      close();
54272    }
54273  }
54274
54275  protected void composeStructureMapStructureMapGroupRuleTargetComponentInner(StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
54276      composeBackbone(element);
54277      if (element.hasContextElement()) {
54278        composeIdCore("context", element.getContextElement(), false);
54279        composeIdExtras("context", element.getContextElement(), false);
54280      }
54281      if (element.hasContextTypeElement()) {
54282        composeEnumerationCore("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
54283        composeEnumerationExtras("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
54284      }
54285      if (element.hasElementElement()) {
54286        composeStringCore("element", element.getElementElement(), false);
54287        composeStringExtras("element", element.getElementElement(), false);
54288      }
54289      if (element.hasVariableElement()) {
54290        composeIdCore("variable", element.getVariableElement(), false);
54291        composeIdExtras("variable", element.getVariableElement(), false);
54292      }
54293      if (element.hasListMode()) {
54294        openArray("listMode");
54295        for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
54296          composeEnumerationCore(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
54297        closeArray();
54298        if (anyHasExtras(element.getListMode())) {
54299          openArray("_listMode");
54300          for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
54301            composeEnumerationExtras(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
54302          closeArray();
54303        }
54304      };
54305      if (element.hasListRuleIdElement()) {
54306        composeIdCore("listRuleId", element.getListRuleIdElement(), false);
54307        composeIdExtras("listRuleId", element.getListRuleIdElement(), false);
54308      }
54309      if (element.hasTransformElement()) {
54310        composeEnumerationCore("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
54311        composeEnumerationExtras("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
54312      }
54313      if (element.hasParameter()) {
54314        openArray("parameter");
54315        for (StructureMap.StructureMapGroupRuleTargetParameterComponent e : element.getParameter()) 
54316          composeStructureMapStructureMapGroupRuleTargetParameterComponent(null, e);
54317        closeArray();
54318      };
54319  }
54320
54321  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponent(String name, StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
54322    if (element != null) {
54323      open(name);
54324      composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(element);
54325      close();
54326    }
54327  }
54328
54329  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
54330      composeBackbone(element);
54331      if (element.hasValue()) {
54332        composeType("value", element.getValue());
54333      }
54334  }
54335
54336  protected void composeStructureMapStructureMapGroupRuleDependentComponent(String name, StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
54337    if (element != null) {
54338      open(name);
54339      composeStructureMapStructureMapGroupRuleDependentComponentInner(element);
54340      close();
54341    }
54342  }
54343
54344  protected void composeStructureMapStructureMapGroupRuleDependentComponentInner(StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
54345      composeBackbone(element);
54346      if (element.hasNameElement()) {
54347        composeIdCore("name", element.getNameElement(), false);
54348        composeIdExtras("name", element.getNameElement(), false);
54349      }
54350      if (element.hasVariable()) {
54351        openArray("variable");
54352        for (StringType e : element.getVariable()) 
54353          composeStringCore(null, e, true);
54354        closeArray();
54355        if (anyHasExtras(element.getVariable())) {
54356          openArray("_variable");
54357          for (StringType e : element.getVariable()) 
54358            composeStringExtras(null, e, true);
54359          closeArray();
54360        }
54361      };
54362  }
54363
54364  protected void composeSubscription(String name, Subscription element) throws IOException {
54365    if (element != null) {
54366      prop("resourceType", name);
54367      composeSubscriptionInner(element);
54368    }
54369  }
54370
54371  protected void composeSubscriptionInner(Subscription element) throws IOException {
54372      composeDomainResourceElements(element);
54373      if (element.hasStatusElement()) {
54374        composeEnumerationCore("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
54375        composeEnumerationExtras("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
54376      }
54377      if (element.hasContact()) {
54378        openArray("contact");
54379        for (ContactPoint e : element.getContact()) 
54380          composeContactPoint(null, e);
54381        closeArray();
54382      };
54383      if (element.hasEndElement()) {
54384        composeInstantCore("end", element.getEndElement(), false);
54385        composeInstantExtras("end", element.getEndElement(), false);
54386      }
54387      if (element.hasReasonElement()) {
54388        composeStringCore("reason", element.getReasonElement(), false);
54389        composeStringExtras("reason", element.getReasonElement(), false);
54390      }
54391      if (element.hasCriteriaElement()) {
54392        composeStringCore("criteria", element.getCriteriaElement(), false);
54393        composeStringExtras("criteria", element.getCriteriaElement(), false);
54394      }
54395      if (element.hasErrorElement()) {
54396        composeStringCore("error", element.getErrorElement(), false);
54397        composeStringExtras("error", element.getErrorElement(), false);
54398      }
54399      if (element.hasChannel()) {
54400        composeSubscriptionSubscriptionChannelComponent("channel", element.getChannel());
54401      }
54402  }
54403
54404  protected void composeSubscriptionSubscriptionChannelComponent(String name, Subscription.SubscriptionChannelComponent element) throws IOException {
54405    if (element != null) {
54406      open(name);
54407      composeSubscriptionSubscriptionChannelComponentInner(element);
54408      close();
54409    }
54410  }
54411
54412  protected void composeSubscriptionSubscriptionChannelComponentInner(Subscription.SubscriptionChannelComponent element) throws IOException {
54413      composeBackbone(element);
54414      if (element.hasTypeElement()) {
54415        composeEnumerationCore("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
54416        composeEnumerationExtras("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
54417      }
54418      if (element.hasEndpointElement()) {
54419        composeUrlCore("endpoint", element.getEndpointElement(), false);
54420        composeUrlExtras("endpoint", element.getEndpointElement(), false);
54421      }
54422      if (element.hasPayloadElement()) {
54423        composeCodeCore("payload", element.getPayloadElement(), false);
54424        composeCodeExtras("payload", element.getPayloadElement(), false);
54425      }
54426      if (element.hasHeader()) {
54427        openArray("header");
54428        for (StringType e : element.getHeader()) 
54429          composeStringCore(null, e, true);
54430        closeArray();
54431        if (anyHasExtras(element.getHeader())) {
54432          openArray("_header");
54433          for (StringType e : element.getHeader()) 
54434            composeStringExtras(null, e, true);
54435          closeArray();
54436        }
54437      };
54438  }
54439
54440  protected void composeSubstance(String name, Substance element) throws IOException {
54441    if (element != null) {
54442      prop("resourceType", name);
54443      composeSubstanceInner(element);
54444    }
54445  }
54446
54447  protected void composeSubstanceInner(Substance element) throws IOException {
54448      composeDomainResourceElements(element);
54449      if (element.hasIdentifier()) {
54450        openArray("identifier");
54451        for (Identifier e : element.getIdentifier()) 
54452          composeIdentifier(null, e);
54453        closeArray();
54454      };
54455      if (element.hasStatusElement()) {
54456        composeEnumerationCore("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
54457        composeEnumerationExtras("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
54458      }
54459      if (element.hasCategory()) {
54460        openArray("category");
54461        for (CodeableConcept e : element.getCategory()) 
54462          composeCodeableConcept(null, e);
54463        closeArray();
54464      };
54465      if (element.hasCode()) {
54466        composeCodeableConcept("code", element.getCode());
54467      }
54468      if (element.hasDescriptionElement()) {
54469        composeStringCore("description", element.getDescriptionElement(), false);
54470        composeStringExtras("description", element.getDescriptionElement(), false);
54471      }
54472      if (element.hasInstance()) {
54473        openArray("instance");
54474        for (Substance.SubstanceInstanceComponent e : element.getInstance()) 
54475          composeSubstanceSubstanceInstanceComponent(null, e);
54476        closeArray();
54477      };
54478      if (element.hasIngredient()) {
54479        openArray("ingredient");
54480        for (Substance.SubstanceIngredientComponent e : element.getIngredient()) 
54481          composeSubstanceSubstanceIngredientComponent(null, e);
54482        closeArray();
54483      };
54484  }
54485
54486  protected void composeSubstanceSubstanceInstanceComponent(String name, Substance.SubstanceInstanceComponent element) throws IOException {
54487    if (element != null) {
54488      open(name);
54489      composeSubstanceSubstanceInstanceComponentInner(element);
54490      close();
54491    }
54492  }
54493
54494  protected void composeSubstanceSubstanceInstanceComponentInner(Substance.SubstanceInstanceComponent element) throws IOException {
54495      composeBackbone(element);
54496      if (element.hasIdentifier()) {
54497        composeIdentifier("identifier", element.getIdentifier());
54498      }
54499      if (element.hasExpiryElement()) {
54500        composeDateTimeCore("expiry", element.getExpiryElement(), false);
54501        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
54502      }
54503      if (element.hasQuantity()) {
54504        composeQuantity("quantity", element.getQuantity());
54505      }
54506  }
54507
54508  protected void composeSubstanceSubstanceIngredientComponent(String name, Substance.SubstanceIngredientComponent element) throws IOException {
54509    if (element != null) {
54510      open(name);
54511      composeSubstanceSubstanceIngredientComponentInner(element);
54512      close();
54513    }
54514  }
54515
54516  protected void composeSubstanceSubstanceIngredientComponentInner(Substance.SubstanceIngredientComponent element) throws IOException {
54517      composeBackbone(element);
54518      if (element.hasQuantity()) {
54519        composeRatio("quantity", element.getQuantity());
54520      }
54521      if (element.hasSubstance()) {
54522        composeType("substance", element.getSubstance());
54523      }
54524  }
54525
54526  protected void composeSubstanceNucleicAcid(String name, SubstanceNucleicAcid element) throws IOException {
54527    if (element != null) {
54528      prop("resourceType", name);
54529      composeSubstanceNucleicAcidInner(element);
54530    }
54531  }
54532
54533  protected void composeSubstanceNucleicAcidInner(SubstanceNucleicAcid element) throws IOException {
54534      composeDomainResourceElements(element);
54535      if (element.hasSequenceType()) {
54536        composeCodeableConcept("sequenceType", element.getSequenceType());
54537      }
54538      if (element.hasNumberOfSubunitsElement()) {
54539        composeIntegerCore("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
54540        composeIntegerExtras("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
54541      }
54542      if (element.hasAreaOfHybridisationElement()) {
54543        composeStringCore("areaOfHybridisation", element.getAreaOfHybridisationElement(), false);
54544        composeStringExtras("areaOfHybridisation", element.getAreaOfHybridisationElement(), false);
54545      }
54546      if (element.hasOligoNucleotideType()) {
54547        composeCodeableConcept("oligoNucleotideType", element.getOligoNucleotideType());
54548      }
54549      if (element.hasSubunit()) {
54550        openArray("subunit");
54551        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent e : element.getSubunit()) 
54552          composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(null, e);
54553        closeArray();
54554      };
54555  }
54556
54557  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent element) throws IOException {
54558    if (element != null) {
54559      open(name);
54560      composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentInner(element);
54561      close();
54562    }
54563  }
54564
54565  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitComponentInner(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent element) throws IOException {
54566      composeBackbone(element);
54567      if (element.hasSubunitElement()) {
54568        composeIntegerCore("subunit", element.getSubunitElement(), false);
54569        composeIntegerExtras("subunit", element.getSubunitElement(), false);
54570      }
54571      if (element.hasSequenceElement()) {
54572        composeStringCore("sequence", element.getSequenceElement(), false);
54573        composeStringExtras("sequence", element.getSequenceElement(), false);
54574      }
54575      if (element.hasLengthElement()) {
54576        composeIntegerCore("length", element.getLengthElement(), false);
54577        composeIntegerExtras("length", element.getLengthElement(), false);
54578      }
54579      if (element.hasSequenceAttachment()) {
54580        composeAttachment("sequenceAttachment", element.getSequenceAttachment());
54581      }
54582      if (element.hasFivePrime()) {
54583        composeCodeableConcept("fivePrime", element.getFivePrime());
54584      }
54585      if (element.hasThreePrime()) {
54586        composeCodeableConcept("threePrime", element.getThreePrime());
54587      }
54588      if (element.hasLinkage()) {
54589        openArray("linkage");
54590        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent e : element.getLinkage()) 
54591          composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(null, e);
54592        closeArray();
54593      };
54594      if (element.hasSugar()) {
54595        openArray("sugar");
54596        for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent e : element.getSugar()) 
54597          composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(null, e);
54598        closeArray();
54599      };
54600  }
54601
54602  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent element) throws IOException {
54603    if (element != null) {
54604      open(name);
54605      composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentInner(element);
54606      close();
54607    }
54608  }
54609
54610  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitLinkageComponentInner(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent element) throws IOException {
54611      composeBackbone(element);
54612      if (element.hasConnectivityElement()) {
54613        composeStringCore("connectivity", element.getConnectivityElement(), false);
54614        composeStringExtras("connectivity", element.getConnectivityElement(), false);
54615      }
54616      if (element.hasIdentifier()) {
54617        composeIdentifier("identifier", element.getIdentifier());
54618      }
54619      if (element.hasNameElement()) {
54620        composeStringCore("name", element.getNameElement(), false);
54621        composeStringExtras("name", element.getNameElement(), false);
54622      }
54623      if (element.hasResidueSiteElement()) {
54624        composeStringCore("residueSite", element.getResidueSiteElement(), false);
54625        composeStringExtras("residueSite", element.getResidueSiteElement(), false);
54626      }
54627  }
54628
54629  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent element) throws IOException {
54630    if (element != null) {
54631      open(name);
54632      composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentInner(element);
54633      close();
54634    }
54635  }
54636
54637  protected void composeSubstanceNucleicAcidSubstanceNucleicAcidSubunitSugarComponentInner(SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent element) throws IOException {
54638      composeBackbone(element);
54639      if (element.hasIdentifier()) {
54640        composeIdentifier("identifier", element.getIdentifier());
54641      }
54642      if (element.hasNameElement()) {
54643        composeStringCore("name", element.getNameElement(), false);
54644        composeStringExtras("name", element.getNameElement(), false);
54645      }
54646      if (element.hasResidueSiteElement()) {
54647        composeStringCore("residueSite", element.getResidueSiteElement(), false);
54648        composeStringExtras("residueSite", element.getResidueSiteElement(), false);
54649      }
54650  }
54651
54652  protected void composeSubstancePolymer(String name, SubstancePolymer element) throws IOException {
54653    if (element != null) {
54654      prop("resourceType", name);
54655      composeSubstancePolymerInner(element);
54656    }
54657  }
54658
54659  protected void composeSubstancePolymerInner(SubstancePolymer element) throws IOException {
54660      composeDomainResourceElements(element);
54661      if (element.hasClass_()) {
54662        composeCodeableConcept("class", element.getClass_());
54663      }
54664      if (element.hasGeometry()) {
54665        composeCodeableConcept("geometry", element.getGeometry());
54666      }
54667      if (element.hasCopolymerConnectivity()) {
54668        openArray("copolymerConnectivity");
54669        for (CodeableConcept e : element.getCopolymerConnectivity()) 
54670          composeCodeableConcept(null, e);
54671        closeArray();
54672      };
54673      if (element.hasModification()) {
54674        openArray("modification");
54675        for (StringType e : element.getModification()) 
54676          composeStringCore(null, e, true);
54677        closeArray();
54678        if (anyHasExtras(element.getModification())) {
54679          openArray("_modification");
54680          for (StringType e : element.getModification()) 
54681            composeStringExtras(null, e, true);
54682          closeArray();
54683        }
54684      };
54685      if (element.hasMonomerSet()) {
54686        openArray("monomerSet");
54687        for (SubstancePolymer.SubstancePolymerMonomerSetComponent e : element.getMonomerSet()) 
54688          composeSubstancePolymerSubstancePolymerMonomerSetComponent(null, e);
54689        closeArray();
54690      };
54691      if (element.hasRepeat()) {
54692        openArray("repeat");
54693        for (SubstancePolymer.SubstancePolymerRepeatComponent e : element.getRepeat()) 
54694          composeSubstancePolymerSubstancePolymerRepeatComponent(null, e);
54695        closeArray();
54696      };
54697  }
54698
54699  protected void composeSubstancePolymerSubstancePolymerMonomerSetComponent(String name, SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
54700    if (element != null) {
54701      open(name);
54702      composeSubstancePolymerSubstancePolymerMonomerSetComponentInner(element);
54703      close();
54704    }
54705  }
54706
54707  protected void composeSubstancePolymerSubstancePolymerMonomerSetComponentInner(SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
54708      composeBackbone(element);
54709      if (element.hasRatioType()) {
54710        composeCodeableConcept("ratioType", element.getRatioType());
54711      }
54712      if (element.hasStartingMaterial()) {
54713        openArray("startingMaterial");
54714        for (SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent e : element.getStartingMaterial()) 
54715          composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(null, e);
54716        closeArray();
54717      };
54718  }
54719
54720  protected void composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(String name, SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
54721    if (element != null) {
54722      open(name);
54723      composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentInner(element);
54724      close();
54725    }
54726  }
54727
54728  protected void composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentInner(SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
54729      composeBackbone(element);
54730      if (element.hasMaterial()) {
54731        composeCodeableConcept("material", element.getMaterial());
54732      }
54733      if (element.hasType()) {
54734        composeCodeableConcept("type", element.getType());
54735      }
54736      if (element.hasIsDefiningElement()) {
54737        composeBooleanCore("isDefining", element.getIsDefiningElement(), false);
54738        composeBooleanExtras("isDefining", element.getIsDefiningElement(), false);
54739      }
54740      if (element.hasAmount()) {
54741        composeSubstanceAmount("amount", element.getAmount());
54742      }
54743  }
54744
54745  protected void composeSubstancePolymerSubstancePolymerRepeatComponent(String name, SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
54746    if (element != null) {
54747      open(name);
54748      composeSubstancePolymerSubstancePolymerRepeatComponentInner(element);
54749      close();
54750    }
54751  }
54752
54753  protected void composeSubstancePolymerSubstancePolymerRepeatComponentInner(SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
54754      composeBackbone(element);
54755      if (element.hasNumberOfUnitsElement()) {
54756        composeIntegerCore("numberOfUnits", element.getNumberOfUnitsElement(), false);
54757        composeIntegerExtras("numberOfUnits", element.getNumberOfUnitsElement(), false);
54758      }
54759      if (element.hasAverageMolecularFormulaElement()) {
54760        composeStringCore("averageMolecularFormula", element.getAverageMolecularFormulaElement(), false);
54761        composeStringExtras("averageMolecularFormula", element.getAverageMolecularFormulaElement(), false);
54762      }
54763      if (element.hasRepeatUnitAmountType()) {
54764        composeCodeableConcept("repeatUnitAmountType", element.getRepeatUnitAmountType());
54765      }
54766      if (element.hasRepeatUnit()) {
54767        openArray("repeatUnit");
54768        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent e : element.getRepeatUnit()) 
54769          composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(null, e);
54770        closeArray();
54771      };
54772  }
54773
54774  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
54775    if (element != null) {
54776      open(name);
54777      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentInner(element);
54778      close();
54779    }
54780  }
54781
54782  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentInner(SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
54783      composeBackbone(element);
54784      if (element.hasOrientationOfPolymerisation()) {
54785        composeCodeableConcept("orientationOfPolymerisation", element.getOrientationOfPolymerisation());
54786      }
54787      if (element.hasRepeatUnitElement()) {
54788        composeStringCore("repeatUnit", element.getRepeatUnitElement(), false);
54789        composeStringExtras("repeatUnit", element.getRepeatUnitElement(), false);
54790      }
54791      if (element.hasAmount()) {
54792        composeSubstanceAmount("amount", element.getAmount());
54793      }
54794      if (element.hasDegreeOfPolymerisation()) {
54795        openArray("degreeOfPolymerisation");
54796        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent e : element.getDegreeOfPolymerisation()) 
54797          composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(null, e);
54798        closeArray();
54799      };
54800      if (element.hasStructuralRepresentation()) {
54801        openArray("structuralRepresentation");
54802        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent e : element.getStructuralRepresentation()) 
54803          composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(null, e);
54804        closeArray();
54805      };
54806  }
54807
54808  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
54809    if (element != null) {
54810      open(name);
54811      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentInner(element);
54812      close();
54813    }
54814  }
54815
54816  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentInner(SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
54817      composeBackbone(element);
54818      if (element.hasDegree()) {
54819        composeCodeableConcept("degree", element.getDegree());
54820      }
54821      if (element.hasAmount()) {
54822        composeSubstanceAmount("amount", element.getAmount());
54823      }
54824  }
54825
54826  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
54827    if (element != null) {
54828      open(name);
54829      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentInner(element);
54830      close();
54831    }
54832  }
54833
54834  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentInner(SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
54835      composeBackbone(element);
54836      if (element.hasType()) {
54837        composeCodeableConcept("type", element.getType());
54838      }
54839      if (element.hasRepresentationElement()) {
54840        composeStringCore("representation", element.getRepresentationElement(), false);
54841        composeStringExtras("representation", element.getRepresentationElement(), false);
54842      }
54843      if (element.hasAttachment()) {
54844        composeAttachment("attachment", element.getAttachment());
54845      }
54846  }
54847
54848  protected void composeSubstanceProtein(String name, SubstanceProtein element) throws IOException {
54849    if (element != null) {
54850      prop("resourceType", name);
54851      composeSubstanceProteinInner(element);
54852    }
54853  }
54854
54855  protected void composeSubstanceProteinInner(SubstanceProtein element) throws IOException {
54856      composeDomainResourceElements(element);
54857      if (element.hasSequenceType()) {
54858        composeCodeableConcept("sequenceType", element.getSequenceType());
54859      }
54860      if (element.hasNumberOfSubunitsElement()) {
54861        composeIntegerCore("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
54862        composeIntegerExtras("numberOfSubunits", element.getNumberOfSubunitsElement(), false);
54863      }
54864      if (element.hasDisulfideLinkage()) {
54865        openArray("disulfideLinkage");
54866        for (StringType e : element.getDisulfideLinkage()) 
54867          composeStringCore(null, e, true);
54868        closeArray();
54869        if (anyHasExtras(element.getDisulfideLinkage())) {
54870          openArray("_disulfideLinkage");
54871          for (StringType e : element.getDisulfideLinkage()) 
54872            composeStringExtras(null, e, true);
54873          closeArray();
54874        }
54875      };
54876      if (element.hasSubunit()) {
54877        openArray("subunit");
54878        for (SubstanceProtein.SubstanceProteinSubunitComponent e : element.getSubunit()) 
54879          composeSubstanceProteinSubstanceProteinSubunitComponent(null, e);
54880        closeArray();
54881      };
54882  }
54883
54884  protected void composeSubstanceProteinSubstanceProteinSubunitComponent(String name, SubstanceProtein.SubstanceProteinSubunitComponent element) throws IOException {
54885    if (element != null) {
54886      open(name);
54887      composeSubstanceProteinSubstanceProteinSubunitComponentInner(element);
54888      close();
54889    }
54890  }
54891
54892  protected void composeSubstanceProteinSubstanceProteinSubunitComponentInner(SubstanceProtein.SubstanceProteinSubunitComponent element) throws IOException {
54893      composeBackbone(element);
54894      if (element.hasSubunitElement()) {
54895        composeIntegerCore("subunit", element.getSubunitElement(), false);
54896        composeIntegerExtras("subunit", element.getSubunitElement(), false);
54897      }
54898      if (element.hasSequenceElement()) {
54899        composeStringCore("sequence", element.getSequenceElement(), false);
54900        composeStringExtras("sequence", element.getSequenceElement(), false);
54901      }
54902      if (element.hasLengthElement()) {
54903        composeIntegerCore("length", element.getLengthElement(), false);
54904        composeIntegerExtras("length", element.getLengthElement(), false);
54905      }
54906      if (element.hasSequenceAttachment()) {
54907        composeAttachment("sequenceAttachment", element.getSequenceAttachment());
54908      }
54909      if (element.hasNTerminalModificationId()) {
54910        composeIdentifier("nTerminalModificationId", element.getNTerminalModificationId());
54911      }
54912      if (element.hasNTerminalModificationElement()) {
54913        composeStringCore("nTerminalModification", element.getNTerminalModificationElement(), false);
54914        composeStringExtras("nTerminalModification", element.getNTerminalModificationElement(), false);
54915      }
54916      if (element.hasCTerminalModificationId()) {
54917        composeIdentifier("cTerminalModificationId", element.getCTerminalModificationId());
54918      }
54919      if (element.hasCTerminalModificationElement()) {
54920        composeStringCore("cTerminalModification", element.getCTerminalModificationElement(), false);
54921        composeStringExtras("cTerminalModification", element.getCTerminalModificationElement(), false);
54922      }
54923  }
54924
54925  protected void composeSubstanceReferenceInformation(String name, SubstanceReferenceInformation element) throws IOException {
54926    if (element != null) {
54927      prop("resourceType", name);
54928      composeSubstanceReferenceInformationInner(element);
54929    }
54930  }
54931
54932  protected void composeSubstanceReferenceInformationInner(SubstanceReferenceInformation element) throws IOException {
54933      composeDomainResourceElements(element);
54934      if (element.hasCommentElement()) {
54935        composeStringCore("comment", element.getCommentElement(), false);
54936        composeStringExtras("comment", element.getCommentElement(), false);
54937      }
54938      if (element.hasGene()) {
54939        openArray("gene");
54940        for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent e : element.getGene()) 
54941          composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(null, e);
54942        closeArray();
54943      };
54944      if (element.hasGeneElement()) {
54945        openArray("geneElement");
54946        for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent e : element.getGeneElement()) 
54947          composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(null, e);
54948        closeArray();
54949      };
54950      if (element.hasClassification()) {
54951        openArray("classification");
54952        for (SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent e : element.getClassification()) 
54953          composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(null, e);
54954        closeArray();
54955      };
54956      if (element.hasTarget()) {
54957        openArray("target");
54958        for (SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent e : element.getTarget()) 
54959          composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(null, e);
54960        closeArray();
54961      };
54962  }
54963
54964  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
54965    if (element != null) {
54966      open(name);
54967      composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentInner(element);
54968      close();
54969    }
54970  }
54971
54972  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
54973      composeBackbone(element);
54974      if (element.hasGeneSequenceOrigin()) {
54975        composeCodeableConcept("geneSequenceOrigin", element.getGeneSequenceOrigin());
54976      }
54977      if (element.hasGene()) {
54978        composeCodeableConcept("gene", element.getGene());
54979      }
54980      if (element.hasSource()) {
54981        openArray("source");
54982        for (Reference e : element.getSource()) 
54983          composeReference(null, e);
54984        closeArray();
54985      };
54986  }
54987
54988  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
54989    if (element != null) {
54990      open(name);
54991      composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentInner(element);
54992      close();
54993    }
54994  }
54995
54996  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
54997      composeBackbone(element);
54998      if (element.hasType()) {
54999        composeCodeableConcept("type", element.getType());
55000      }
55001      if (element.hasElement()) {
55002        composeIdentifier("element", element.getElement());
55003      }
55004      if (element.hasSource()) {
55005        openArray("source");
55006        for (Reference e : element.getSource()) 
55007          composeReference(null, e);
55008        closeArray();
55009      };
55010  }
55011
55012  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent element) throws IOException {
55013    if (element != null) {
55014      open(name);
55015      composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentInner(element);
55016      close();
55017    }
55018  }
55019
55020  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent element) throws IOException {
55021      composeBackbone(element);
55022      if (element.hasDomain()) {
55023        composeCodeableConcept("domain", element.getDomain());
55024      }
55025      if (element.hasClassification()) {
55026        composeCodeableConcept("classification", element.getClassification());
55027      }
55028      if (element.hasSubtype()) {
55029        openArray("subtype");
55030        for (CodeableConcept e : element.getSubtype()) 
55031          composeCodeableConcept(null, e);
55032        closeArray();
55033      };
55034      if (element.hasSource()) {
55035        openArray("source");
55036        for (Reference e : element.getSource()) 
55037          composeReference(null, e);
55038        closeArray();
55039      };
55040  }
55041
55042  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
55043    if (element != null) {
55044      open(name);
55045      composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentInner(element);
55046      close();
55047    }
55048  }
55049
55050  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
55051      composeBackbone(element);
55052      if (element.hasTarget()) {
55053        composeIdentifier("target", element.getTarget());
55054      }
55055      if (element.hasType()) {
55056        composeCodeableConcept("type", element.getType());
55057      }
55058      if (element.hasInteraction()) {
55059        composeCodeableConcept("interaction", element.getInteraction());
55060      }
55061      if (element.hasOrganism()) {
55062        composeCodeableConcept("organism", element.getOrganism());
55063      }
55064      if (element.hasOrganismType()) {
55065        composeCodeableConcept("organismType", element.getOrganismType());
55066      }
55067      if (element.hasAmount()) {
55068        composeType("amount", element.getAmount());
55069      }
55070      if (element.hasAmountType()) {
55071        composeCodeableConcept("amountType", element.getAmountType());
55072      }
55073      if (element.hasSource()) {
55074        openArray("source");
55075        for (Reference e : element.getSource()) 
55076          composeReference(null, e);
55077        closeArray();
55078      };
55079  }
55080
55081  protected void composeSubstanceSourceMaterial(String name, SubstanceSourceMaterial element) throws IOException {
55082    if (element != null) {
55083      prop("resourceType", name);
55084      composeSubstanceSourceMaterialInner(element);
55085    }
55086  }
55087
55088  protected void composeSubstanceSourceMaterialInner(SubstanceSourceMaterial element) throws IOException {
55089      composeDomainResourceElements(element);
55090      if (element.hasSourceMaterialClass()) {
55091        composeCodeableConcept("sourceMaterialClass", element.getSourceMaterialClass());
55092      }
55093      if (element.hasSourceMaterialType()) {
55094        composeCodeableConcept("sourceMaterialType", element.getSourceMaterialType());
55095      }
55096      if (element.hasSourceMaterialState()) {
55097        composeCodeableConcept("sourceMaterialState", element.getSourceMaterialState());
55098      }
55099      if (element.hasOrganismId()) {
55100        composeIdentifier("organismId", element.getOrganismId());
55101      }
55102      if (element.hasOrganismNameElement()) {
55103        composeStringCore("organismName", element.getOrganismNameElement(), false);
55104        composeStringExtras("organismName", element.getOrganismNameElement(), false);
55105      }
55106      if (element.hasParentSubstanceId()) {
55107        openArray("parentSubstanceId");
55108        for (Identifier e : element.getParentSubstanceId()) 
55109          composeIdentifier(null, e);
55110        closeArray();
55111      };
55112      if (element.hasParentSubstanceName()) {
55113        openArray("parentSubstanceName");
55114        for (StringType e : element.getParentSubstanceName()) 
55115          composeStringCore(null, e, true);
55116        closeArray();
55117        if (anyHasExtras(element.getParentSubstanceName())) {
55118          openArray("_parentSubstanceName");
55119          for (StringType e : element.getParentSubstanceName()) 
55120            composeStringExtras(null, e, true);
55121          closeArray();
55122        }
55123      };
55124      if (element.hasCountryOfOrigin()) {
55125        openArray("countryOfOrigin");
55126        for (CodeableConcept e : element.getCountryOfOrigin()) 
55127          composeCodeableConcept(null, e);
55128        closeArray();
55129      };
55130      if (element.hasGeographicalLocation()) {
55131        openArray("geographicalLocation");
55132        for (StringType e : element.getGeographicalLocation()) 
55133          composeStringCore(null, e, true);
55134        closeArray();
55135        if (anyHasExtras(element.getGeographicalLocation())) {
55136          openArray("_geographicalLocation");
55137          for (StringType e : element.getGeographicalLocation()) 
55138            composeStringExtras(null, e, true);
55139          closeArray();
55140        }
55141      };
55142      if (element.hasDevelopmentStage()) {
55143        composeCodeableConcept("developmentStage", element.getDevelopmentStage());
55144      }
55145      if (element.hasFractionDescription()) {
55146        openArray("fractionDescription");
55147        for (SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent e : element.getFractionDescription()) 
55148          composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(null, e);
55149        closeArray();
55150      };
55151      if (element.hasOrganism()) {
55152        composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent("organism", element.getOrganism());
55153      }
55154      if (element.hasPartDescription()) {
55155        openArray("partDescription");
55156        for (SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent e : element.getPartDescription()) 
55157          composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(null, e);
55158        closeArray();
55159      };
55160  }
55161
55162  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent element) throws IOException {
55163    if (element != null) {
55164      open(name);
55165      composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentInner(element);
55166      close();
55167    }
55168  }
55169
55170  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialFractionDescriptionComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent element) throws IOException {
55171      composeBackbone(element);
55172      if (element.hasFractionElement()) {
55173        composeStringCore("fraction", element.getFractionElement(), false);
55174        composeStringExtras("fraction", element.getFractionElement(), false);
55175      }
55176      if (element.hasMaterialType()) {
55177        composeCodeableConcept("materialType", element.getMaterialType());
55178      }
55179  }
55180
55181  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent element) throws IOException {
55182    if (element != null) {
55183      open(name);
55184      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentInner(element);
55185      close();
55186    }
55187  }
55188
55189  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent element) throws IOException {
55190      composeBackbone(element);
55191      if (element.hasFamily()) {
55192        composeCodeableConcept("family", element.getFamily());
55193      }
55194      if (element.hasGenus()) {
55195        composeCodeableConcept("genus", element.getGenus());
55196      }
55197      if (element.hasSpecies()) {
55198        composeCodeableConcept("species", element.getSpecies());
55199      }
55200      if (element.hasIntraspecificType()) {
55201        composeCodeableConcept("intraspecificType", element.getIntraspecificType());
55202      }
55203      if (element.hasIntraspecificDescriptionElement()) {
55204        composeStringCore("intraspecificDescription", element.getIntraspecificDescriptionElement(), false);
55205        composeStringExtras("intraspecificDescription", element.getIntraspecificDescriptionElement(), false);
55206      }
55207      if (element.hasAuthor()) {
55208        openArray("author");
55209        for (SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent e : element.getAuthor()) 
55210          composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(null, e);
55211        closeArray();
55212      };
55213      if (element.hasHybrid()) {
55214        composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent("hybrid", element.getHybrid());
55215      }
55216      if (element.hasOrganismGeneral()) {
55217        composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent("organismGeneral", element.getOrganismGeneral());
55218      }
55219  }
55220
55221  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent element) throws IOException {
55222    if (element != null) {
55223      open(name);
55224      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentInner(element);
55225      close();
55226    }
55227  }
55228
55229  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismAuthorComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent element) throws IOException {
55230      composeBackbone(element);
55231      if (element.hasAuthorType()) {
55232        composeCodeableConcept("authorType", element.getAuthorType());
55233      }
55234      if (element.hasAuthorDescriptionElement()) {
55235        composeStringCore("authorDescription", element.getAuthorDescriptionElement(), false);
55236        composeStringExtras("authorDescription", element.getAuthorDescriptionElement(), false);
55237      }
55238  }
55239
55240  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent element) throws IOException {
55241    if (element != null) {
55242      open(name);
55243      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentInner(element);
55244      close();
55245    }
55246  }
55247
55248  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismHybridComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent element) throws IOException {
55249      composeBackbone(element);
55250      if (element.hasMaternalOrganismIdElement()) {
55251        composeStringCore("maternalOrganismId", element.getMaternalOrganismIdElement(), false);
55252        composeStringExtras("maternalOrganismId", element.getMaternalOrganismIdElement(), false);
55253      }
55254      if (element.hasMaternalOrganismNameElement()) {
55255        composeStringCore("maternalOrganismName", element.getMaternalOrganismNameElement(), false);
55256        composeStringExtras("maternalOrganismName", element.getMaternalOrganismNameElement(), false);
55257      }
55258      if (element.hasPaternalOrganismIdElement()) {
55259        composeStringCore("paternalOrganismId", element.getPaternalOrganismIdElement(), false);
55260        composeStringExtras("paternalOrganismId", element.getPaternalOrganismIdElement(), false);
55261      }
55262      if (element.hasPaternalOrganismNameElement()) {
55263        composeStringCore("paternalOrganismName", element.getPaternalOrganismNameElement(), false);
55264        composeStringExtras("paternalOrganismName", element.getPaternalOrganismNameElement(), false);
55265      }
55266      if (element.hasHybridType()) {
55267        composeCodeableConcept("hybridType", element.getHybridType());
55268      }
55269  }
55270
55271  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent element) throws IOException {
55272    if (element != null) {
55273      open(name);
55274      composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentInner(element);
55275      close();
55276    }
55277  }
55278
55279  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialOrganismOrganismGeneralComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent element) throws IOException {
55280      composeBackbone(element);
55281      if (element.hasKingdom()) {
55282        composeCodeableConcept("kingdom", element.getKingdom());
55283      }
55284      if (element.hasPhylum()) {
55285        composeCodeableConcept("phylum", element.getPhylum());
55286      }
55287      if (element.hasClass_()) {
55288        composeCodeableConcept("class", element.getClass_());
55289      }
55290      if (element.hasOrder()) {
55291        composeCodeableConcept("order", element.getOrder());
55292      }
55293  }
55294
55295  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent element) throws IOException {
55296    if (element != null) {
55297      open(name);
55298      composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentInner(element);
55299      close();
55300    }
55301  }
55302
55303  protected void composeSubstanceSourceMaterialSubstanceSourceMaterialPartDescriptionComponentInner(SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent element) throws IOException {
55304      composeBackbone(element);
55305      if (element.hasPart()) {
55306        composeCodeableConcept("part", element.getPart());
55307      }
55308      if (element.hasPartLocation()) {
55309        composeCodeableConcept("partLocation", element.getPartLocation());
55310      }
55311  }
55312
55313  protected void composeSubstanceSpecification(String name, SubstanceSpecification element) throws IOException {
55314    if (element != null) {
55315      prop("resourceType", name);
55316      composeSubstanceSpecificationInner(element);
55317    }
55318  }
55319
55320  protected void composeSubstanceSpecificationInner(SubstanceSpecification element) throws IOException {
55321      composeDomainResourceElements(element);
55322      if (element.hasIdentifier()) {
55323        composeIdentifier("identifier", element.getIdentifier());
55324      }
55325      if (element.hasType()) {
55326        composeCodeableConcept("type", element.getType());
55327      }
55328      if (element.hasStatus()) {
55329        composeCodeableConcept("status", element.getStatus());
55330      }
55331      if (element.hasDomain()) {
55332        composeCodeableConcept("domain", element.getDomain());
55333      }
55334      if (element.hasDescriptionElement()) {
55335        composeStringCore("description", element.getDescriptionElement(), false);
55336        composeStringExtras("description", element.getDescriptionElement(), false);
55337      }
55338      if (element.hasSource()) {
55339        openArray("source");
55340        for (Reference e : element.getSource()) 
55341          composeReference(null, e);
55342        closeArray();
55343      };
55344      if (element.hasCommentElement()) {
55345        composeStringCore("comment", element.getCommentElement(), false);
55346        composeStringExtras("comment", element.getCommentElement(), false);
55347      }
55348      if (element.hasMoiety()) {
55349        openArray("moiety");
55350        for (SubstanceSpecification.SubstanceSpecificationMoietyComponent e : element.getMoiety()) 
55351          composeSubstanceSpecificationSubstanceSpecificationMoietyComponent(null, e);
55352        closeArray();
55353      };
55354      if (element.hasProperty()) {
55355        openArray("property");
55356        for (SubstanceSpecification.SubstanceSpecificationPropertyComponent e : element.getProperty()) 
55357          composeSubstanceSpecificationSubstanceSpecificationPropertyComponent(null, e);
55358        closeArray();
55359      };
55360      if (element.hasReferenceInformation()) {
55361        composeReference("referenceInformation", element.getReferenceInformation());
55362      }
55363      if (element.hasStructure()) {
55364        composeSubstanceSpecificationSubstanceSpecificationStructureComponent("structure", element.getStructure());
55365      }
55366      if (element.hasCode()) {
55367        openArray("code");
55368        for (SubstanceSpecification.SubstanceSpecificationCodeComponent e : element.getCode()) 
55369          composeSubstanceSpecificationSubstanceSpecificationCodeComponent(null, e);
55370        closeArray();
55371      };
55372      if (element.hasName()) {
55373        openArray("name");
55374        for (SubstanceSpecification.SubstanceSpecificationNameComponent e : element.getName()) 
55375          composeSubstanceSpecificationSubstanceSpecificationNameComponent(null, e);
55376        closeArray();
55377      };
55378      if (element.hasMolecularWeight()) {
55379        openArray("molecularWeight");
55380        for (SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent e : element.getMolecularWeight()) 
55381          composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(null, e);
55382        closeArray();
55383      };
55384      if (element.hasRelationship()) {
55385        openArray("relationship");
55386        for (SubstanceSpecification.SubstanceSpecificationRelationshipComponent e : element.getRelationship()) 
55387          composeSubstanceSpecificationSubstanceSpecificationRelationshipComponent(null, e);
55388        closeArray();
55389      };
55390      if (element.hasNucleicAcid()) {
55391        composeReference("nucleicAcid", element.getNucleicAcid());
55392      }
55393      if (element.hasPolymer()) {
55394        composeReference("polymer", element.getPolymer());
55395      }
55396      if (element.hasProtein()) {
55397        composeReference("protein", element.getProtein());
55398      }
55399      if (element.hasSourceMaterial()) {
55400        composeReference("sourceMaterial", element.getSourceMaterial());
55401      }
55402  }
55403
55404  protected void composeSubstanceSpecificationSubstanceSpecificationMoietyComponent(String name, SubstanceSpecification.SubstanceSpecificationMoietyComponent element) throws IOException {
55405    if (element != null) {
55406      open(name);
55407      composeSubstanceSpecificationSubstanceSpecificationMoietyComponentInner(element);
55408      close();
55409    }
55410  }
55411
55412  protected void composeSubstanceSpecificationSubstanceSpecificationMoietyComponentInner(SubstanceSpecification.SubstanceSpecificationMoietyComponent element) throws IOException {
55413      composeBackbone(element);
55414      if (element.hasRole()) {
55415        composeCodeableConcept("role", element.getRole());
55416      }
55417      if (element.hasIdentifier()) {
55418        composeIdentifier("identifier", element.getIdentifier());
55419      }
55420      if (element.hasNameElement()) {
55421        composeStringCore("name", element.getNameElement(), false);
55422        composeStringExtras("name", element.getNameElement(), false);
55423      }
55424      if (element.hasStereochemistry()) {
55425        composeCodeableConcept("stereochemistry", element.getStereochemistry());
55426      }
55427      if (element.hasOpticalActivity()) {
55428        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
55429      }
55430      if (element.hasMolecularFormulaElement()) {
55431        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
55432        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
55433      }
55434      if (element.hasAmount()) {
55435        composeType("amount", element.getAmount());
55436      }
55437  }
55438
55439  protected void composeSubstanceSpecificationSubstanceSpecificationPropertyComponent(String name, SubstanceSpecification.SubstanceSpecificationPropertyComponent element) throws IOException {
55440    if (element != null) {
55441      open(name);
55442      composeSubstanceSpecificationSubstanceSpecificationPropertyComponentInner(element);
55443      close();
55444    }
55445  }
55446
55447  protected void composeSubstanceSpecificationSubstanceSpecificationPropertyComponentInner(SubstanceSpecification.SubstanceSpecificationPropertyComponent element) throws IOException {
55448      composeBackbone(element);
55449      if (element.hasCategory()) {
55450        composeCodeableConcept("category", element.getCategory());
55451      }
55452      if (element.hasCode()) {
55453        composeCodeableConcept("code", element.getCode());
55454      }
55455      if (element.hasParametersElement()) {
55456        composeStringCore("parameters", element.getParametersElement(), false);
55457        composeStringExtras("parameters", element.getParametersElement(), false);
55458      }
55459      if (element.hasDefiningSubstance()) {
55460        composeType("definingSubstance", element.getDefiningSubstance());
55461      }
55462      if (element.hasAmount()) {
55463        composeType("amount", element.getAmount());
55464      }
55465  }
55466
55467  protected void composeSubstanceSpecificationSubstanceSpecificationStructureComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureComponent element) throws IOException {
55468    if (element != null) {
55469      open(name);
55470      composeSubstanceSpecificationSubstanceSpecificationStructureComponentInner(element);
55471      close();
55472    }
55473  }
55474
55475  protected void composeSubstanceSpecificationSubstanceSpecificationStructureComponentInner(SubstanceSpecification.SubstanceSpecificationStructureComponent element) throws IOException {
55476      composeBackbone(element);
55477      if (element.hasStereochemistry()) {
55478        composeCodeableConcept("stereochemistry", element.getStereochemistry());
55479      }
55480      if (element.hasOpticalActivity()) {
55481        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
55482      }
55483      if (element.hasMolecularFormulaElement()) {
55484        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
55485        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
55486      }
55487      if (element.hasMolecularFormulaByMoietyElement()) {
55488        composeStringCore("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
55489        composeStringExtras("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
55490      }
55491      if (element.hasIsotope()) {
55492        openArray("isotope");
55493        for (SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent e : element.getIsotope()) 
55494          composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(null, e);
55495        closeArray();
55496      };
55497      if (element.hasMolecularWeight()) {
55498        composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent("molecularWeight", element.getMolecularWeight());
55499      }
55500      if (element.hasSource()) {
55501        openArray("source");
55502        for (Reference e : element.getSource()) 
55503          composeReference(null, e);
55504        closeArray();
55505      };
55506      if (element.hasRepresentation()) {
55507        openArray("representation");
55508        for (SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent e : element.getRepresentation()) 
55509          composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent(null, e);
55510        closeArray();
55511      };
55512  }
55513
55514  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent element) throws IOException {
55515    if (element != null) {
55516      open(name);
55517      composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentInner(element);
55518      close();
55519    }
55520  }
55521
55522  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentInner(SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent element) throws IOException {
55523      composeBackbone(element);
55524      if (element.hasIdentifier()) {
55525        composeIdentifier("identifier", element.getIdentifier());
55526      }
55527      if (element.hasName()) {
55528        composeCodeableConcept("name", element.getName());
55529      }
55530      if (element.hasSubstitution()) {
55531        composeCodeableConcept("substitution", element.getSubstitution());
55532      }
55533      if (element.hasHalfLife()) {
55534        composeQuantity("halfLife", element.getHalfLife());
55535      }
55536      if (element.hasMolecularWeight()) {
55537        composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent("molecularWeight", element.getMolecularWeight());
55538      }
55539  }
55540
55541  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent element) throws IOException {
55542    if (element != null) {
55543      open(name);
55544      composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentInner(element);
55545      close();
55546    }
55547  }
55548
55549  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentInner(SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent element) throws IOException {
55550      composeBackbone(element);
55551      if (element.hasMethod()) {
55552        composeCodeableConcept("method", element.getMethod());
55553      }
55554      if (element.hasType()) {
55555        composeCodeableConcept("type", element.getType());
55556      }
55557      if (element.hasAmount()) {
55558        composeQuantity("amount", element.getAmount());
55559      }
55560  }
55561
55562  protected void composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent element) throws IOException {
55563    if (element != null) {
55564      open(name);
55565      composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentInner(element);
55566      close();
55567    }
55568  }
55569
55570  protected void composeSubstanceSpecificationSubstanceSpecificationStructureRepresentationComponentInner(SubstanceSpecification.SubstanceSpecificationStructureRepresentationComponent element) throws IOException {
55571      composeBackbone(element);
55572      if (element.hasType()) {
55573        composeCodeableConcept("type", element.getType());
55574      }
55575      if (element.hasRepresentationElement()) {
55576        composeStringCore("representation", element.getRepresentationElement(), false);
55577        composeStringExtras("representation", element.getRepresentationElement(), false);
55578      }
55579      if (element.hasAttachment()) {
55580        composeAttachment("attachment", element.getAttachment());
55581      }
55582  }
55583
55584  protected void composeSubstanceSpecificationSubstanceSpecificationCodeComponent(String name, SubstanceSpecification.SubstanceSpecificationCodeComponent element) throws IOException {
55585    if (element != null) {
55586      open(name);
55587      composeSubstanceSpecificationSubstanceSpecificationCodeComponentInner(element);
55588      close();
55589    }
55590  }
55591
55592  protected void composeSubstanceSpecificationSubstanceSpecificationCodeComponentInner(SubstanceSpecification.SubstanceSpecificationCodeComponent element) throws IOException {
55593      composeBackbone(element);
55594      if (element.hasCode()) {
55595        composeCodeableConcept("code", element.getCode());
55596      }
55597      if (element.hasStatus()) {
55598        composeCodeableConcept("status", element.getStatus());
55599      }
55600      if (element.hasStatusDateElement()) {
55601        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
55602        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
55603      }
55604      if (element.hasCommentElement()) {
55605        composeStringCore("comment", element.getCommentElement(), false);
55606        composeStringExtras("comment", element.getCommentElement(), false);
55607      }
55608      if (element.hasSource()) {
55609        openArray("source");
55610        for (Reference e : element.getSource()) 
55611          composeReference(null, e);
55612        closeArray();
55613      };
55614  }
55615
55616  protected void composeSubstanceSpecificationSubstanceSpecificationNameComponent(String name, SubstanceSpecification.SubstanceSpecificationNameComponent element) throws IOException {
55617    if (element != null) {
55618      open(name);
55619      composeSubstanceSpecificationSubstanceSpecificationNameComponentInner(element);
55620      close();
55621    }
55622  }
55623
55624  protected void composeSubstanceSpecificationSubstanceSpecificationNameComponentInner(SubstanceSpecification.SubstanceSpecificationNameComponent element) throws IOException {
55625      composeBackbone(element);
55626      if (element.hasNameElement()) {
55627        composeStringCore("name", element.getNameElement(), false);
55628        composeStringExtras("name", element.getNameElement(), false);
55629      }
55630      if (element.hasType()) {
55631        composeCodeableConcept("type", element.getType());
55632      }
55633      if (element.hasStatus()) {
55634        composeCodeableConcept("status", element.getStatus());
55635      }
55636      if (element.hasPreferredElement()) {
55637        composeBooleanCore("preferred", element.getPreferredElement(), false);
55638        composeBooleanExtras("preferred", element.getPreferredElement(), false);
55639      }
55640      if (element.hasLanguage()) {
55641        openArray("language");
55642        for (CodeableConcept e : element.getLanguage()) 
55643          composeCodeableConcept(null, e);
55644        closeArray();
55645      };
55646      if (element.hasDomain()) {
55647        openArray("domain");
55648        for (CodeableConcept e : element.getDomain()) 
55649          composeCodeableConcept(null, e);
55650        closeArray();
55651      };
55652      if (element.hasJurisdiction()) {
55653        openArray("jurisdiction");
55654        for (CodeableConcept e : element.getJurisdiction()) 
55655          composeCodeableConcept(null, e);
55656        closeArray();
55657      };
55658      if (element.hasSynonym()) {
55659        openArray("synonym");
55660        for (SubstanceSpecification.SubstanceSpecificationNameComponent e : element.getSynonym()) 
55661          composeSubstanceSpecificationSubstanceSpecificationNameComponent(null, e);
55662        closeArray();
55663      };
55664      if (element.hasTranslation()) {
55665        openArray("translation");
55666        for (SubstanceSpecification.SubstanceSpecificationNameComponent e : element.getTranslation()) 
55667          composeSubstanceSpecificationSubstanceSpecificationNameComponent(null, e);
55668        closeArray();
55669      };
55670      if (element.hasOfficial()) {
55671        openArray("official");
55672        for (SubstanceSpecification.SubstanceSpecificationNameOfficialComponent e : element.getOfficial()) 
55673          composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponent(null, e);
55674        closeArray();
55675      };
55676      if (element.hasSource()) {
55677        openArray("source");
55678        for (Reference e : element.getSource()) 
55679          composeReference(null, e);
55680        closeArray();
55681      };
55682  }
55683
55684  protected void composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponent(String name, SubstanceSpecification.SubstanceSpecificationNameOfficialComponent element) throws IOException {
55685    if (element != null) {
55686      open(name);
55687      composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponentInner(element);
55688      close();
55689    }
55690  }
55691
55692  protected void composeSubstanceSpecificationSubstanceSpecificationNameOfficialComponentInner(SubstanceSpecification.SubstanceSpecificationNameOfficialComponent element) throws IOException {
55693      composeBackbone(element);
55694      if (element.hasAuthority()) {
55695        composeCodeableConcept("authority", element.getAuthority());
55696      }
55697      if (element.hasStatus()) {
55698        composeCodeableConcept("status", element.getStatus());
55699      }
55700      if (element.hasDateElement()) {
55701        composeDateTimeCore("date", element.getDateElement(), false);
55702        composeDateTimeExtras("date", element.getDateElement(), false);
55703      }
55704  }
55705
55706  protected void composeSubstanceSpecificationSubstanceSpecificationRelationshipComponent(String name, SubstanceSpecification.SubstanceSpecificationRelationshipComponent element) throws IOException {
55707    if (element != null) {
55708      open(name);
55709      composeSubstanceSpecificationSubstanceSpecificationRelationshipComponentInner(element);
55710      close();
55711    }
55712  }
55713
55714  protected void composeSubstanceSpecificationSubstanceSpecificationRelationshipComponentInner(SubstanceSpecification.SubstanceSpecificationRelationshipComponent element) throws IOException {
55715      composeBackbone(element);
55716      if (element.hasSubstance()) {
55717        composeType("substance", element.getSubstance());
55718      }
55719      if (element.hasRelationship()) {
55720        composeCodeableConcept("relationship", element.getRelationship());
55721      }
55722      if (element.hasIsDefiningElement()) {
55723        composeBooleanCore("isDefining", element.getIsDefiningElement(), false);
55724        composeBooleanExtras("isDefining", element.getIsDefiningElement(), false);
55725      }
55726      if (element.hasAmount()) {
55727        composeType("amount", element.getAmount());
55728      }
55729      if (element.hasAmountRatioLowLimit()) {
55730        composeRatio("amountRatioLowLimit", element.getAmountRatioLowLimit());
55731      }
55732      if (element.hasAmountType()) {
55733        composeCodeableConcept("amountType", element.getAmountType());
55734      }
55735      if (element.hasSource()) {
55736        openArray("source");
55737        for (Reference e : element.getSource()) 
55738          composeReference(null, e);
55739        closeArray();
55740      };
55741  }
55742
55743  protected void composeSupplyDelivery(String name, SupplyDelivery element) throws IOException {
55744    if (element != null) {
55745      prop("resourceType", name);
55746      composeSupplyDeliveryInner(element);
55747    }
55748  }
55749
55750  protected void composeSupplyDeliveryInner(SupplyDelivery element) throws IOException {
55751      composeDomainResourceElements(element);
55752      if (element.hasIdentifier()) {
55753        openArray("identifier");
55754        for (Identifier e : element.getIdentifier()) 
55755          composeIdentifier(null, e);
55756        closeArray();
55757      };
55758      if (element.hasBasedOn()) {
55759        openArray("basedOn");
55760        for (Reference e : element.getBasedOn()) 
55761          composeReference(null, e);
55762        closeArray();
55763      };
55764      if (element.hasPartOf()) {
55765        openArray("partOf");
55766        for (Reference e : element.getPartOf()) 
55767          composeReference(null, e);
55768        closeArray();
55769      };
55770      if (element.hasStatusElement()) {
55771        composeEnumerationCore("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
55772        composeEnumerationExtras("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
55773      }
55774      if (element.hasPatient()) {
55775        composeReference("patient", element.getPatient());
55776      }
55777      if (element.hasType()) {
55778        composeCodeableConcept("type", element.getType());
55779      }
55780      if (element.hasSuppliedItem()) {
55781        composeSupplyDeliverySupplyDeliverySuppliedItemComponent("suppliedItem", element.getSuppliedItem());
55782      }
55783      if (element.hasOccurrence()) {
55784        composeType("occurrence", element.getOccurrence());
55785      }
55786      if (element.hasSupplier()) {
55787        composeReference("supplier", element.getSupplier());
55788      }
55789      if (element.hasDestination()) {
55790        composeReference("destination", element.getDestination());
55791      }
55792      if (element.hasReceiver()) {
55793        openArray("receiver");
55794        for (Reference e : element.getReceiver()) 
55795          composeReference(null, e);
55796        closeArray();
55797      };
55798  }
55799
55800  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponent(String name, SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
55801    if (element != null) {
55802      open(name);
55803      composeSupplyDeliverySupplyDeliverySuppliedItemComponentInner(element);
55804      close();
55805    }
55806  }
55807
55808  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponentInner(SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
55809      composeBackbone(element);
55810      if (element.hasQuantity()) {
55811        composeQuantity("quantity", element.getQuantity());
55812      }
55813      if (element.hasItem()) {
55814        composeType("item", element.getItem());
55815      }
55816  }
55817
55818  protected void composeSupplyRequest(String name, SupplyRequest element) throws IOException {
55819    if (element != null) {
55820      prop("resourceType", name);
55821      composeSupplyRequestInner(element);
55822    }
55823  }
55824
55825  protected void composeSupplyRequestInner(SupplyRequest element) throws IOException {
55826      composeDomainResourceElements(element);
55827      if (element.hasIdentifier()) {
55828        openArray("identifier");
55829        for (Identifier e : element.getIdentifier()) 
55830          composeIdentifier(null, e);
55831        closeArray();
55832      };
55833      if (element.hasStatusElement()) {
55834        composeEnumerationCore("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
55835        composeEnumerationExtras("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
55836      }
55837      if (element.hasCategory()) {
55838        composeCodeableConcept("category", element.getCategory());
55839      }
55840      if (element.hasPriorityElement()) {
55841        composeEnumerationCore("priority", element.getPriorityElement(), new SupplyRequest.RequestPriorityEnumFactory(), false);
55842        composeEnumerationExtras("priority", element.getPriorityElement(), new SupplyRequest.RequestPriorityEnumFactory(), false);
55843      }
55844      if (element.hasItem()) {
55845        composeType("item", element.getItem());
55846      }
55847      if (element.hasQuantity()) {
55848        composeQuantity("quantity", element.getQuantity());
55849      }
55850      if (element.hasParameter()) {
55851        openArray("parameter");
55852        for (SupplyRequest.SupplyRequestParameterComponent e : element.getParameter()) 
55853          composeSupplyRequestSupplyRequestParameterComponent(null, e);
55854        closeArray();
55855      };
55856      if (element.hasOccurrence()) {
55857        composeType("occurrence", element.getOccurrence());
55858      }
55859      if (element.hasAuthoredOnElement()) {
55860        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
55861        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
55862      }
55863      if (element.hasRequester()) {
55864        composeReference("requester", element.getRequester());
55865      }
55866      if (element.hasSupplier()) {
55867        openArray("supplier");
55868        for (Reference e : element.getSupplier()) 
55869          composeReference(null, e);
55870        closeArray();
55871      };
55872      if (element.hasReasonCode()) {
55873        openArray("reasonCode");
55874        for (CodeableConcept e : element.getReasonCode()) 
55875          composeCodeableConcept(null, e);
55876        closeArray();
55877      };
55878      if (element.hasReasonReference()) {
55879        openArray("reasonReference");
55880        for (Reference e : element.getReasonReference()) 
55881          composeReference(null, e);
55882        closeArray();
55883      };
55884      if (element.hasDeliverFrom()) {
55885        composeReference("deliverFrom", element.getDeliverFrom());
55886      }
55887      if (element.hasDeliverTo()) {
55888        composeReference("deliverTo", element.getDeliverTo());
55889      }
55890  }
55891
55892  protected void composeSupplyRequestSupplyRequestParameterComponent(String name, SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
55893    if (element != null) {
55894      open(name);
55895      composeSupplyRequestSupplyRequestParameterComponentInner(element);
55896      close();
55897    }
55898  }
55899
55900  protected void composeSupplyRequestSupplyRequestParameterComponentInner(SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
55901      composeBackbone(element);
55902      if (element.hasCode()) {
55903        composeCodeableConcept("code", element.getCode());
55904      }
55905      if (element.hasValue()) {
55906        composeType("value", element.getValue());
55907      }
55908  }
55909
55910  protected void composeTask(String name, Task element) throws IOException {
55911    if (element != null) {
55912      prop("resourceType", name);
55913      composeTaskInner(element);
55914    }
55915  }
55916
55917  protected void composeTaskInner(Task element) throws IOException {
55918      composeDomainResourceElements(element);
55919      if (element.hasIdentifier()) {
55920        openArray("identifier");
55921        for (Identifier e : element.getIdentifier()) 
55922          composeIdentifier(null, e);
55923        closeArray();
55924      };
55925      if (element.hasInstantiatesCanonicalElement()) {
55926        composeCanonicalCore("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
55927        composeCanonicalExtras("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
55928      }
55929      if (element.hasInstantiatesUriElement()) {
55930        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
55931        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
55932      }
55933      if (element.hasBasedOn()) {
55934        openArray("basedOn");
55935        for (Reference e : element.getBasedOn()) 
55936          composeReference(null, e);
55937        closeArray();
55938      };
55939      if (element.hasGroupIdentifier()) {
55940        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
55941      }
55942      if (element.hasPartOf()) {
55943        openArray("partOf");
55944        for (Reference e : element.getPartOf()) 
55945          composeReference(null, e);
55946        closeArray();
55947      };
55948      if (element.hasStatusElement()) {
55949        composeEnumerationCore("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
55950        composeEnumerationExtras("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
55951      }
55952      if (element.hasStatusReason()) {
55953        composeCodeableConcept("statusReason", element.getStatusReason());
55954      }
55955      if (element.hasBusinessStatus()) {
55956        composeCodeableConcept("businessStatus", element.getBusinessStatus());
55957      }
55958      if (element.hasIntentElement()) {
55959        composeEnumerationCore("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
55960        composeEnumerationExtras("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
55961      }
55962      if (element.hasPriorityElement()) {
55963        composeEnumerationCore("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
55964        composeEnumerationExtras("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
55965      }
55966      if (element.hasCode()) {
55967        composeCodeableConcept("code", element.getCode());
55968      }
55969      if (element.hasDescriptionElement()) {
55970        composeStringCore("description", element.getDescriptionElement(), false);
55971        composeStringExtras("description", element.getDescriptionElement(), false);
55972      }
55973      if (element.hasFocus()) {
55974        composeReference("focus", element.getFocus());
55975      }
55976      if (element.hasFor()) {
55977        composeReference("for", element.getFor());
55978      }
55979      if (element.hasEncounter()) {
55980        composeReference("encounter", element.getEncounter());
55981      }
55982      if (element.hasExecutionPeriod()) {
55983        composePeriod("executionPeriod", element.getExecutionPeriod());
55984      }
55985      if (element.hasAuthoredOnElement()) {
55986        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
55987        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
55988      }
55989      if (element.hasLastModifiedElement()) {
55990        composeDateTimeCore("lastModified", element.getLastModifiedElement(), false);
55991        composeDateTimeExtras("lastModified", element.getLastModifiedElement(), false);
55992      }
55993      if (element.hasRequester()) {
55994        composeReference("requester", element.getRequester());
55995      }
55996      if (element.hasPerformerType()) {
55997        openArray("performerType");
55998        for (CodeableConcept e : element.getPerformerType()) 
55999          composeCodeableConcept(null, e);
56000        closeArray();
56001      };
56002      if (element.hasOwner()) {
56003        composeReference("owner", element.getOwner());
56004      }
56005      if (element.hasLocation()) {
56006        composeReference("location", element.getLocation());
56007      }
56008      if (element.hasReasonCode()) {
56009        composeCodeableConcept("reasonCode", element.getReasonCode());
56010      }
56011      if (element.hasReasonReference()) {
56012        composeReference("reasonReference", element.getReasonReference());
56013      }
56014      if (element.hasInsurance()) {
56015        openArray("insurance");
56016        for (Reference e : element.getInsurance()) 
56017          composeReference(null, e);
56018        closeArray();
56019      };
56020      if (element.hasNote()) {
56021        openArray("note");
56022        for (Annotation e : element.getNote()) 
56023          composeAnnotation(null, e);
56024        closeArray();
56025      };
56026      if (element.hasRelevantHistory()) {
56027        openArray("relevantHistory");
56028        for (Reference e : element.getRelevantHistory()) 
56029          composeReference(null, e);
56030        closeArray();
56031      };
56032      if (element.hasRestriction()) {
56033        composeTaskTaskRestrictionComponent("restriction", element.getRestriction());
56034      }
56035      if (element.hasInput()) {
56036        openArray("input");
56037        for (Task.ParameterComponent e : element.getInput()) 
56038          composeTaskParameterComponent(null, e);
56039        closeArray();
56040      };
56041      if (element.hasOutput()) {
56042        openArray("output");
56043        for (Task.TaskOutputComponent e : element.getOutput()) 
56044          composeTaskTaskOutputComponent(null, e);
56045        closeArray();
56046      };
56047  }
56048
56049  protected void composeTaskTaskRestrictionComponent(String name, Task.TaskRestrictionComponent element) throws IOException {
56050    if (element != null) {
56051      open(name);
56052      composeTaskTaskRestrictionComponentInner(element);
56053      close();
56054    }
56055  }
56056
56057  protected void composeTaskTaskRestrictionComponentInner(Task.TaskRestrictionComponent element) throws IOException {
56058      composeBackbone(element);
56059      if (element.hasRepetitionsElement()) {
56060        composePositiveIntCore("repetitions", element.getRepetitionsElement(), false);
56061        composePositiveIntExtras("repetitions", element.getRepetitionsElement(), false);
56062      }
56063      if (element.hasPeriod()) {
56064        composePeriod("period", element.getPeriod());
56065      }
56066      if (element.hasRecipient()) {
56067        openArray("recipient");
56068        for (Reference e : element.getRecipient()) 
56069          composeReference(null, e);
56070        closeArray();
56071      };
56072  }
56073
56074  protected void composeTaskParameterComponent(String name, Task.ParameterComponent element) throws IOException {
56075    if (element != null) {
56076      open(name);
56077      composeTaskParameterComponentInner(element);
56078      close();
56079    }
56080  }
56081
56082  protected void composeTaskParameterComponentInner(Task.ParameterComponent element) throws IOException {
56083      composeBackbone(element);
56084      if (element.hasType()) {
56085        composeCodeableConcept("type", element.getType());
56086      }
56087      if (element.hasValue()) {
56088        composeType("value", element.getValue());
56089      }
56090  }
56091
56092  protected void composeTaskTaskOutputComponent(String name, Task.TaskOutputComponent element) throws IOException {
56093    if (element != null) {
56094      open(name);
56095      composeTaskTaskOutputComponentInner(element);
56096      close();
56097    }
56098  }
56099
56100  protected void composeTaskTaskOutputComponentInner(Task.TaskOutputComponent element) throws IOException {
56101      composeBackbone(element);
56102      if (element.hasType()) {
56103        composeCodeableConcept("type", element.getType());
56104      }
56105      if (element.hasValue()) {
56106        composeType("value", element.getValue());
56107      }
56108  }
56109
56110  protected void composeTerminologyCapabilities(String name, TerminologyCapabilities element) throws IOException {
56111    if (element != null) {
56112      prop("resourceType", name);
56113      composeTerminologyCapabilitiesInner(element);
56114    }
56115  }
56116
56117  protected void composeTerminologyCapabilitiesInner(TerminologyCapabilities element) throws IOException {
56118      composeDomainResourceElements(element);
56119      if (element.hasUrlElement()) {
56120        composeUriCore("url", element.getUrlElement(), false);
56121        composeUriExtras("url", element.getUrlElement(), false);
56122      }
56123      if (element.hasVersionElement()) {
56124        composeStringCore("version", element.getVersionElement(), false);
56125        composeStringExtras("version", element.getVersionElement(), false);
56126      }
56127      if (element.hasNameElement()) {
56128        composeStringCore("name", element.getNameElement(), false);
56129        composeStringExtras("name", element.getNameElement(), false);
56130      }
56131      if (element.hasTitleElement()) {
56132        composeStringCore("title", element.getTitleElement(), false);
56133        composeStringExtras("title", element.getTitleElement(), false);
56134      }
56135      if (element.hasStatusElement()) {
56136        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56137        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56138      }
56139      if (element.hasExperimentalElement()) {
56140        composeBooleanCore("experimental", element.getExperimentalElement(), false);
56141        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
56142      }
56143      if (element.hasDateElement()) {
56144        composeDateTimeCore("date", element.getDateElement(), false);
56145        composeDateTimeExtras("date", element.getDateElement(), false);
56146      }
56147      if (element.hasPublisherElement()) {
56148        composeStringCore("publisher", element.getPublisherElement(), false);
56149        composeStringExtras("publisher", element.getPublisherElement(), false);
56150      }
56151      if (element.hasContact()) {
56152        openArray("contact");
56153        for (ContactDetail e : element.getContact()) 
56154          composeContactDetail(null, e);
56155        closeArray();
56156      };
56157      if (element.hasDescriptionElement()) {
56158        composeMarkdownCore("description", element.getDescriptionElement(), false);
56159        composeMarkdownExtras("description", element.getDescriptionElement(), false);
56160      }
56161      if (element.hasUseContext()) {
56162        openArray("useContext");
56163        for (UsageContext e : element.getUseContext()) 
56164          composeUsageContext(null, e);
56165        closeArray();
56166      };
56167      if (element.hasJurisdiction()) {
56168        openArray("jurisdiction");
56169        for (CodeableConcept e : element.getJurisdiction()) 
56170          composeCodeableConcept(null, e);
56171        closeArray();
56172      };
56173      if (element.hasPurposeElement()) {
56174        composeMarkdownCore("purpose", element.getPurposeElement(), false);
56175        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
56176      }
56177      if (element.hasCopyrightElement()) {
56178        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
56179        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
56180      }
56181      if (element.hasKindElement()) {
56182        composeEnumerationCore("kind", element.getKindElement(), new TerminologyCapabilities.CapabilityStatementKindEnumFactory(), false);
56183        composeEnumerationExtras("kind", element.getKindElement(), new TerminologyCapabilities.CapabilityStatementKindEnumFactory(), false);
56184      }
56185      if (element.hasSoftware()) {
56186        composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent("software", element.getSoftware());
56187      }
56188      if (element.hasImplementation()) {
56189        composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent("implementation", element.getImplementation());
56190      }
56191      if (element.hasLockedDateElement()) {
56192        composeBooleanCore("lockedDate", element.getLockedDateElement(), false);
56193        composeBooleanExtras("lockedDate", element.getLockedDateElement(), false);
56194      }
56195      if (element.hasCodeSystem()) {
56196        openArray("codeSystem");
56197        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent e : element.getCodeSystem()) 
56198          composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(null, e);
56199        closeArray();
56200      };
56201      if (element.hasExpansion()) {
56202        composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent("expansion", element.getExpansion());
56203      }
56204      if (element.hasCodeSearchElement()) {
56205        composeEnumerationCore("codeSearch", element.getCodeSearchElement(), new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
56206        composeEnumerationExtras("codeSearch", element.getCodeSearchElement(), new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
56207      }
56208      if (element.hasValidateCode()) {
56209        composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent("validateCode", element.getValidateCode());
56210      }
56211      if (element.hasTranslation()) {
56212        composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent("translation", element.getTranslation());
56213      }
56214      if (element.hasClosure()) {
56215        composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent("closure", element.getClosure());
56216      }
56217  }
56218
56219  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
56220    if (element != null) {
56221      open(name);
56222      composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentInner(element);
56223      close();
56224    }
56225  }
56226
56227  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentInner(TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
56228      composeBackbone(element);
56229      if (element.hasNameElement()) {
56230        composeStringCore("name", element.getNameElement(), false);
56231        composeStringExtras("name", element.getNameElement(), false);
56232      }
56233      if (element.hasVersionElement()) {
56234        composeStringCore("version", element.getVersionElement(), false);
56235        composeStringExtras("version", element.getVersionElement(), false);
56236      }
56237  }
56238
56239  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
56240    if (element != null) {
56241      open(name);
56242      composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentInner(element);
56243      close();
56244    }
56245  }
56246
56247  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentInner(TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
56248      composeBackbone(element);
56249      if (element.hasDescriptionElement()) {
56250        composeStringCore("description", element.getDescriptionElement(), false);
56251        composeStringExtras("description", element.getDescriptionElement(), false);
56252      }
56253      if (element.hasUrlElement()) {
56254        composeUrlCore("url", element.getUrlElement(), false);
56255        composeUrlExtras("url", element.getUrlElement(), false);
56256      }
56257  }
56258
56259  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
56260    if (element != null) {
56261      open(name);
56262      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentInner(element);
56263      close();
56264    }
56265  }
56266
56267  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentInner(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
56268      composeBackbone(element);
56269      if (element.hasUriElement()) {
56270        composeCanonicalCore("uri", element.getUriElement(), false);
56271        composeCanonicalExtras("uri", element.getUriElement(), false);
56272      }
56273      if (element.hasVersion()) {
56274        openArray("version");
56275        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent e : element.getVersion()) 
56276          composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(null, e);
56277        closeArray();
56278      };
56279      if (element.hasSubsumptionElement()) {
56280        composeBooleanCore("subsumption", element.getSubsumptionElement(), false);
56281        composeBooleanExtras("subsumption", element.getSubsumptionElement(), false);
56282      }
56283  }
56284
56285  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
56286    if (element != null) {
56287      open(name);
56288      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentInner(element);
56289      close();
56290    }
56291  }
56292
56293  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentInner(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
56294      composeBackbone(element);
56295      if (element.hasCodeElement()) {
56296        composeStringCore("code", element.getCodeElement(), false);
56297        composeStringExtras("code", element.getCodeElement(), false);
56298      }
56299      if (element.hasIsDefaultElement()) {
56300        composeBooleanCore("isDefault", element.getIsDefaultElement(), false);
56301        composeBooleanExtras("isDefault", element.getIsDefaultElement(), false);
56302      }
56303      if (element.hasCompositionalElement()) {
56304        composeBooleanCore("compositional", element.getCompositionalElement(), false);
56305        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
56306      }
56307      if (element.hasLanguage()) {
56308        openArray("language");
56309        for (CodeType e : element.getLanguage()) 
56310          composeCodeCore(null, e, true);
56311        closeArray();
56312        if (anyHasExtras(element.getLanguage())) {
56313          openArray("_language");
56314          for (CodeType e : element.getLanguage()) 
56315            composeCodeExtras(null, e, true);
56316          closeArray();
56317        }
56318      };
56319      if (element.hasFilter()) {
56320        openArray("filter");
56321        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent e : element.getFilter()) 
56322          composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(null, e);
56323        closeArray();
56324      };
56325      if (element.hasProperty()) {
56326        openArray("property");
56327        for (CodeType e : element.getProperty()) 
56328          composeCodeCore(null, e, true);
56329        closeArray();
56330        if (anyHasExtras(element.getProperty())) {
56331          openArray("_property");
56332          for (CodeType e : element.getProperty()) 
56333            composeCodeExtras(null, e, true);
56334          closeArray();
56335        }
56336      };
56337  }
56338
56339  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
56340    if (element != null) {
56341      open(name);
56342      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentInner(element);
56343      close();
56344    }
56345  }
56346
56347  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentInner(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
56348      composeBackbone(element);
56349      if (element.hasCodeElement()) {
56350        composeCodeCore("code", element.getCodeElement(), false);
56351        composeCodeExtras("code", element.getCodeElement(), false);
56352      }
56353      if (element.hasOp()) {
56354        openArray("op");
56355        for (CodeType e : element.getOp()) 
56356          composeCodeCore(null, e, true);
56357        closeArray();
56358        if (anyHasExtras(element.getOp())) {
56359          openArray("_op");
56360          for (CodeType e : element.getOp()) 
56361            composeCodeExtras(null, e, true);
56362          closeArray();
56363        }
56364      };
56365  }
56366
56367  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
56368    if (element != null) {
56369      open(name);
56370      composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentInner(element);
56371      close();
56372    }
56373  }
56374
56375  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentInner(TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
56376      composeBackbone(element);
56377      if (element.hasHierarchicalElement()) {
56378        composeBooleanCore("hierarchical", element.getHierarchicalElement(), false);
56379        composeBooleanExtras("hierarchical", element.getHierarchicalElement(), false);
56380      }
56381      if (element.hasPagingElement()) {
56382        composeBooleanCore("paging", element.getPagingElement(), false);
56383        composeBooleanExtras("paging", element.getPagingElement(), false);
56384      }
56385      if (element.hasIncompleteElement()) {
56386        composeBooleanCore("incomplete", element.getIncompleteElement(), false);
56387        composeBooleanExtras("incomplete", element.getIncompleteElement(), false);
56388      }
56389      if (element.hasParameter()) {
56390        openArray("parameter");
56391        for (TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent e : element.getParameter()) 
56392          composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(null, e);
56393        closeArray();
56394      };
56395      if (element.hasTextFilterElement()) {
56396        composeMarkdownCore("textFilter", element.getTextFilterElement(), false);
56397        composeMarkdownExtras("textFilter", element.getTextFilterElement(), false);
56398      }
56399  }
56400
56401  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
56402    if (element != null) {
56403      open(name);
56404      composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentInner(element);
56405      close();
56406    }
56407  }
56408
56409  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentInner(TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
56410      composeBackbone(element);
56411      if (element.hasNameElement()) {
56412        composeCodeCore("name", element.getNameElement(), false);
56413        composeCodeExtras("name", element.getNameElement(), false);
56414      }
56415      if (element.hasDocumentationElement()) {
56416        composeStringCore("documentation", element.getDocumentationElement(), false);
56417        composeStringExtras("documentation", element.getDocumentationElement(), false);
56418      }
56419  }
56420
56421  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
56422    if (element != null) {
56423      open(name);
56424      composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentInner(element);
56425      close();
56426    }
56427  }
56428
56429  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentInner(TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
56430      composeBackbone(element);
56431      if (element.hasTranslationsElement()) {
56432        composeBooleanCore("translations", element.getTranslationsElement(), false);
56433        composeBooleanExtras("translations", element.getTranslationsElement(), false);
56434      }
56435  }
56436
56437  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
56438    if (element != null) {
56439      open(name);
56440      composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentInner(element);
56441      close();
56442    }
56443  }
56444
56445  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentInner(TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
56446      composeBackbone(element);
56447      if (element.hasNeedsMapElement()) {
56448        composeBooleanCore("needsMap", element.getNeedsMapElement(), false);
56449        composeBooleanExtras("needsMap", element.getNeedsMapElement(), false);
56450      }
56451  }
56452
56453  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
56454    if (element != null) {
56455      open(name);
56456      composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentInner(element);
56457      close();
56458    }
56459  }
56460
56461  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentInner(TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
56462      composeBackbone(element);
56463      if (element.hasTranslationElement()) {
56464        composeBooleanCore("translation", element.getTranslationElement(), false);
56465        composeBooleanExtras("translation", element.getTranslationElement(), false);
56466      }
56467  }
56468
56469  protected void composeTestReport(String name, TestReport element) throws IOException {
56470    if (element != null) {
56471      prop("resourceType", name);
56472      composeTestReportInner(element);
56473    }
56474  }
56475
56476  protected void composeTestReportInner(TestReport element) throws IOException {
56477      composeDomainResourceElements(element);
56478      if (element.hasIdentifier()) {
56479        composeIdentifier("identifier", element.getIdentifier());
56480      }
56481      if (element.hasNameElement()) {
56482        composeStringCore("name", element.getNameElement(), false);
56483        composeStringExtras("name", element.getNameElement(), false);
56484      }
56485      if (element.hasStatusElement()) {
56486        composeEnumerationCore("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
56487        composeEnumerationExtras("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
56488      }
56489      if (element.hasTestScript()) {
56490        composeReference("testScript", element.getTestScript());
56491      }
56492      if (element.hasResultElement()) {
56493        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
56494        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
56495      }
56496      if (element.hasScoreElement()) {
56497        composeDecimalCore("score", element.getScoreElement(), false);
56498        composeDecimalExtras("score", element.getScoreElement(), false);
56499      }
56500      if (element.hasTesterElement()) {
56501        composeStringCore("tester", element.getTesterElement(), false);
56502        composeStringExtras("tester", element.getTesterElement(), false);
56503      }
56504      if (element.hasIssuedElement()) {
56505        composeDateTimeCore("issued", element.getIssuedElement(), false);
56506        composeDateTimeExtras("issued", element.getIssuedElement(), false);
56507      }
56508      if (element.hasParticipant()) {
56509        openArray("participant");
56510        for (TestReport.TestReportParticipantComponent e : element.getParticipant()) 
56511          composeTestReportTestReportParticipantComponent(null, e);
56512        closeArray();
56513      };
56514      if (element.hasSetup()) {
56515        composeTestReportTestReportSetupComponent("setup", element.getSetup());
56516      }
56517      if (element.hasTest()) {
56518        openArray("test");
56519        for (TestReport.TestReportTestComponent e : element.getTest()) 
56520          composeTestReportTestReportTestComponent(null, e);
56521        closeArray();
56522      };
56523      if (element.hasTeardown()) {
56524        composeTestReportTestReportTeardownComponent("teardown", element.getTeardown());
56525      }
56526  }
56527
56528  protected void composeTestReportTestReportParticipantComponent(String name, TestReport.TestReportParticipantComponent element) throws IOException {
56529    if (element != null) {
56530      open(name);
56531      composeTestReportTestReportParticipantComponentInner(element);
56532      close();
56533    }
56534  }
56535
56536  protected void composeTestReportTestReportParticipantComponentInner(TestReport.TestReportParticipantComponent element) throws IOException {
56537      composeBackbone(element);
56538      if (element.hasTypeElement()) {
56539        composeEnumerationCore("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
56540        composeEnumerationExtras("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
56541      }
56542      if (element.hasUriElement()) {
56543        composeUriCore("uri", element.getUriElement(), false);
56544        composeUriExtras("uri", element.getUriElement(), false);
56545      }
56546      if (element.hasDisplayElement()) {
56547        composeStringCore("display", element.getDisplayElement(), false);
56548        composeStringExtras("display", element.getDisplayElement(), false);
56549      }
56550  }
56551
56552  protected void composeTestReportTestReportSetupComponent(String name, TestReport.TestReportSetupComponent element) throws IOException {
56553    if (element != null) {
56554      open(name);
56555      composeTestReportTestReportSetupComponentInner(element);
56556      close();
56557    }
56558  }
56559
56560  protected void composeTestReportTestReportSetupComponentInner(TestReport.TestReportSetupComponent element) throws IOException {
56561      composeBackbone(element);
56562      if (element.hasAction()) {
56563        openArray("action");
56564        for (TestReport.SetupActionComponent e : element.getAction()) 
56565          composeTestReportSetupActionComponent(null, e);
56566        closeArray();
56567      };
56568  }
56569
56570  protected void composeTestReportSetupActionComponent(String name, TestReport.SetupActionComponent element) throws IOException {
56571    if (element != null) {
56572      open(name);
56573      composeTestReportSetupActionComponentInner(element);
56574      close();
56575    }
56576  }
56577
56578  protected void composeTestReportSetupActionComponentInner(TestReport.SetupActionComponent element) throws IOException {
56579      composeBackbone(element);
56580      if (element.hasOperation()) {
56581        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
56582      }
56583      if (element.hasAssert()) {
56584        composeTestReportSetupActionAssertComponent("assert", element.getAssert());
56585      }
56586  }
56587
56588  protected void composeTestReportSetupActionOperationComponent(String name, TestReport.SetupActionOperationComponent element) throws IOException {
56589    if (element != null) {
56590      open(name);
56591      composeTestReportSetupActionOperationComponentInner(element);
56592      close();
56593    }
56594  }
56595
56596  protected void composeTestReportSetupActionOperationComponentInner(TestReport.SetupActionOperationComponent element) throws IOException {
56597      composeBackbone(element);
56598      if (element.hasResultElement()) {
56599        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
56600        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
56601      }
56602      if (element.hasMessageElement()) {
56603        composeMarkdownCore("message", element.getMessageElement(), false);
56604        composeMarkdownExtras("message", element.getMessageElement(), false);
56605      }
56606      if (element.hasDetailElement()) {
56607        composeUriCore("detail", element.getDetailElement(), false);
56608        composeUriExtras("detail", element.getDetailElement(), false);
56609      }
56610  }
56611
56612  protected void composeTestReportSetupActionAssertComponent(String name, TestReport.SetupActionAssertComponent element) throws IOException {
56613    if (element != null) {
56614      open(name);
56615      composeTestReportSetupActionAssertComponentInner(element);
56616      close();
56617    }
56618  }
56619
56620  protected void composeTestReportSetupActionAssertComponentInner(TestReport.SetupActionAssertComponent element) throws IOException {
56621      composeBackbone(element);
56622      if (element.hasResultElement()) {
56623        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
56624        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
56625      }
56626      if (element.hasMessageElement()) {
56627        composeMarkdownCore("message", element.getMessageElement(), false);
56628        composeMarkdownExtras("message", element.getMessageElement(), false);
56629      }
56630      if (element.hasDetailElement()) {
56631        composeStringCore("detail", element.getDetailElement(), false);
56632        composeStringExtras("detail", element.getDetailElement(), false);
56633      }
56634  }
56635
56636  protected void composeTestReportTestReportTestComponent(String name, TestReport.TestReportTestComponent element) throws IOException {
56637    if (element != null) {
56638      open(name);
56639      composeTestReportTestReportTestComponentInner(element);
56640      close();
56641    }
56642  }
56643
56644  protected void composeTestReportTestReportTestComponentInner(TestReport.TestReportTestComponent element) throws IOException {
56645      composeBackbone(element);
56646      if (element.hasNameElement()) {
56647        composeStringCore("name", element.getNameElement(), false);
56648        composeStringExtras("name", element.getNameElement(), false);
56649      }
56650      if (element.hasDescriptionElement()) {
56651        composeStringCore("description", element.getDescriptionElement(), false);
56652        composeStringExtras("description", element.getDescriptionElement(), false);
56653      }
56654      if (element.hasAction()) {
56655        openArray("action");
56656        for (TestReport.TestActionComponent e : element.getAction()) 
56657          composeTestReportTestActionComponent(null, e);
56658        closeArray();
56659      };
56660  }
56661
56662  protected void composeTestReportTestActionComponent(String name, TestReport.TestActionComponent element) throws IOException {
56663    if (element != null) {
56664      open(name);
56665      composeTestReportTestActionComponentInner(element);
56666      close();
56667    }
56668  }
56669
56670  protected void composeTestReportTestActionComponentInner(TestReport.TestActionComponent element) throws IOException {
56671      composeBackbone(element);
56672      if (element.hasOperation()) {
56673        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
56674      }
56675      if (element.hasAssert()) {
56676        composeTestReportSetupActionAssertComponent("assert", element.getAssert());
56677      }
56678  }
56679
56680  protected void composeTestReportTestReportTeardownComponent(String name, TestReport.TestReportTeardownComponent element) throws IOException {
56681    if (element != null) {
56682      open(name);
56683      composeTestReportTestReportTeardownComponentInner(element);
56684      close();
56685    }
56686  }
56687
56688  protected void composeTestReportTestReportTeardownComponentInner(TestReport.TestReportTeardownComponent element) throws IOException {
56689      composeBackbone(element);
56690      if (element.hasAction()) {
56691        openArray("action");
56692        for (TestReport.TeardownActionComponent e : element.getAction()) 
56693          composeTestReportTeardownActionComponent(null, e);
56694        closeArray();
56695      };
56696  }
56697
56698  protected void composeTestReportTeardownActionComponent(String name, TestReport.TeardownActionComponent element) throws IOException {
56699    if (element != null) {
56700      open(name);
56701      composeTestReportTeardownActionComponentInner(element);
56702      close();
56703    }
56704  }
56705
56706  protected void composeTestReportTeardownActionComponentInner(TestReport.TeardownActionComponent element) throws IOException {
56707      composeBackbone(element);
56708      if (element.hasOperation()) {
56709        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
56710      }
56711  }
56712
56713  protected void composeTestScript(String name, TestScript element) throws IOException {
56714    if (element != null) {
56715      prop("resourceType", name);
56716      composeTestScriptInner(element);
56717    }
56718  }
56719
56720  protected void composeTestScriptInner(TestScript element) throws IOException {
56721      composeDomainResourceElements(element);
56722      if (element.hasUrlElement()) {
56723        composeUriCore("url", element.getUrlElement(), false);
56724        composeUriExtras("url", element.getUrlElement(), false);
56725      }
56726      if (element.hasIdentifier()) {
56727        composeIdentifier("identifier", element.getIdentifier());
56728      }
56729      if (element.hasVersionElement()) {
56730        composeStringCore("version", element.getVersionElement(), false);
56731        composeStringExtras("version", element.getVersionElement(), false);
56732      }
56733      if (element.hasNameElement()) {
56734        composeStringCore("name", element.getNameElement(), false);
56735        composeStringExtras("name", element.getNameElement(), false);
56736      }
56737      if (element.hasTitleElement()) {
56738        composeStringCore("title", element.getTitleElement(), false);
56739        composeStringExtras("title", element.getTitleElement(), false);
56740      }
56741      if (element.hasStatusElement()) {
56742        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56743        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
56744      }
56745      if (element.hasExperimentalElement()) {
56746        composeBooleanCore("experimental", element.getExperimentalElement(), false);
56747        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
56748      }
56749      if (element.hasDateElement()) {
56750        composeDateTimeCore("date", element.getDateElement(), false);
56751        composeDateTimeExtras("date", element.getDateElement(), false);
56752      }
56753      if (element.hasPublisherElement()) {
56754        composeStringCore("publisher", element.getPublisherElement(), false);
56755        composeStringExtras("publisher", element.getPublisherElement(), false);
56756      }
56757      if (element.hasContact()) {
56758        openArray("contact");
56759        for (ContactDetail e : element.getContact()) 
56760          composeContactDetail(null, e);
56761        closeArray();
56762      };
56763      if (element.hasDescriptionElement()) {
56764        composeMarkdownCore("description", element.getDescriptionElement(), false);
56765        composeMarkdownExtras("description", element.getDescriptionElement(), false);
56766      }
56767      if (element.hasUseContext()) {
56768        openArray("useContext");
56769        for (UsageContext e : element.getUseContext()) 
56770          composeUsageContext(null, e);
56771        closeArray();
56772      };
56773      if (element.hasJurisdiction()) {
56774        openArray("jurisdiction");
56775        for (CodeableConcept e : element.getJurisdiction()) 
56776          composeCodeableConcept(null, e);
56777        closeArray();
56778      };
56779      if (element.hasPurposeElement()) {
56780        composeMarkdownCore("purpose", element.getPurposeElement(), false);
56781        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
56782      }
56783      if (element.hasCopyrightElement()) {
56784        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
56785        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
56786      }
56787      if (element.hasOrigin()) {
56788        openArray("origin");
56789        for (TestScript.TestScriptOriginComponent e : element.getOrigin()) 
56790          composeTestScriptTestScriptOriginComponent(null, e);
56791        closeArray();
56792      };
56793      if (element.hasDestination()) {
56794        openArray("destination");
56795        for (TestScript.TestScriptDestinationComponent e : element.getDestination()) 
56796          composeTestScriptTestScriptDestinationComponent(null, e);
56797        closeArray();
56798      };
56799      if (element.hasMetadata()) {
56800        composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
56801      }
56802      if (element.hasFixture()) {
56803        openArray("fixture");
56804        for (TestScript.TestScriptFixtureComponent e : element.getFixture()) 
56805          composeTestScriptTestScriptFixtureComponent(null, e);
56806        closeArray();
56807      };
56808      if (element.hasProfile()) {
56809        openArray("profile");
56810        for (Reference e : element.getProfile()) 
56811          composeReference(null, e);
56812        closeArray();
56813      };
56814      if (element.hasVariable()) {
56815        openArray("variable");
56816        for (TestScript.TestScriptVariableComponent e : element.getVariable()) 
56817          composeTestScriptTestScriptVariableComponent(null, e);
56818        closeArray();
56819      };
56820      if (element.hasSetup()) {
56821        composeTestScriptTestScriptSetupComponent("setup", element.getSetup());
56822      }
56823      if (element.hasTest()) {
56824        openArray("test");
56825        for (TestScript.TestScriptTestComponent e : element.getTest()) 
56826          composeTestScriptTestScriptTestComponent(null, e);
56827        closeArray();
56828      };
56829      if (element.hasTeardown()) {
56830        composeTestScriptTestScriptTeardownComponent("teardown", element.getTeardown());
56831      }
56832  }
56833
56834  protected void composeTestScriptTestScriptOriginComponent(String name, TestScript.TestScriptOriginComponent element) throws IOException {
56835    if (element != null) {
56836      open(name);
56837      composeTestScriptTestScriptOriginComponentInner(element);
56838      close();
56839    }
56840  }
56841
56842  protected void composeTestScriptTestScriptOriginComponentInner(TestScript.TestScriptOriginComponent element) throws IOException {
56843      composeBackbone(element);
56844      if (element.hasIndexElement()) {
56845        composeIntegerCore("index", element.getIndexElement(), false);
56846        composeIntegerExtras("index", element.getIndexElement(), false);
56847      }
56848      if (element.hasProfile()) {
56849        composeCoding("profile", element.getProfile());
56850      }
56851  }
56852
56853  protected void composeTestScriptTestScriptDestinationComponent(String name, TestScript.TestScriptDestinationComponent element) throws IOException {
56854    if (element != null) {
56855      open(name);
56856      composeTestScriptTestScriptDestinationComponentInner(element);
56857      close();
56858    }
56859  }
56860
56861  protected void composeTestScriptTestScriptDestinationComponentInner(TestScript.TestScriptDestinationComponent element) throws IOException {
56862      composeBackbone(element);
56863      if (element.hasIndexElement()) {
56864        composeIntegerCore("index", element.getIndexElement(), false);
56865        composeIntegerExtras("index", element.getIndexElement(), false);
56866      }
56867      if (element.hasProfile()) {
56868        composeCoding("profile", element.getProfile());
56869      }
56870  }
56871
56872  protected void composeTestScriptTestScriptMetadataComponent(String name, TestScript.TestScriptMetadataComponent element) throws IOException {
56873    if (element != null) {
56874      open(name);
56875      composeTestScriptTestScriptMetadataComponentInner(element);
56876      close();
56877    }
56878  }
56879
56880  protected void composeTestScriptTestScriptMetadataComponentInner(TestScript.TestScriptMetadataComponent element) throws IOException {
56881      composeBackbone(element);
56882      if (element.hasLink()) {
56883        openArray("link");
56884        for (TestScript.TestScriptMetadataLinkComponent e : element.getLink()) 
56885          composeTestScriptTestScriptMetadataLinkComponent(null, e);
56886        closeArray();
56887      };
56888      if (element.hasCapability()) {
56889        openArray("capability");
56890        for (TestScript.TestScriptMetadataCapabilityComponent e : element.getCapability()) 
56891          composeTestScriptTestScriptMetadataCapabilityComponent(null, e);
56892        closeArray();
56893      };
56894  }
56895
56896  protected void composeTestScriptTestScriptMetadataLinkComponent(String name, TestScript.TestScriptMetadataLinkComponent element) throws IOException {
56897    if (element != null) {
56898      open(name);
56899      composeTestScriptTestScriptMetadataLinkComponentInner(element);
56900      close();
56901    }
56902  }
56903
56904  protected void composeTestScriptTestScriptMetadataLinkComponentInner(TestScript.TestScriptMetadataLinkComponent element) throws IOException {
56905      composeBackbone(element);
56906      if (element.hasUrlElement()) {
56907        composeUriCore("url", element.getUrlElement(), false);
56908        composeUriExtras("url", element.getUrlElement(), false);
56909      }
56910      if (element.hasDescriptionElement()) {
56911        composeStringCore("description", element.getDescriptionElement(), false);
56912        composeStringExtras("description", element.getDescriptionElement(), false);
56913      }
56914  }
56915
56916  protected void composeTestScriptTestScriptMetadataCapabilityComponent(String name, TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
56917    if (element != null) {
56918      open(name);
56919      composeTestScriptTestScriptMetadataCapabilityComponentInner(element);
56920      close();
56921    }
56922  }
56923
56924  protected void composeTestScriptTestScriptMetadataCapabilityComponentInner(TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
56925      composeBackbone(element);
56926      if (element.hasRequiredElement()) {
56927        composeBooleanCore("required", element.getRequiredElement(), false);
56928        composeBooleanExtras("required", element.getRequiredElement(), false);
56929      }
56930      if (element.hasValidatedElement()) {
56931        composeBooleanCore("validated", element.getValidatedElement(), false);
56932        composeBooleanExtras("validated", element.getValidatedElement(), false);
56933      }
56934      if (element.hasDescriptionElement()) {
56935        composeStringCore("description", element.getDescriptionElement(), false);
56936        composeStringExtras("description", element.getDescriptionElement(), false);
56937      }
56938      if (element.hasOrigin()) {
56939        openArray("origin");
56940        for (IntegerType e : element.getOrigin()) 
56941          composeIntegerCore(null, e, true);
56942        closeArray();
56943        if (anyHasExtras(element.getOrigin())) {
56944          openArray("_origin");
56945          for (IntegerType e : element.getOrigin()) 
56946            composeIntegerExtras(null, e, true);
56947          closeArray();
56948        }
56949      };
56950      if (element.hasDestinationElement()) {
56951        composeIntegerCore("destination", element.getDestinationElement(), false);
56952        composeIntegerExtras("destination", element.getDestinationElement(), false);
56953      }
56954      if (element.hasLink()) {
56955        openArray("link");
56956        for (UriType e : element.getLink()) 
56957          composeUriCore(null, e, true);
56958        closeArray();
56959        if (anyHasExtras(element.getLink())) {
56960          openArray("_link");
56961          for (UriType e : element.getLink()) 
56962            composeUriExtras(null, e, true);
56963          closeArray();
56964        }
56965      };
56966      if (element.hasCapabilitiesElement()) {
56967        composeCanonicalCore("capabilities", element.getCapabilitiesElement(), false);
56968        composeCanonicalExtras("capabilities", element.getCapabilitiesElement(), false);
56969      }
56970  }
56971
56972  protected void composeTestScriptTestScriptFixtureComponent(String name, TestScript.TestScriptFixtureComponent element) throws IOException {
56973    if (element != null) {
56974      open(name);
56975      composeTestScriptTestScriptFixtureComponentInner(element);
56976      close();
56977    }
56978  }
56979
56980  protected void composeTestScriptTestScriptFixtureComponentInner(TestScript.TestScriptFixtureComponent element) throws IOException {
56981      composeBackbone(element);
56982      if (element.hasAutocreateElement()) {
56983        composeBooleanCore("autocreate", element.getAutocreateElement(), false);
56984        composeBooleanExtras("autocreate", element.getAutocreateElement(), false);
56985      }
56986      if (element.hasAutodeleteElement()) {
56987        composeBooleanCore("autodelete", element.getAutodeleteElement(), false);
56988        composeBooleanExtras("autodelete", element.getAutodeleteElement(), false);
56989      }
56990      if (element.hasResource()) {
56991        composeReference("resource", element.getResource());
56992      }
56993  }
56994
56995  protected void composeTestScriptTestScriptVariableComponent(String name, TestScript.TestScriptVariableComponent element) throws IOException {
56996    if (element != null) {
56997      open(name);
56998      composeTestScriptTestScriptVariableComponentInner(element);
56999      close();
57000    }
57001  }
57002
57003  protected void composeTestScriptTestScriptVariableComponentInner(TestScript.TestScriptVariableComponent element) throws IOException {
57004      composeBackbone(element);
57005      if (element.hasNameElement()) {
57006        composeStringCore("name", element.getNameElement(), false);
57007        composeStringExtras("name", element.getNameElement(), false);
57008      }
57009      if (element.hasDefaultValueElement()) {
57010        composeStringCore("defaultValue", element.getDefaultValueElement(), false);
57011        composeStringExtras("defaultValue", element.getDefaultValueElement(), false);
57012      }
57013      if (element.hasDescriptionElement()) {
57014        composeStringCore("description", element.getDescriptionElement(), false);
57015        composeStringExtras("description", element.getDescriptionElement(), false);
57016      }
57017      if (element.hasExpressionElement()) {
57018        composeStringCore("expression", element.getExpressionElement(), false);
57019        composeStringExtras("expression", element.getExpressionElement(), false);
57020      }
57021      if (element.hasHeaderFieldElement()) {
57022        composeStringCore("headerField", element.getHeaderFieldElement(), false);
57023        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
57024      }
57025      if (element.hasHintElement()) {
57026        composeStringCore("hint", element.getHintElement(), false);
57027        composeStringExtras("hint", element.getHintElement(), false);
57028      }
57029      if (element.hasPathElement()) {
57030        composeStringCore("path", element.getPathElement(), false);
57031        composeStringExtras("path", element.getPathElement(), false);
57032      }
57033      if (element.hasSourceIdElement()) {
57034        composeIdCore("sourceId", element.getSourceIdElement(), false);
57035        composeIdExtras("sourceId", element.getSourceIdElement(), false);
57036      }
57037  }
57038
57039  protected void composeTestScriptTestScriptSetupComponent(String name, TestScript.TestScriptSetupComponent element) throws IOException {
57040    if (element != null) {
57041      open(name);
57042      composeTestScriptTestScriptSetupComponentInner(element);
57043      close();
57044    }
57045  }
57046
57047  protected void composeTestScriptTestScriptSetupComponentInner(TestScript.TestScriptSetupComponent element) throws IOException {
57048      composeBackbone(element);
57049      if (element.hasAction()) {
57050        openArray("action");
57051        for (TestScript.SetupActionComponent e : element.getAction()) 
57052          composeTestScriptSetupActionComponent(null, e);
57053        closeArray();
57054      };
57055  }
57056
57057  protected void composeTestScriptSetupActionComponent(String name, TestScript.SetupActionComponent element) throws IOException {
57058    if (element != null) {
57059      open(name);
57060      composeTestScriptSetupActionComponentInner(element);
57061      close();
57062    }
57063  }
57064
57065  protected void composeTestScriptSetupActionComponentInner(TestScript.SetupActionComponent element) throws IOException {
57066      composeBackbone(element);
57067      if (element.hasOperation()) {
57068        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
57069      }
57070      if (element.hasAssert()) {
57071        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
57072      }
57073  }
57074
57075  protected void composeTestScriptSetupActionOperationComponent(String name, TestScript.SetupActionOperationComponent element) throws IOException {
57076    if (element != null) {
57077      open(name);
57078      composeTestScriptSetupActionOperationComponentInner(element);
57079      close();
57080    }
57081  }
57082
57083  protected void composeTestScriptSetupActionOperationComponentInner(TestScript.SetupActionOperationComponent element) throws IOException {
57084      composeBackbone(element);
57085      if (element.hasType()) {
57086        composeCoding("type", element.getType());
57087      }
57088      if (element.hasResourceElement()) {
57089        composeCodeCore("resource", element.getResourceElement(), false);
57090        composeCodeExtras("resource", element.getResourceElement(), false);
57091      }
57092      if (element.hasLabelElement()) {
57093        composeStringCore("label", element.getLabelElement(), false);
57094        composeStringExtras("label", element.getLabelElement(), false);
57095      }
57096      if (element.hasDescriptionElement()) {
57097        composeStringCore("description", element.getDescriptionElement(), false);
57098        composeStringExtras("description", element.getDescriptionElement(), false);
57099      }
57100      if (element.hasAcceptElement()) {
57101        composeCodeCore("accept", element.getAcceptElement(), false);
57102        composeCodeExtras("accept", element.getAcceptElement(), false);
57103      }
57104      if (element.hasContentTypeElement()) {
57105        composeCodeCore("contentType", element.getContentTypeElement(), false);
57106        composeCodeExtras("contentType", element.getContentTypeElement(), false);
57107      }
57108      if (element.hasDestinationElement()) {
57109        composeIntegerCore("destination", element.getDestinationElement(), false);
57110        composeIntegerExtras("destination", element.getDestinationElement(), false);
57111      }
57112      if (element.hasEncodeRequestUrlElement()) {
57113        composeBooleanCore("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
57114        composeBooleanExtras("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
57115      }
57116      if (element.hasMethodElement()) {
57117        composeEnumerationCore("method", element.getMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
57118        composeEnumerationExtras("method", element.getMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
57119      }
57120      if (element.hasOriginElement()) {
57121        composeIntegerCore("origin", element.getOriginElement(), false);
57122        composeIntegerExtras("origin", element.getOriginElement(), false);
57123      }
57124      if (element.hasParamsElement()) {
57125        composeStringCore("params", element.getParamsElement(), false);
57126        composeStringExtras("params", element.getParamsElement(), false);
57127      }
57128      if (element.hasRequestHeader()) {
57129        openArray("requestHeader");
57130        for (TestScript.SetupActionOperationRequestHeaderComponent e : element.getRequestHeader()) 
57131          composeTestScriptSetupActionOperationRequestHeaderComponent(null, e);
57132        closeArray();
57133      };
57134      if (element.hasRequestIdElement()) {
57135        composeIdCore("requestId", element.getRequestIdElement(), false);
57136        composeIdExtras("requestId", element.getRequestIdElement(), false);
57137      }
57138      if (element.hasResponseIdElement()) {
57139        composeIdCore("responseId", element.getResponseIdElement(), false);
57140        composeIdExtras("responseId", element.getResponseIdElement(), false);
57141      }
57142      if (element.hasSourceIdElement()) {
57143        composeIdCore("sourceId", element.getSourceIdElement(), false);
57144        composeIdExtras("sourceId", element.getSourceIdElement(), false);
57145      }
57146      if (element.hasTargetIdElement()) {
57147        composeIdCore("targetId", element.getTargetIdElement(), false);
57148        composeIdExtras("targetId", element.getTargetIdElement(), false);
57149      }
57150      if (element.hasUrlElement()) {
57151        composeStringCore("url", element.getUrlElement(), false);
57152        composeStringExtras("url", element.getUrlElement(), false);
57153      }
57154  }
57155
57156  protected void composeTestScriptSetupActionOperationRequestHeaderComponent(String name, TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
57157    if (element != null) {
57158      open(name);
57159      composeTestScriptSetupActionOperationRequestHeaderComponentInner(element);
57160      close();
57161    }
57162  }
57163
57164  protected void composeTestScriptSetupActionOperationRequestHeaderComponentInner(TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
57165      composeBackbone(element);
57166      if (element.hasFieldElement()) {
57167        composeStringCore("field", element.getFieldElement(), false);
57168        composeStringExtras("field", element.getFieldElement(), false);
57169      }
57170      if (element.hasValueElement()) {
57171        composeStringCore("value", element.getValueElement(), false);
57172        composeStringExtras("value", element.getValueElement(), false);
57173      }
57174  }
57175
57176  protected void composeTestScriptSetupActionAssertComponent(String name, TestScript.SetupActionAssertComponent element) throws IOException {
57177    if (element != null) {
57178      open(name);
57179      composeTestScriptSetupActionAssertComponentInner(element);
57180      close();
57181    }
57182  }
57183
57184  protected void composeTestScriptSetupActionAssertComponentInner(TestScript.SetupActionAssertComponent element) throws IOException {
57185      composeBackbone(element);
57186      if (element.hasLabelElement()) {
57187        composeStringCore("label", element.getLabelElement(), false);
57188        composeStringExtras("label", element.getLabelElement(), false);
57189      }
57190      if (element.hasDescriptionElement()) {
57191        composeStringCore("description", element.getDescriptionElement(), false);
57192        composeStringExtras("description", element.getDescriptionElement(), false);
57193      }
57194      if (element.hasDirectionElement()) {
57195        composeEnumerationCore("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
57196        composeEnumerationExtras("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
57197      }
57198      if (element.hasCompareToSourceIdElement()) {
57199        composeStringCore("compareToSourceId", element.getCompareToSourceIdElement(), false);
57200        composeStringExtras("compareToSourceId", element.getCompareToSourceIdElement(), false);
57201      }
57202      if (element.hasCompareToSourceExpressionElement()) {
57203        composeStringCore("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
57204        composeStringExtras("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
57205      }
57206      if (element.hasCompareToSourcePathElement()) {
57207        composeStringCore("compareToSourcePath", element.getCompareToSourcePathElement(), false);
57208        composeStringExtras("compareToSourcePath", element.getCompareToSourcePathElement(), false);
57209      }
57210      if (element.hasContentTypeElement()) {
57211        composeCodeCore("contentType", element.getContentTypeElement(), false);
57212        composeCodeExtras("contentType", element.getContentTypeElement(), false);
57213      }
57214      if (element.hasExpressionElement()) {
57215        composeStringCore("expression", element.getExpressionElement(), false);
57216        composeStringExtras("expression", element.getExpressionElement(), false);
57217      }
57218      if (element.hasHeaderFieldElement()) {
57219        composeStringCore("headerField", element.getHeaderFieldElement(), false);
57220        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
57221      }
57222      if (element.hasMinimumIdElement()) {
57223        composeStringCore("minimumId", element.getMinimumIdElement(), false);
57224        composeStringExtras("minimumId", element.getMinimumIdElement(), false);
57225      }
57226      if (element.hasNavigationLinksElement()) {
57227        composeBooleanCore("navigationLinks", element.getNavigationLinksElement(), false);
57228        composeBooleanExtras("navigationLinks", element.getNavigationLinksElement(), false);
57229      }
57230      if (element.hasOperatorElement()) {
57231        composeEnumerationCore("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
57232        composeEnumerationExtras("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
57233      }
57234      if (element.hasPathElement()) {
57235        composeStringCore("path", element.getPathElement(), false);
57236        composeStringExtras("path", element.getPathElement(), false);
57237      }
57238      if (element.hasRequestMethodElement()) {
57239        composeEnumerationCore("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
57240        composeEnumerationExtras("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
57241      }
57242      if (element.hasRequestURLElement()) {
57243        composeStringCore("requestURL", element.getRequestURLElement(), false);
57244        composeStringExtras("requestURL", element.getRequestURLElement(), false);
57245      }
57246      if (element.hasResourceElement()) {
57247        composeCodeCore("resource", element.getResourceElement(), false);
57248        composeCodeExtras("resource", element.getResourceElement(), false);
57249      }
57250      if (element.hasResponseElement()) {
57251        composeEnumerationCore("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
57252        composeEnumerationExtras("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
57253      }
57254      if (element.hasResponseCodeElement()) {
57255        composeStringCore("responseCode", element.getResponseCodeElement(), false);
57256        composeStringExtras("responseCode", element.getResponseCodeElement(), false);
57257      }
57258      if (element.hasSourceIdElement()) {
57259        composeIdCore("sourceId", element.getSourceIdElement(), false);
57260        composeIdExtras("sourceId", element.getSourceIdElement(), false);
57261      }
57262      if (element.hasValidateProfileIdElement()) {
57263        composeIdCore("validateProfileId", element.getValidateProfileIdElement(), false);
57264        composeIdExtras("validateProfileId", element.getValidateProfileIdElement(), false);
57265      }
57266      if (element.hasValueElement()) {
57267        composeStringCore("value", element.getValueElement(), false);
57268        composeStringExtras("value", element.getValueElement(), false);
57269      }
57270      if (element.hasWarningOnlyElement()) {
57271        composeBooleanCore("warningOnly", element.getWarningOnlyElement(), false);
57272        composeBooleanExtras("warningOnly", element.getWarningOnlyElement(), false);
57273      }
57274  }
57275
57276  protected void composeTestScriptTestScriptTestComponent(String name, TestScript.TestScriptTestComponent element) throws IOException {
57277    if (element != null) {
57278      open(name);
57279      composeTestScriptTestScriptTestComponentInner(element);
57280      close();
57281    }
57282  }
57283
57284  protected void composeTestScriptTestScriptTestComponentInner(TestScript.TestScriptTestComponent element) throws IOException {
57285      composeBackbone(element);
57286      if (element.hasNameElement()) {
57287        composeStringCore("name", element.getNameElement(), false);
57288        composeStringExtras("name", element.getNameElement(), false);
57289      }
57290      if (element.hasDescriptionElement()) {
57291        composeStringCore("description", element.getDescriptionElement(), false);
57292        composeStringExtras("description", element.getDescriptionElement(), false);
57293      }
57294      if (element.hasAction()) {
57295        openArray("action");
57296        for (TestScript.TestActionComponent e : element.getAction()) 
57297          composeTestScriptTestActionComponent(null, e);
57298        closeArray();
57299      };
57300  }
57301
57302  protected void composeTestScriptTestActionComponent(String name, TestScript.TestActionComponent element) throws IOException {
57303    if (element != null) {
57304      open(name);
57305      composeTestScriptTestActionComponentInner(element);
57306      close();
57307    }
57308  }
57309
57310  protected void composeTestScriptTestActionComponentInner(TestScript.TestActionComponent element) throws IOException {
57311      composeBackbone(element);
57312      if (element.hasOperation()) {
57313        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
57314      }
57315      if (element.hasAssert()) {
57316        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
57317      }
57318  }
57319
57320  protected void composeTestScriptTestScriptTeardownComponent(String name, TestScript.TestScriptTeardownComponent element) throws IOException {
57321    if (element != null) {
57322      open(name);
57323      composeTestScriptTestScriptTeardownComponentInner(element);
57324      close();
57325    }
57326  }
57327
57328  protected void composeTestScriptTestScriptTeardownComponentInner(TestScript.TestScriptTeardownComponent element) throws IOException {
57329      composeBackbone(element);
57330      if (element.hasAction()) {
57331        openArray("action");
57332        for (TestScript.TeardownActionComponent e : element.getAction()) 
57333          composeTestScriptTeardownActionComponent(null, e);
57334        closeArray();
57335      };
57336  }
57337
57338  protected void composeTestScriptTeardownActionComponent(String name, TestScript.TeardownActionComponent element) throws IOException {
57339    if (element != null) {
57340      open(name);
57341      composeTestScriptTeardownActionComponentInner(element);
57342      close();
57343    }
57344  }
57345
57346  protected void composeTestScriptTeardownActionComponentInner(TestScript.TeardownActionComponent element) throws IOException {
57347      composeBackbone(element);
57348      if (element.hasOperation()) {
57349        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
57350      }
57351  }
57352
57353  protected void composeValueSet(String name, ValueSet element) throws IOException {
57354    if (element != null) {
57355      prop("resourceType", name);
57356      composeValueSetInner(element);
57357    }
57358  }
57359
57360  protected void composeValueSetInner(ValueSet element) throws IOException {
57361      composeDomainResourceElements(element);
57362      if (element.hasUrlElement()) {
57363        composeUriCore("url", element.getUrlElement(), false);
57364        composeUriExtras("url", element.getUrlElement(), false);
57365      }
57366      if (element.hasIdentifier()) {
57367        openArray("identifier");
57368        for (Identifier e : element.getIdentifier()) 
57369          composeIdentifier(null, e);
57370        closeArray();
57371      };
57372      if (element.hasVersionElement()) {
57373        composeStringCore("version", element.getVersionElement(), false);
57374        composeStringExtras("version", element.getVersionElement(), false);
57375      }
57376      if (element.hasNameElement()) {
57377        composeStringCore("name", element.getNameElement(), false);
57378        composeStringExtras("name", element.getNameElement(), false);
57379      }
57380      if (element.hasTitleElement()) {
57381        composeStringCore("title", element.getTitleElement(), false);
57382        composeStringExtras("title", element.getTitleElement(), false);
57383      }
57384      if (element.hasStatusElement()) {
57385        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
57386        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
57387      }
57388      if (element.hasExperimentalElement()) {
57389        composeBooleanCore("experimental", element.getExperimentalElement(), false);
57390        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
57391      }
57392      if (element.hasDateElement()) {
57393        composeDateTimeCore("date", element.getDateElement(), false);
57394        composeDateTimeExtras("date", element.getDateElement(), false);
57395      }
57396      if (element.hasPublisherElement()) {
57397        composeStringCore("publisher", element.getPublisherElement(), false);
57398        composeStringExtras("publisher", element.getPublisherElement(), false);
57399      }
57400      if (element.hasContact()) {
57401        openArray("contact");
57402        for (ContactDetail e : element.getContact()) 
57403          composeContactDetail(null, e);
57404        closeArray();
57405      };
57406      if (element.hasDescriptionElement()) {
57407        composeMarkdownCore("description", element.getDescriptionElement(), false);
57408        composeMarkdownExtras("description", element.getDescriptionElement(), false);
57409      }
57410      if (element.hasUseContext()) {
57411        openArray("useContext");
57412        for (UsageContext e : element.getUseContext()) 
57413          composeUsageContext(null, e);
57414        closeArray();
57415      };
57416      if (element.hasJurisdiction()) {
57417        openArray("jurisdiction");
57418        for (CodeableConcept e : element.getJurisdiction()) 
57419          composeCodeableConcept(null, e);
57420        closeArray();
57421      };
57422      if (element.hasImmutableElement()) {
57423        composeBooleanCore("immutable", element.getImmutableElement(), false);
57424        composeBooleanExtras("immutable", element.getImmutableElement(), false);
57425      }
57426      if (element.hasPurposeElement()) {
57427        composeMarkdownCore("purpose", element.getPurposeElement(), false);
57428        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
57429      }
57430      if (element.hasCopyrightElement()) {
57431        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
57432        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
57433      }
57434      if (element.hasCompose()) {
57435        composeValueSetValueSetComposeComponent("compose", element.getCompose());
57436      }
57437      if (element.hasExpansion()) {
57438        composeValueSetValueSetExpansionComponent("expansion", element.getExpansion());
57439      }
57440  }
57441
57442  protected void composeValueSetValueSetComposeComponent(String name, ValueSet.ValueSetComposeComponent element) throws IOException {
57443    if (element != null) {
57444      open(name);
57445      composeValueSetValueSetComposeComponentInner(element);
57446      close();
57447    }
57448  }
57449
57450  protected void composeValueSetValueSetComposeComponentInner(ValueSet.ValueSetComposeComponent element) throws IOException {
57451      composeBackbone(element);
57452      if (element.hasLockedDateElement()) {
57453        composeDateCore("lockedDate", element.getLockedDateElement(), false);
57454        composeDateExtras("lockedDate", element.getLockedDateElement(), false);
57455      }
57456      if (element.hasInactiveElement()) {
57457        composeBooleanCore("inactive", element.getInactiveElement(), false);
57458        composeBooleanExtras("inactive", element.getInactiveElement(), false);
57459      }
57460      if (element.hasInclude()) {
57461        openArray("include");
57462        for (ValueSet.ConceptSetComponent e : element.getInclude()) 
57463          composeValueSetConceptSetComponent(null, e);
57464        closeArray();
57465      };
57466      if (element.hasExclude()) {
57467        openArray("exclude");
57468        for (ValueSet.ConceptSetComponent e : element.getExclude()) 
57469          composeValueSetConceptSetComponent(null, e);
57470        closeArray();
57471      };
57472  }
57473
57474  protected void composeValueSetConceptSetComponent(String name, ValueSet.ConceptSetComponent element) throws IOException {
57475    if (element != null) {
57476      open(name);
57477      composeValueSetConceptSetComponentInner(element);
57478      close();
57479    }
57480  }
57481
57482  protected void composeValueSetConceptSetComponentInner(ValueSet.ConceptSetComponent element) throws IOException {
57483      composeBackbone(element);
57484      if (element.hasSystemElement()) {
57485        composeUriCore("system", element.getSystemElement(), false);
57486        composeUriExtras("system", element.getSystemElement(), false);
57487      }
57488      if (element.hasVersionElement()) {
57489        composeStringCore("version", element.getVersionElement(), false);
57490        composeStringExtras("version", element.getVersionElement(), false);
57491      }
57492      if (element.hasConcept()) {
57493        openArray("concept");
57494        for (ValueSet.ConceptReferenceComponent e : element.getConcept()) 
57495          composeValueSetConceptReferenceComponent(null, e);
57496        closeArray();
57497      };
57498      if (element.hasFilter()) {
57499        openArray("filter");
57500        for (ValueSet.ConceptSetFilterComponent e : element.getFilter()) 
57501          composeValueSetConceptSetFilterComponent(null, e);
57502        closeArray();
57503      };
57504      if (element.hasValueSet()) {
57505        openArray("valueSet");
57506        for (CanonicalType e : element.getValueSet()) 
57507          composeCanonicalCore(null, e, true);
57508        closeArray();
57509        if (anyHasExtras(element.getValueSet())) {
57510          openArray("_valueSet");
57511          for (CanonicalType e : element.getValueSet()) 
57512            composeCanonicalExtras(null, e, true);
57513          closeArray();
57514        }
57515      };
57516  }
57517
57518  protected void composeValueSetConceptReferenceComponent(String name, ValueSet.ConceptReferenceComponent element) throws IOException {
57519    if (element != null) {
57520      open(name);
57521      composeValueSetConceptReferenceComponentInner(element);
57522      close();
57523    }
57524  }
57525
57526  protected void composeValueSetConceptReferenceComponentInner(ValueSet.ConceptReferenceComponent element) throws IOException {
57527      composeBackbone(element);
57528      if (element.hasCodeElement()) {
57529        composeCodeCore("code", element.getCodeElement(), false);
57530        composeCodeExtras("code", element.getCodeElement(), false);
57531      }
57532      if (element.hasDisplayElement()) {
57533        composeStringCore("display", element.getDisplayElement(), false);
57534        composeStringExtras("display", element.getDisplayElement(), false);
57535      }
57536      if (element.hasDesignation()) {
57537        openArray("designation");
57538        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
57539          composeValueSetConceptReferenceDesignationComponent(null, e);
57540        closeArray();
57541      };
57542  }
57543
57544  protected void composeValueSetConceptReferenceDesignationComponent(String name, ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
57545    if (element != null) {
57546      open(name);
57547      composeValueSetConceptReferenceDesignationComponentInner(element);
57548      close();
57549    }
57550  }
57551
57552  protected void composeValueSetConceptReferenceDesignationComponentInner(ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
57553      composeBackbone(element);
57554      if (element.hasLanguageElement()) {
57555        composeCodeCore("language", element.getLanguageElement(), false);
57556        composeCodeExtras("language", element.getLanguageElement(), false);
57557      }
57558      if (element.hasUse()) {
57559        composeCoding("use", element.getUse());
57560      }
57561      if (element.hasValueElement()) {
57562        composeStringCore("value", element.getValueElement(), false);
57563        composeStringExtras("value", element.getValueElement(), false);
57564      }
57565  }
57566
57567  protected void composeValueSetConceptSetFilterComponent(String name, ValueSet.ConceptSetFilterComponent element) throws IOException {
57568    if (element != null) {
57569      open(name);
57570      composeValueSetConceptSetFilterComponentInner(element);
57571      close();
57572    }
57573  }
57574
57575  protected void composeValueSetConceptSetFilterComponentInner(ValueSet.ConceptSetFilterComponent element) throws IOException {
57576      composeBackbone(element);
57577      if (element.hasPropertyElement()) {
57578        composeCodeCore("property", element.getPropertyElement(), false);
57579        composeCodeExtras("property", element.getPropertyElement(), false);
57580      }
57581      if (element.hasOpElement()) {
57582        composeEnumerationCore("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
57583        composeEnumerationExtras("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
57584      }
57585      if (element.hasValueElement()) {
57586        composeStringCore("value", element.getValueElement(), false);
57587        composeStringExtras("value", element.getValueElement(), false);
57588      }
57589  }
57590
57591  protected void composeValueSetValueSetExpansionComponent(String name, ValueSet.ValueSetExpansionComponent element) throws IOException {
57592    if (element != null) {
57593      open(name);
57594      composeValueSetValueSetExpansionComponentInner(element);
57595      close();
57596    }
57597  }
57598
57599  protected void composeValueSetValueSetExpansionComponentInner(ValueSet.ValueSetExpansionComponent element) throws IOException {
57600      composeBackbone(element);
57601      if (element.hasIdentifierElement()) {
57602        composeUriCore("identifier", element.getIdentifierElement(), false);
57603        composeUriExtras("identifier", element.getIdentifierElement(), false);
57604      }
57605      if (element.hasTimestampElement()) {
57606        composeDateTimeCore("timestamp", element.getTimestampElement(), false);
57607        composeDateTimeExtras("timestamp", element.getTimestampElement(), false);
57608      }
57609      if (element.hasTotalElement()) {
57610        composeIntegerCore("total", element.getTotalElement(), false);
57611        composeIntegerExtras("total", element.getTotalElement(), false);
57612      }
57613      if (element.hasOffsetElement()) {
57614        composeIntegerCore("offset", element.getOffsetElement(), false);
57615        composeIntegerExtras("offset", element.getOffsetElement(), false);
57616      }
57617      if (element.hasParameter()) {
57618        openArray("parameter");
57619        for (ValueSet.ValueSetExpansionParameterComponent e : element.getParameter()) 
57620          composeValueSetValueSetExpansionParameterComponent(null, e);
57621        closeArray();
57622      };
57623      if (element.hasContains()) {
57624        openArray("contains");
57625        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
57626          composeValueSetValueSetExpansionContainsComponent(null, e);
57627        closeArray();
57628      };
57629  }
57630
57631  protected void composeValueSetValueSetExpansionParameterComponent(String name, ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
57632    if (element != null) {
57633      open(name);
57634      composeValueSetValueSetExpansionParameterComponentInner(element);
57635      close();
57636    }
57637  }
57638
57639  protected void composeValueSetValueSetExpansionParameterComponentInner(ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
57640      composeBackbone(element);
57641      if (element.hasNameElement()) {
57642        composeStringCore("name", element.getNameElement(), false);
57643        composeStringExtras("name", element.getNameElement(), false);
57644      }
57645      if (element.hasValue()) {
57646        composeType("value", element.getValue());
57647      }
57648  }
57649
57650  protected void composeValueSetValueSetExpansionContainsComponent(String name, ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
57651    if (element != null) {
57652      open(name);
57653      composeValueSetValueSetExpansionContainsComponentInner(element);
57654      close();
57655    }
57656  }
57657
57658  protected void composeValueSetValueSetExpansionContainsComponentInner(ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
57659      composeBackbone(element);
57660      if (element.hasSystemElement()) {
57661        composeUriCore("system", element.getSystemElement(), false);
57662        composeUriExtras("system", element.getSystemElement(), false);
57663      }
57664      if (element.hasAbstractElement()) {
57665        composeBooleanCore("abstract", element.getAbstractElement(), false);
57666        composeBooleanExtras("abstract", element.getAbstractElement(), false);
57667      }
57668      if (element.hasInactiveElement()) {
57669        composeBooleanCore("inactive", element.getInactiveElement(), false);
57670        composeBooleanExtras("inactive", element.getInactiveElement(), false);
57671      }
57672      if (element.hasVersionElement()) {
57673        composeStringCore("version", element.getVersionElement(), false);
57674        composeStringExtras("version", element.getVersionElement(), false);
57675      }
57676      if (element.hasCodeElement()) {
57677        composeCodeCore("code", element.getCodeElement(), false);
57678        composeCodeExtras("code", element.getCodeElement(), false);
57679      }
57680      if (element.hasDisplayElement()) {
57681        composeStringCore("display", element.getDisplayElement(), false);
57682        composeStringExtras("display", element.getDisplayElement(), false);
57683      }
57684      if (element.hasDesignation()) {
57685        openArray("designation");
57686        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
57687          composeValueSetConceptReferenceDesignationComponent(null, e);
57688        closeArray();
57689      };
57690      if (element.hasContains()) {
57691        openArray("contains");
57692        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
57693          composeValueSetValueSetExpansionContainsComponent(null, e);
57694        closeArray();
57695      };
57696  }
57697
57698  protected void composeVerificationResult(String name, VerificationResult element) throws IOException {
57699    if (element != null) {
57700      prop("resourceType", name);
57701      composeVerificationResultInner(element);
57702    }
57703  }
57704
57705  protected void composeVerificationResultInner(VerificationResult element) throws IOException {
57706      composeDomainResourceElements(element);
57707      if (element.hasTarget()) {
57708        openArray("target");
57709        for (Reference e : element.getTarget()) 
57710          composeReference(null, e);
57711        closeArray();
57712      };
57713      if (element.hasTargetLocation()) {
57714        openArray("targetLocation");
57715        for (StringType e : element.getTargetLocation()) 
57716          composeStringCore(null, e, true);
57717        closeArray();
57718        if (anyHasExtras(element.getTargetLocation())) {
57719          openArray("_targetLocation");
57720          for (StringType e : element.getTargetLocation()) 
57721            composeStringExtras(null, e, true);
57722          closeArray();
57723        }
57724      };
57725      if (element.hasNeed()) {
57726        composeCodeableConcept("need", element.getNeed());
57727      }
57728      if (element.hasStatusElement()) {
57729        composeEnumerationCore("status", element.getStatusElement(), new VerificationResult.StatusEnumFactory(), false);
57730        composeEnumerationExtras("status", element.getStatusElement(), new VerificationResult.StatusEnumFactory(), false);
57731      }
57732      if (element.hasStatusDateElement()) {
57733        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
57734        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
57735      }
57736      if (element.hasValidationType()) {
57737        composeCodeableConcept("validationType", element.getValidationType());
57738      }
57739      if (element.hasValidationProcess()) {
57740        openArray("validationProcess");
57741        for (CodeableConcept e : element.getValidationProcess()) 
57742          composeCodeableConcept(null, e);
57743        closeArray();
57744      };
57745      if (element.hasFrequency()) {
57746        composeTiming("frequency", element.getFrequency());
57747      }
57748      if (element.hasLastPerformedElement()) {
57749        composeDateTimeCore("lastPerformed", element.getLastPerformedElement(), false);
57750        composeDateTimeExtras("lastPerformed", element.getLastPerformedElement(), false);
57751      }
57752      if (element.hasNextScheduledElement()) {
57753        composeDateCore("nextScheduled", element.getNextScheduledElement(), false);
57754        composeDateExtras("nextScheduled", element.getNextScheduledElement(), false);
57755      }
57756      if (element.hasFailureAction()) {
57757        composeCodeableConcept("failureAction", element.getFailureAction());
57758      }
57759      if (element.hasPrimarySource()) {
57760        openArray("primarySource");
57761        for (VerificationResult.VerificationResultPrimarySourceComponent e : element.getPrimarySource()) 
57762          composeVerificationResultVerificationResultPrimarySourceComponent(null, e);
57763        closeArray();
57764      };
57765      if (element.hasAttestation()) {
57766        composeVerificationResultVerificationResultAttestationComponent("attestation", element.getAttestation());
57767      }
57768      if (element.hasValidator()) {
57769        openArray("validator");
57770        for (VerificationResult.VerificationResultValidatorComponent e : element.getValidator()) 
57771          composeVerificationResultVerificationResultValidatorComponent(null, e);
57772        closeArray();
57773      };
57774  }
57775
57776  protected void composeVerificationResultVerificationResultPrimarySourceComponent(String name, VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
57777    if (element != null) {
57778      open(name);
57779      composeVerificationResultVerificationResultPrimarySourceComponentInner(element);
57780      close();
57781    }
57782  }
57783
57784  protected void composeVerificationResultVerificationResultPrimarySourceComponentInner(VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
57785      composeBackbone(element);
57786      if (element.hasWho()) {
57787        composeReference("who", element.getWho());
57788      }
57789      if (element.hasType()) {
57790        openArray("type");
57791        for (CodeableConcept e : element.getType()) 
57792          composeCodeableConcept(null, e);
57793        closeArray();
57794      };
57795      if (element.hasCommunicationMethod()) {
57796        openArray("communicationMethod");
57797        for (CodeableConcept e : element.getCommunicationMethod()) 
57798          composeCodeableConcept(null, e);
57799        closeArray();
57800      };
57801      if (element.hasValidationStatus()) {
57802        composeCodeableConcept("validationStatus", element.getValidationStatus());
57803      }
57804      if (element.hasValidationDateElement()) {
57805        composeDateTimeCore("validationDate", element.getValidationDateElement(), false);
57806        composeDateTimeExtras("validationDate", element.getValidationDateElement(), false);
57807      }
57808      if (element.hasCanPushUpdates()) {
57809        composeCodeableConcept("canPushUpdates", element.getCanPushUpdates());
57810      }
57811      if (element.hasPushTypeAvailable()) {
57812        openArray("pushTypeAvailable");
57813        for (CodeableConcept e : element.getPushTypeAvailable()) 
57814          composeCodeableConcept(null, e);
57815        closeArray();
57816      };
57817  }
57818
57819  protected void composeVerificationResultVerificationResultAttestationComponent(String name, VerificationResult.VerificationResultAttestationComponent element) throws IOException {
57820    if (element != null) {
57821      open(name);
57822      composeVerificationResultVerificationResultAttestationComponentInner(element);
57823      close();
57824    }
57825  }
57826
57827  protected void composeVerificationResultVerificationResultAttestationComponentInner(VerificationResult.VerificationResultAttestationComponent element) throws IOException {
57828      composeBackbone(element);
57829      if (element.hasWho()) {
57830        composeReference("who", element.getWho());
57831      }
57832      if (element.hasOnBehalfOf()) {
57833        composeReference("onBehalfOf", element.getOnBehalfOf());
57834      }
57835      if (element.hasCommunicationMethod()) {
57836        composeCodeableConcept("communicationMethod", element.getCommunicationMethod());
57837      }
57838      if (element.hasDateElement()) {
57839        composeDateCore("date", element.getDateElement(), false);
57840        composeDateExtras("date", element.getDateElement(), false);
57841      }
57842      if (element.hasSourceIdentityCertificateElement()) {
57843        composeStringCore("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
57844        composeStringExtras("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
57845      }
57846      if (element.hasProxyIdentityCertificateElement()) {
57847        composeStringCore("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
57848        composeStringExtras("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
57849      }
57850      if (element.hasProxySignature()) {
57851        composeSignature("proxySignature", element.getProxySignature());
57852      }
57853      if (element.hasSourceSignature()) {
57854        composeSignature("sourceSignature", element.getSourceSignature());
57855      }
57856  }
57857
57858  protected void composeVerificationResultVerificationResultValidatorComponent(String name, VerificationResult.VerificationResultValidatorComponent element) throws IOException {
57859    if (element != null) {
57860      open(name);
57861      composeVerificationResultVerificationResultValidatorComponentInner(element);
57862      close();
57863    }
57864  }
57865
57866  protected void composeVerificationResultVerificationResultValidatorComponentInner(VerificationResult.VerificationResultValidatorComponent element) throws IOException {
57867      composeBackbone(element);
57868      if (element.hasOrganization()) {
57869        composeReference("organization", element.getOrganization());
57870      }
57871      if (element.hasIdentityCertificateElement()) {
57872        composeStringCore("identityCertificate", element.getIdentityCertificateElement(), false);
57873        composeStringExtras("identityCertificate", element.getIdentityCertificateElement(), false);
57874      }
57875      if (element.hasAttestationSignature()) {
57876        composeSignature("attestationSignature", element.getAttestationSignature());
57877      }
57878  }
57879
57880  protected void composeVisionPrescription(String name, VisionPrescription element) throws IOException {
57881    if (element != null) {
57882      prop("resourceType", name);
57883      composeVisionPrescriptionInner(element);
57884    }
57885  }
57886
57887  protected void composeVisionPrescriptionInner(VisionPrescription element) throws IOException {
57888      composeDomainResourceElements(element);
57889      if (element.hasIdentifier()) {
57890        openArray("identifier");
57891        for (Identifier e : element.getIdentifier()) 
57892          composeIdentifier(null, e);
57893        closeArray();
57894      };
57895      if (element.hasStatusElement()) {
57896        composeEnumerationCore("status", element.getStatusElement(), new VisionPrescription.VisionStatusEnumFactory(), false);
57897        composeEnumerationExtras("status", element.getStatusElement(), new VisionPrescription.VisionStatusEnumFactory(), false);
57898      }
57899      if (element.hasCreatedElement()) {
57900        composeDateTimeCore("created", element.getCreatedElement(), false);
57901        composeDateTimeExtras("created", element.getCreatedElement(), false);
57902      }
57903      if (element.hasPatient()) {
57904        composeReference("patient", element.getPatient());
57905      }
57906      if (element.hasEncounter()) {
57907        composeReference("encounter", element.getEncounter());
57908      }
57909      if (element.hasDateWrittenElement()) {
57910        composeDateTimeCore("dateWritten", element.getDateWrittenElement(), false);
57911        composeDateTimeExtras("dateWritten", element.getDateWrittenElement(), false);
57912      }
57913      if (element.hasPrescriber()) {
57914        composeReference("prescriber", element.getPrescriber());
57915      }
57916      if (element.hasLensSpecification()) {
57917        openArray("lensSpecification");
57918        for (VisionPrescription.VisionPrescriptionLensSpecificationComponent e : element.getLensSpecification()) 
57919          composeVisionPrescriptionVisionPrescriptionLensSpecificationComponent(null, e);
57920        closeArray();
57921      };
57922  }
57923
57924  protected void composeVisionPrescriptionVisionPrescriptionLensSpecificationComponent(String name, VisionPrescription.VisionPrescriptionLensSpecificationComponent element) throws IOException {
57925    if (element != null) {
57926      open(name);
57927      composeVisionPrescriptionVisionPrescriptionLensSpecificationComponentInner(element);
57928      close();
57929    }
57930  }
57931
57932  protected void composeVisionPrescriptionVisionPrescriptionLensSpecificationComponentInner(VisionPrescription.VisionPrescriptionLensSpecificationComponent element) throws IOException {
57933      composeBackbone(element);
57934      if (element.hasProduct()) {
57935        composeCodeableConcept("product", element.getProduct());
57936      }
57937      if (element.hasEyeElement()) {
57938        composeEnumerationCore("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
57939        composeEnumerationExtras("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
57940      }
57941      if (element.hasSphereElement()) {
57942        composeDecimalCore("sphere", element.getSphereElement(), false);
57943        composeDecimalExtras("sphere", element.getSphereElement(), false);
57944      }
57945      if (element.hasCylinderElement()) {
57946        composeDecimalCore("cylinder", element.getCylinderElement(), false);
57947        composeDecimalExtras("cylinder", element.getCylinderElement(), false);
57948      }
57949      if (element.hasAxisElement()) {
57950        composeIntegerCore("axis", element.getAxisElement(), false);
57951        composeIntegerExtras("axis", element.getAxisElement(), false);
57952      }
57953      if (element.hasPrism()) {
57954        openArray("prism");
57955        for (VisionPrescription.PrismComponent e : element.getPrism()) 
57956          composeVisionPrescriptionPrismComponent(null, e);
57957        closeArray();
57958      };
57959      if (element.hasAddElement()) {
57960        composeDecimalCore("add", element.getAddElement(), false);
57961        composeDecimalExtras("add", element.getAddElement(), false);
57962      }
57963      if (element.hasPowerElement()) {
57964        composeDecimalCore("power", element.getPowerElement(), false);
57965        composeDecimalExtras("power", element.getPowerElement(), false);
57966      }
57967      if (element.hasBackCurveElement()) {
57968        composeDecimalCore("backCurve", element.getBackCurveElement(), false);
57969        composeDecimalExtras("backCurve", element.getBackCurveElement(), false);
57970      }
57971      if (element.hasDiameterElement()) {
57972        composeDecimalCore("diameter", element.getDiameterElement(), false);
57973        composeDecimalExtras("diameter", element.getDiameterElement(), false);
57974      }
57975      if (element.hasDuration()) {
57976        composeQuantity("duration", element.getDuration());
57977      }
57978      if (element.hasColorElement()) {
57979        composeStringCore("color", element.getColorElement(), false);
57980        composeStringExtras("color", element.getColorElement(), false);
57981      }
57982      if (element.hasBrandElement()) {
57983        composeStringCore("brand", element.getBrandElement(), false);
57984        composeStringExtras("brand", element.getBrandElement(), false);
57985      }
57986      if (element.hasNote()) {
57987        openArray("note");
57988        for (Annotation e : element.getNote()) 
57989          composeAnnotation(null, e);
57990        closeArray();
57991      };
57992  }
57993
57994  protected void composeVisionPrescriptionPrismComponent(String name, VisionPrescription.PrismComponent element) throws IOException {
57995    if (element != null) {
57996      open(name);
57997      composeVisionPrescriptionPrismComponentInner(element);
57998      close();
57999    }
58000  }
58001
58002  protected void composeVisionPrescriptionPrismComponentInner(VisionPrescription.PrismComponent element) throws IOException {
58003      composeBackbone(element);
58004      if (element.hasAmountElement()) {
58005        composeDecimalCore("amount", element.getAmountElement(), false);
58006        composeDecimalExtras("amount", element.getAmountElement(), false);
58007      }
58008      if (element.hasBaseElement()) {
58009        composeEnumerationCore("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
58010        composeEnumerationExtras("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
58011      }
58012  }
58013
58014  @Override
58015  protected void composeResource(Resource resource) throws IOException {
58016    if (resource instanceof Parameters)
58017      composeParameters("Parameters", (Parameters)resource);
58018    else if (resource instanceof Account)
58019      composeAccount("Account", (Account)resource);
58020    else if (resource instanceof ActivityDefinition)
58021      composeActivityDefinition("ActivityDefinition", (ActivityDefinition)resource);
58022    else if (resource instanceof AdverseEvent)
58023      composeAdverseEvent("AdverseEvent", (AdverseEvent)resource);
58024    else if (resource instanceof AllergyIntolerance)
58025      composeAllergyIntolerance("AllergyIntolerance", (AllergyIntolerance)resource);
58026    else if (resource instanceof Appointment)
58027      composeAppointment("Appointment", (Appointment)resource);
58028    else if (resource instanceof AppointmentResponse)
58029      composeAppointmentResponse("AppointmentResponse", (AppointmentResponse)resource);
58030    else if (resource instanceof AuditEvent)
58031      composeAuditEvent("AuditEvent", (AuditEvent)resource);
58032    else if (resource instanceof Basic)
58033      composeBasic("Basic", (Basic)resource);
58034    else if (resource instanceof Binary)
58035      composeBinary("Binary", (Binary)resource);
58036    else if (resource instanceof BiologicallyDerivedProduct)
58037      composeBiologicallyDerivedProduct("BiologicallyDerivedProduct", (BiologicallyDerivedProduct)resource);
58038    else if (resource instanceof BodyStructure)
58039      composeBodyStructure("BodyStructure", (BodyStructure)resource);
58040    else if (resource instanceof Bundle)
58041      composeBundle("Bundle", (Bundle)resource);
58042    else if (resource instanceof CapabilityStatement)
58043      composeCapabilityStatement("CapabilityStatement", (CapabilityStatement)resource);
58044    else if (resource instanceof CarePlan)
58045      composeCarePlan("CarePlan", (CarePlan)resource);
58046    else if (resource instanceof CareTeam)
58047      composeCareTeam("CareTeam", (CareTeam)resource);
58048    else if (resource instanceof CatalogEntry)
58049      composeCatalogEntry("CatalogEntry", (CatalogEntry)resource);
58050    else if (resource instanceof ChargeItem)
58051      composeChargeItem("ChargeItem", (ChargeItem)resource);
58052    else if (resource instanceof ChargeItemDefinition)
58053      composeChargeItemDefinition("ChargeItemDefinition", (ChargeItemDefinition)resource);
58054    else if (resource instanceof Claim)
58055      composeClaim("Claim", (Claim)resource);
58056    else if (resource instanceof ClaimResponse)
58057      composeClaimResponse("ClaimResponse", (ClaimResponse)resource);
58058    else if (resource instanceof ClinicalImpression)
58059      composeClinicalImpression("ClinicalImpression", (ClinicalImpression)resource);
58060    else if (resource instanceof CodeSystem)
58061      composeCodeSystem("CodeSystem", (CodeSystem)resource);
58062    else if (resource instanceof Communication)
58063      composeCommunication("Communication", (Communication)resource);
58064    else if (resource instanceof CommunicationRequest)
58065      composeCommunicationRequest("CommunicationRequest", (CommunicationRequest)resource);
58066    else if (resource instanceof CompartmentDefinition)
58067      composeCompartmentDefinition("CompartmentDefinition", (CompartmentDefinition)resource);
58068    else if (resource instanceof Composition)
58069      composeComposition("Composition", (Composition)resource);
58070    else if (resource instanceof ConceptMap)
58071      composeConceptMap("ConceptMap", (ConceptMap)resource);
58072    else if (resource instanceof Condition)
58073      composeCondition("Condition", (Condition)resource);
58074    else if (resource instanceof Consent)
58075      composeConsent("Consent", (Consent)resource);
58076    else if (resource instanceof Contract)
58077      composeContract("Contract", (Contract)resource);
58078    else if (resource instanceof Coverage)
58079      composeCoverage("Coverage", (Coverage)resource);
58080    else if (resource instanceof CoverageEligibilityRequest)
58081      composeCoverageEligibilityRequest("CoverageEligibilityRequest", (CoverageEligibilityRequest)resource);
58082    else if (resource instanceof CoverageEligibilityResponse)
58083      composeCoverageEligibilityResponse("CoverageEligibilityResponse", (CoverageEligibilityResponse)resource);
58084    else if (resource instanceof DetectedIssue)
58085      composeDetectedIssue("DetectedIssue", (DetectedIssue)resource);
58086    else if (resource instanceof Device)
58087      composeDevice("Device", (Device)resource);
58088    else if (resource instanceof DeviceDefinition)
58089      composeDeviceDefinition("DeviceDefinition", (DeviceDefinition)resource);
58090    else if (resource instanceof DeviceMetric)
58091      composeDeviceMetric("DeviceMetric", (DeviceMetric)resource);
58092    else if (resource instanceof DeviceRequest)
58093      composeDeviceRequest("DeviceRequest", (DeviceRequest)resource);
58094    else if (resource instanceof DeviceUseStatement)
58095      composeDeviceUseStatement("DeviceUseStatement", (DeviceUseStatement)resource);
58096    else if (resource instanceof DiagnosticReport)
58097      composeDiagnosticReport("DiagnosticReport", (DiagnosticReport)resource);
58098    else if (resource instanceof DocumentManifest)
58099      composeDocumentManifest("DocumentManifest", (DocumentManifest)resource);
58100    else if (resource instanceof DocumentReference)
58101      composeDocumentReference("DocumentReference", (DocumentReference)resource);
58102    else if (resource instanceof EffectEvidenceSynthesis)
58103      composeEffectEvidenceSynthesis("EffectEvidenceSynthesis", (EffectEvidenceSynthesis)resource);
58104    else if (resource instanceof Encounter)
58105      composeEncounter("Encounter", (Encounter)resource);
58106    else if (resource instanceof Endpoint)
58107      composeEndpoint("Endpoint", (Endpoint)resource);
58108    else if (resource instanceof EnrollmentRequest)
58109      composeEnrollmentRequest("EnrollmentRequest", (EnrollmentRequest)resource);
58110    else if (resource instanceof EnrollmentResponse)
58111      composeEnrollmentResponse("EnrollmentResponse", (EnrollmentResponse)resource);
58112    else if (resource instanceof EpisodeOfCare)
58113      composeEpisodeOfCare("EpisodeOfCare", (EpisodeOfCare)resource);
58114    else if (resource instanceof EventDefinition)
58115      composeEventDefinition("EventDefinition", (EventDefinition)resource);
58116    else if (resource instanceof Evidence)
58117      composeEvidence("Evidence", (Evidence)resource);
58118    else if (resource instanceof EvidenceVariable)
58119      composeEvidenceVariable("EvidenceVariable", (EvidenceVariable)resource);
58120    else if (resource instanceof ExampleScenario)
58121      composeExampleScenario("ExampleScenario", (ExampleScenario)resource);
58122    else if (resource instanceof ExplanationOfBenefit)
58123      composeExplanationOfBenefit("ExplanationOfBenefit", (ExplanationOfBenefit)resource);
58124    else if (resource instanceof FamilyMemberHistory)
58125      composeFamilyMemberHistory("FamilyMemberHistory", (FamilyMemberHistory)resource);
58126    else if (resource instanceof Flag)
58127      composeFlag("Flag", (Flag)resource);
58128    else if (resource instanceof Goal)
58129      composeGoal("Goal", (Goal)resource);
58130    else if (resource instanceof GraphDefinition)
58131      composeGraphDefinition("GraphDefinition", (GraphDefinition)resource);
58132    else if (resource instanceof Group)
58133      composeGroup("Group", (Group)resource);
58134    else if (resource instanceof GuidanceResponse)
58135      composeGuidanceResponse("GuidanceResponse", (GuidanceResponse)resource);
58136    else if (resource instanceof HealthcareService)
58137      composeHealthcareService("HealthcareService", (HealthcareService)resource);
58138    else if (resource instanceof ImagingStudy)
58139      composeImagingStudy("ImagingStudy", (ImagingStudy)resource);
58140    else if (resource instanceof Immunization)
58141      composeImmunization("Immunization", (Immunization)resource);
58142    else if (resource instanceof ImmunizationEvaluation)
58143      composeImmunizationEvaluation("ImmunizationEvaluation", (ImmunizationEvaluation)resource);
58144    else if (resource instanceof ImmunizationRecommendation)
58145      composeImmunizationRecommendation("ImmunizationRecommendation", (ImmunizationRecommendation)resource);
58146    else if (resource instanceof ImplementationGuide)
58147      composeImplementationGuide("ImplementationGuide", (ImplementationGuide)resource);
58148    else if (resource instanceof InsurancePlan)
58149      composeInsurancePlan("InsurancePlan", (InsurancePlan)resource);
58150    else if (resource instanceof Invoice)
58151      composeInvoice("Invoice", (Invoice)resource);
58152    else if (resource instanceof Library)
58153      composeLibrary("Library", (Library)resource);
58154    else if (resource instanceof Linkage)
58155      composeLinkage("Linkage", (Linkage)resource);
58156    else if (resource instanceof ListResource)
58157      composeListResource("List", (ListResource)resource);
58158    else if (resource instanceof Location)
58159      composeLocation("Location", (Location)resource);
58160    else if (resource instanceof Measure)
58161      composeMeasure("Measure", (Measure)resource);
58162    else if (resource instanceof MeasureReport)
58163      composeMeasureReport("MeasureReport", (MeasureReport)resource);
58164    else if (resource instanceof Media)
58165      composeMedia("Media", (Media)resource);
58166    else if (resource instanceof Medication)
58167      composeMedication("Medication", (Medication)resource);
58168    else if (resource instanceof MedicationAdministration)
58169      composeMedicationAdministration("MedicationAdministration", (MedicationAdministration)resource);
58170    else if (resource instanceof MedicationDispense)
58171      composeMedicationDispense("MedicationDispense", (MedicationDispense)resource);
58172    else if (resource instanceof MedicationKnowledge)
58173      composeMedicationKnowledge("MedicationKnowledge", (MedicationKnowledge)resource);
58174    else if (resource instanceof MedicationRequest)
58175      composeMedicationRequest("MedicationRequest", (MedicationRequest)resource);
58176    else if (resource instanceof MedicationStatement)
58177      composeMedicationStatement("MedicationStatement", (MedicationStatement)resource);
58178    else if (resource instanceof MedicinalProduct)
58179      composeMedicinalProduct("MedicinalProduct", (MedicinalProduct)resource);
58180    else if (resource instanceof MedicinalProductAuthorization)
58181      composeMedicinalProductAuthorization("MedicinalProductAuthorization", (MedicinalProductAuthorization)resource);
58182    else if (resource instanceof MedicinalProductContraindication)
58183      composeMedicinalProductContraindication("MedicinalProductContraindication", (MedicinalProductContraindication)resource);
58184    else if (resource instanceof MedicinalProductIndication)
58185      composeMedicinalProductIndication("MedicinalProductIndication", (MedicinalProductIndication)resource);
58186    else if (resource instanceof MedicinalProductIngredient)
58187      composeMedicinalProductIngredient("MedicinalProductIngredient", (MedicinalProductIngredient)resource);
58188    else if (resource instanceof MedicinalProductInteraction)
58189      composeMedicinalProductInteraction("MedicinalProductInteraction", (MedicinalProductInteraction)resource);
58190    else if (resource instanceof MedicinalProductManufactured)
58191      composeMedicinalProductManufactured("MedicinalProductManufactured", (MedicinalProductManufactured)resource);
58192    else if (resource instanceof MedicinalProductPackaged)
58193      composeMedicinalProductPackaged("MedicinalProductPackaged", (MedicinalProductPackaged)resource);
58194    else if (resource instanceof MedicinalProductPharmaceutical)
58195      composeMedicinalProductPharmaceutical("MedicinalProductPharmaceutical", (MedicinalProductPharmaceutical)resource);
58196    else if (resource instanceof MedicinalProductUndesirableEffect)
58197      composeMedicinalProductUndesirableEffect("MedicinalProductUndesirableEffect", (MedicinalProductUndesirableEffect)resource);
58198    else if (resource instanceof MessageDefinition)
58199      composeMessageDefinition("MessageDefinition", (MessageDefinition)resource);
58200    else if (resource instanceof MessageHeader)
58201      composeMessageHeader("MessageHeader", (MessageHeader)resource);
58202    else if (resource instanceof MolecularSequence)
58203      composeMolecularSequence("MolecularSequence", (MolecularSequence)resource);
58204    else if (resource instanceof NamingSystem)
58205      composeNamingSystem("NamingSystem", (NamingSystem)resource);
58206    else if (resource instanceof NutritionOrder)
58207      composeNutritionOrder("NutritionOrder", (NutritionOrder)resource);
58208    else if (resource instanceof Observation)
58209      composeObservation("Observation", (Observation)resource);
58210    else if (resource instanceof ObservationDefinition)
58211      composeObservationDefinition("ObservationDefinition", (ObservationDefinition)resource);
58212    else if (resource instanceof OperationDefinition)
58213      composeOperationDefinition("OperationDefinition", (OperationDefinition)resource);
58214    else if (resource instanceof OperationOutcome)
58215      composeOperationOutcome("OperationOutcome", (OperationOutcome)resource);
58216    else if (resource instanceof Organization)
58217      composeOrganization("Organization", (Organization)resource);
58218    else if (resource instanceof OrganizationAffiliation)
58219      composeOrganizationAffiliation("OrganizationAffiliation", (OrganizationAffiliation)resource);
58220    else if (resource instanceof Patient)
58221      composePatient("Patient", (Patient)resource);
58222    else if (resource instanceof PaymentNotice)
58223      composePaymentNotice("PaymentNotice", (PaymentNotice)resource);
58224    else if (resource instanceof PaymentReconciliation)
58225      composePaymentReconciliation("PaymentReconciliation", (PaymentReconciliation)resource);
58226    else if (resource instanceof Person)
58227      composePerson("Person", (Person)resource);
58228    else if (resource instanceof PlanDefinition)
58229      composePlanDefinition("PlanDefinition", (PlanDefinition)resource);
58230    else if (resource instanceof Practitioner)
58231      composePractitioner("Practitioner", (Practitioner)resource);
58232    else if (resource instanceof PractitionerRole)
58233      composePractitionerRole("PractitionerRole", (PractitionerRole)resource);
58234    else if (resource instanceof Procedure)
58235      composeProcedure("Procedure", (Procedure)resource);
58236    else if (resource instanceof Provenance)
58237      composeProvenance("Provenance", (Provenance)resource);
58238    else if (resource instanceof Questionnaire)
58239      composeQuestionnaire("Questionnaire", (Questionnaire)resource);
58240    else if (resource instanceof QuestionnaireResponse)
58241      composeQuestionnaireResponse("QuestionnaireResponse", (QuestionnaireResponse)resource);
58242    else if (resource instanceof RelatedPerson)
58243      composeRelatedPerson("RelatedPerson", (RelatedPerson)resource);
58244    else if (resource instanceof RequestGroup)
58245      composeRequestGroup("RequestGroup", (RequestGroup)resource);
58246    else if (resource instanceof ResearchDefinition)
58247      composeResearchDefinition("ResearchDefinition", (ResearchDefinition)resource);
58248    else if (resource instanceof ResearchElementDefinition)
58249      composeResearchElementDefinition("ResearchElementDefinition", (ResearchElementDefinition)resource);
58250    else if (resource instanceof ResearchStudy)
58251      composeResearchStudy("ResearchStudy", (ResearchStudy)resource);
58252    else if (resource instanceof ResearchSubject)
58253      composeResearchSubject("ResearchSubject", (ResearchSubject)resource);
58254    else if (resource instanceof RiskAssessment)
58255      composeRiskAssessment("RiskAssessment", (RiskAssessment)resource);
58256    else if (resource instanceof RiskEvidenceSynthesis)
58257      composeRiskEvidenceSynthesis("RiskEvidenceSynthesis", (RiskEvidenceSynthesis)resource);
58258    else if (resource instanceof Schedule)
58259      composeSchedule("Schedule", (Schedule)resource);
58260    else if (resource instanceof SearchParameter)
58261      composeSearchParameter("SearchParameter", (SearchParameter)resource);
58262    else if (resource instanceof ServiceRequest)
58263      composeServiceRequest("ServiceRequest", (ServiceRequest)resource);
58264    else if (resource instanceof Slot)
58265      composeSlot("Slot", (Slot)resource);
58266    else if (resource instanceof Specimen)
58267      composeSpecimen("Specimen", (Specimen)resource);
58268    else if (resource instanceof SpecimenDefinition)
58269      composeSpecimenDefinition("SpecimenDefinition", (SpecimenDefinition)resource);
58270    else if (resource instanceof StructureDefinition)
58271      composeStructureDefinition("StructureDefinition", (StructureDefinition)resource);
58272    else if (resource instanceof StructureMap)
58273      composeStructureMap("StructureMap", (StructureMap)resource);
58274    else if (resource instanceof Subscription)
58275      composeSubscription("Subscription", (Subscription)resource);
58276    else if (resource instanceof Substance)
58277      composeSubstance("Substance", (Substance)resource);
58278    else if (resource instanceof SubstanceNucleicAcid)
58279      composeSubstanceNucleicAcid("SubstanceNucleicAcid", (SubstanceNucleicAcid)resource);
58280    else if (resource instanceof SubstancePolymer)
58281      composeSubstancePolymer("SubstancePolymer", (SubstancePolymer)resource);
58282    else if (resource instanceof SubstanceProtein)
58283      composeSubstanceProtein("SubstanceProtein", (SubstanceProtein)resource);
58284    else if (resource instanceof SubstanceReferenceInformation)
58285      composeSubstanceReferenceInformation("SubstanceReferenceInformation", (SubstanceReferenceInformation)resource);
58286    else if (resource instanceof SubstanceSourceMaterial)
58287      composeSubstanceSourceMaterial("SubstanceSourceMaterial", (SubstanceSourceMaterial)resource);
58288    else if (resource instanceof SubstanceSpecification)
58289      composeSubstanceSpecification("SubstanceSpecification", (SubstanceSpecification)resource);
58290    else if (resource instanceof SupplyDelivery)
58291      composeSupplyDelivery("SupplyDelivery", (SupplyDelivery)resource);
58292    else if (resource instanceof SupplyRequest)
58293      composeSupplyRequest("SupplyRequest", (SupplyRequest)resource);
58294    else if (resource instanceof Task)
58295      composeTask("Task", (Task)resource);
58296    else if (resource instanceof TerminologyCapabilities)
58297      composeTerminologyCapabilities("TerminologyCapabilities", (TerminologyCapabilities)resource);
58298    else if (resource instanceof TestReport)
58299      composeTestReport("TestReport", (TestReport)resource);
58300    else if (resource instanceof TestScript)
58301      composeTestScript("TestScript", (TestScript)resource);
58302    else if (resource instanceof ValueSet)
58303      composeValueSet("ValueSet", (ValueSet)resource);
58304    else if (resource instanceof VerificationResult)
58305      composeVerificationResult("VerificationResult", (VerificationResult)resource);
58306    else if (resource instanceof VisionPrescription)
58307      composeVisionPrescription("VisionPrescription", (VisionPrescription)resource);
58308    else if (resource instanceof Binary)
58309      composeBinary("Binary", (Binary)resource);
58310    else
58311      throw new Error("Unhandled resource type "+resource.getClass().getName());
58312  }
58313
58314  protected void composeNamedReference(String name, Resource resource) throws IOException {
58315    if (resource instanceof Parameters)
58316      composeParameters(name, (Parameters)resource);
58317    else if (resource instanceof Account)
58318      composeAccount(name, (Account)resource);
58319    else if (resource instanceof ActivityDefinition)
58320      composeActivityDefinition(name, (ActivityDefinition)resource);
58321    else if (resource instanceof AdverseEvent)
58322      composeAdverseEvent(name, (AdverseEvent)resource);
58323    else if (resource instanceof AllergyIntolerance)
58324      composeAllergyIntolerance(name, (AllergyIntolerance)resource);
58325    else if (resource instanceof Appointment)
58326      composeAppointment(name, (Appointment)resource);
58327    else if (resource instanceof AppointmentResponse)
58328      composeAppointmentResponse(name, (AppointmentResponse)resource);
58329    else if (resource instanceof AuditEvent)
58330      composeAuditEvent(name, (AuditEvent)resource);
58331    else if (resource instanceof Basic)
58332      composeBasic(name, (Basic)resource);
58333    else if (resource instanceof Binary)
58334      composeBinary(name, (Binary)resource);
58335    else if (resource instanceof BiologicallyDerivedProduct)
58336      composeBiologicallyDerivedProduct(name, (BiologicallyDerivedProduct)resource);
58337    else if (resource instanceof BodyStructure)
58338      composeBodyStructure(name, (BodyStructure)resource);
58339    else if (resource instanceof Bundle)
58340      composeBundle(name, (Bundle)resource);
58341    else if (resource instanceof CapabilityStatement)
58342      composeCapabilityStatement(name, (CapabilityStatement)resource);
58343    else if (resource instanceof CarePlan)
58344      composeCarePlan(name, (CarePlan)resource);
58345    else if (resource instanceof CareTeam)
58346      composeCareTeam(name, (CareTeam)resource);
58347    else if (resource instanceof CatalogEntry)
58348      composeCatalogEntry(name, (CatalogEntry)resource);
58349    else if (resource instanceof ChargeItem)
58350      composeChargeItem(name, (ChargeItem)resource);
58351    else if (resource instanceof ChargeItemDefinition)
58352      composeChargeItemDefinition(name, (ChargeItemDefinition)resource);
58353    else if (resource instanceof Claim)
58354      composeClaim(name, (Claim)resource);
58355    else if (resource instanceof ClaimResponse)
58356      composeClaimResponse(name, (ClaimResponse)resource);
58357    else if (resource instanceof ClinicalImpression)
58358      composeClinicalImpression(name, (ClinicalImpression)resource);
58359    else if (resource instanceof CodeSystem)
58360      composeCodeSystem(name, (CodeSystem)resource);
58361    else if (resource instanceof Communication)
58362      composeCommunication(name, (Communication)resource);
58363    else if (resource instanceof CommunicationRequest)
58364      composeCommunicationRequest(name, (CommunicationRequest)resource);
58365    else if (resource instanceof CompartmentDefinition)
58366      composeCompartmentDefinition(name, (CompartmentDefinition)resource);
58367    else if (resource instanceof Composition)
58368      composeComposition(name, (Composition)resource);
58369    else if (resource instanceof ConceptMap)
58370      composeConceptMap(name, (ConceptMap)resource);
58371    else if (resource instanceof Condition)
58372      composeCondition(name, (Condition)resource);
58373    else if (resource instanceof Consent)
58374      composeConsent(name, (Consent)resource);
58375    else if (resource instanceof Contract)
58376      composeContract(name, (Contract)resource);
58377    else if (resource instanceof Coverage)
58378      composeCoverage(name, (Coverage)resource);
58379    else if (resource instanceof CoverageEligibilityRequest)
58380      composeCoverageEligibilityRequest(name, (CoverageEligibilityRequest)resource);
58381    else if (resource instanceof CoverageEligibilityResponse)
58382      composeCoverageEligibilityResponse(name, (CoverageEligibilityResponse)resource);
58383    else if (resource instanceof DetectedIssue)
58384      composeDetectedIssue(name, (DetectedIssue)resource);
58385    else if (resource instanceof Device)
58386      composeDevice(name, (Device)resource);
58387    else if (resource instanceof DeviceDefinition)
58388      composeDeviceDefinition(name, (DeviceDefinition)resource);
58389    else if (resource instanceof DeviceMetric)
58390      composeDeviceMetric(name, (DeviceMetric)resource);
58391    else if (resource instanceof DeviceRequest)
58392      composeDeviceRequest(name, (DeviceRequest)resource);
58393    else if (resource instanceof DeviceUseStatement)
58394      composeDeviceUseStatement(name, (DeviceUseStatement)resource);
58395    else if (resource instanceof DiagnosticReport)
58396      composeDiagnosticReport(name, (DiagnosticReport)resource);
58397    else if (resource instanceof DocumentManifest)
58398      composeDocumentManifest(name, (DocumentManifest)resource);
58399    else if (resource instanceof DocumentReference)
58400      composeDocumentReference(name, (DocumentReference)resource);
58401    else if (resource instanceof EffectEvidenceSynthesis)
58402      composeEffectEvidenceSynthesis(name, (EffectEvidenceSynthesis)resource);
58403    else if (resource instanceof Encounter)
58404      composeEncounter(name, (Encounter)resource);
58405    else if (resource instanceof Endpoint)
58406      composeEndpoint(name, (Endpoint)resource);
58407    else if (resource instanceof EnrollmentRequest)
58408      composeEnrollmentRequest(name, (EnrollmentRequest)resource);
58409    else if (resource instanceof EnrollmentResponse)
58410      composeEnrollmentResponse(name, (EnrollmentResponse)resource);
58411    else if (resource instanceof EpisodeOfCare)
58412      composeEpisodeOfCare(name, (EpisodeOfCare)resource);
58413    else if (resource instanceof EventDefinition)
58414      composeEventDefinition(name, (EventDefinition)resource);
58415    else if (resource instanceof Evidence)
58416      composeEvidence(name, (Evidence)resource);
58417    else if (resource instanceof EvidenceVariable)
58418      composeEvidenceVariable(name, (EvidenceVariable)resource);
58419    else if (resource instanceof ExampleScenario)
58420      composeExampleScenario(name, (ExampleScenario)resource);
58421    else if (resource instanceof ExplanationOfBenefit)
58422      composeExplanationOfBenefit(name, (ExplanationOfBenefit)resource);
58423    else if (resource instanceof FamilyMemberHistory)
58424      composeFamilyMemberHistory(name, (FamilyMemberHistory)resource);
58425    else if (resource instanceof Flag)
58426      composeFlag(name, (Flag)resource);
58427    else if (resource instanceof Goal)
58428      composeGoal(name, (Goal)resource);
58429    else if (resource instanceof GraphDefinition)
58430      composeGraphDefinition(name, (GraphDefinition)resource);
58431    else if (resource instanceof Group)
58432      composeGroup(name, (Group)resource);
58433    else if (resource instanceof GuidanceResponse)
58434      composeGuidanceResponse(name, (GuidanceResponse)resource);
58435    else if (resource instanceof HealthcareService)
58436      composeHealthcareService(name, (HealthcareService)resource);
58437    else if (resource instanceof ImagingStudy)
58438      composeImagingStudy(name, (ImagingStudy)resource);
58439    else if (resource instanceof Immunization)
58440      composeImmunization(name, (Immunization)resource);
58441    else if (resource instanceof ImmunizationEvaluation)
58442      composeImmunizationEvaluation(name, (ImmunizationEvaluation)resource);
58443    else if (resource instanceof ImmunizationRecommendation)
58444      composeImmunizationRecommendation(name, (ImmunizationRecommendation)resource);
58445    else if (resource instanceof ImplementationGuide)
58446      composeImplementationGuide(name, (ImplementationGuide)resource);
58447    else if (resource instanceof InsurancePlan)
58448      composeInsurancePlan(name, (InsurancePlan)resource);
58449    else if (resource instanceof Invoice)
58450      composeInvoice(name, (Invoice)resource);
58451    else if (resource instanceof Library)
58452      composeLibrary(name, (Library)resource);
58453    else if (resource instanceof Linkage)
58454      composeLinkage(name, (Linkage)resource);
58455    else if (resource instanceof ListResource)
58456      composeListResource(name, (ListResource)resource);
58457    else if (resource instanceof Location)
58458      composeLocation(name, (Location)resource);
58459    else if (resource instanceof Measure)
58460      composeMeasure(name, (Measure)resource);
58461    else if (resource instanceof MeasureReport)
58462      composeMeasureReport(name, (MeasureReport)resource);
58463    else if (resource instanceof Media)
58464      composeMedia(name, (Media)resource);
58465    else if (resource instanceof Medication)
58466      composeMedication(name, (Medication)resource);
58467    else if (resource instanceof MedicationAdministration)
58468      composeMedicationAdministration(name, (MedicationAdministration)resource);
58469    else if (resource instanceof MedicationDispense)
58470      composeMedicationDispense(name, (MedicationDispense)resource);
58471    else if (resource instanceof MedicationKnowledge)
58472      composeMedicationKnowledge(name, (MedicationKnowledge)resource);
58473    else if (resource instanceof MedicationRequest)
58474      composeMedicationRequest(name, (MedicationRequest)resource);
58475    else if (resource instanceof MedicationStatement)
58476      composeMedicationStatement(name, (MedicationStatement)resource);
58477    else if (resource instanceof MedicinalProduct)
58478      composeMedicinalProduct(name, (MedicinalProduct)resource);
58479    else if (resource instanceof MedicinalProductAuthorization)
58480      composeMedicinalProductAuthorization(name, (MedicinalProductAuthorization)resource);
58481    else if (resource instanceof MedicinalProductContraindication)
58482      composeMedicinalProductContraindication(name, (MedicinalProductContraindication)resource);
58483    else if (resource instanceof MedicinalProductIndication)
58484      composeMedicinalProductIndication(name, (MedicinalProductIndication)resource);
58485    else if (resource instanceof MedicinalProductIngredient)
58486      composeMedicinalProductIngredient(name, (MedicinalProductIngredient)resource);
58487    else if (resource instanceof MedicinalProductInteraction)
58488      composeMedicinalProductInteraction(name, (MedicinalProductInteraction)resource);
58489    else if (resource instanceof MedicinalProductManufactured)
58490      composeMedicinalProductManufactured(name, (MedicinalProductManufactured)resource);
58491    else if (resource instanceof MedicinalProductPackaged)
58492      composeMedicinalProductPackaged(name, (MedicinalProductPackaged)resource);
58493    else if (resource instanceof MedicinalProductPharmaceutical)
58494      composeMedicinalProductPharmaceutical(name, (MedicinalProductPharmaceutical)resource);
58495    else if (resource instanceof MedicinalProductUndesirableEffect)
58496      composeMedicinalProductUndesirableEffect(name, (MedicinalProductUndesirableEffect)resource);
58497    else if (resource instanceof MessageDefinition)
58498      composeMessageDefinition(name, (MessageDefinition)resource);
58499    else if (resource instanceof MessageHeader)
58500      composeMessageHeader(name, (MessageHeader)resource);
58501    else if (resource instanceof MolecularSequence)
58502      composeMolecularSequence(name, (MolecularSequence)resource);
58503    else if (resource instanceof NamingSystem)
58504      composeNamingSystem(name, (NamingSystem)resource);
58505    else if (resource instanceof NutritionOrder)
58506      composeNutritionOrder(name, (NutritionOrder)resource);
58507    else if (resource instanceof Observation)
58508      composeObservation(name, (Observation)resource);
58509    else if (resource instanceof ObservationDefinition)
58510      composeObservationDefinition(name, (ObservationDefinition)resource);
58511    else if (resource instanceof OperationDefinition)
58512      composeOperationDefinition(name, (OperationDefinition)resource);
58513    else if (resource instanceof OperationOutcome)
58514      composeOperationOutcome(name, (OperationOutcome)resource);
58515    else if (resource instanceof Organization)
58516      composeOrganization(name, (Organization)resource);
58517    else if (resource instanceof OrganizationAffiliation)
58518      composeOrganizationAffiliation(name, (OrganizationAffiliation)resource);
58519    else if (resource instanceof Patient)
58520      composePatient(name, (Patient)resource);
58521    else if (resource instanceof PaymentNotice)
58522      composePaymentNotice(name, (PaymentNotice)resource);
58523    else if (resource instanceof PaymentReconciliation)
58524      composePaymentReconciliation(name, (PaymentReconciliation)resource);
58525    else if (resource instanceof Person)
58526      composePerson(name, (Person)resource);
58527    else if (resource instanceof PlanDefinition)
58528      composePlanDefinition(name, (PlanDefinition)resource);
58529    else if (resource instanceof Practitioner)
58530      composePractitioner(name, (Practitioner)resource);
58531    else if (resource instanceof PractitionerRole)
58532      composePractitionerRole(name, (PractitionerRole)resource);
58533    else if (resource instanceof Procedure)
58534      composeProcedure(name, (Procedure)resource);
58535    else if (resource instanceof Provenance)
58536      composeProvenance(name, (Provenance)resource);
58537    else if (resource instanceof Questionnaire)
58538      composeQuestionnaire(name, (Questionnaire)resource);
58539    else if (resource instanceof QuestionnaireResponse)
58540      composeQuestionnaireResponse(name, (QuestionnaireResponse)resource);
58541    else if (resource instanceof RelatedPerson)
58542      composeRelatedPerson(name, (RelatedPerson)resource);
58543    else if (resource instanceof RequestGroup)
58544      composeRequestGroup(name, (RequestGroup)resource);
58545    else if (resource instanceof ResearchDefinition)
58546      composeResearchDefinition(name, (ResearchDefinition)resource);
58547    else if (resource instanceof ResearchElementDefinition)
58548      composeResearchElementDefinition(name, (ResearchElementDefinition)resource);
58549    else if (resource instanceof ResearchStudy)
58550      composeResearchStudy(name, (ResearchStudy)resource);
58551    else if (resource instanceof ResearchSubject)
58552      composeResearchSubject(name, (ResearchSubject)resource);
58553    else if (resource instanceof RiskAssessment)
58554      composeRiskAssessment(name, (RiskAssessment)resource);
58555    else if (resource instanceof RiskEvidenceSynthesis)
58556      composeRiskEvidenceSynthesis(name, (RiskEvidenceSynthesis)resource);
58557    else if (resource instanceof Schedule)
58558      composeSchedule(name, (Schedule)resource);
58559    else if (resource instanceof SearchParameter)
58560      composeSearchParameter(name, (SearchParameter)resource);
58561    else if (resource instanceof ServiceRequest)
58562      composeServiceRequest(name, (ServiceRequest)resource);
58563    else if (resource instanceof Slot)
58564      composeSlot(name, (Slot)resource);
58565    else if (resource instanceof Specimen)
58566      composeSpecimen(name, (Specimen)resource);
58567    else if (resource instanceof SpecimenDefinition)
58568      composeSpecimenDefinition(name, (SpecimenDefinition)resource);
58569    else if (resource instanceof StructureDefinition)
58570      composeStructureDefinition(name, (StructureDefinition)resource);
58571    else if (resource instanceof StructureMap)
58572      composeStructureMap(name, (StructureMap)resource);
58573    else if (resource instanceof Subscription)
58574      composeSubscription(name, (Subscription)resource);
58575    else if (resource instanceof Substance)
58576      composeSubstance(name, (Substance)resource);
58577    else if (resource instanceof SubstanceNucleicAcid)
58578      composeSubstanceNucleicAcid(name, (SubstanceNucleicAcid)resource);
58579    else if (resource instanceof SubstancePolymer)
58580      composeSubstancePolymer(name, (SubstancePolymer)resource);
58581    else if (resource instanceof SubstanceProtein)
58582      composeSubstanceProtein(name, (SubstanceProtein)resource);
58583    else if (resource instanceof SubstanceReferenceInformation)
58584      composeSubstanceReferenceInformation(name, (SubstanceReferenceInformation)resource);
58585    else if (resource instanceof SubstanceSourceMaterial)
58586      composeSubstanceSourceMaterial(name, (SubstanceSourceMaterial)resource);
58587    else if (resource instanceof SubstanceSpecification)
58588      composeSubstanceSpecification(name, (SubstanceSpecification)resource);
58589    else if (resource instanceof SupplyDelivery)
58590      composeSupplyDelivery(name, (SupplyDelivery)resource);
58591    else if (resource instanceof SupplyRequest)
58592      composeSupplyRequest(name, (SupplyRequest)resource);
58593    else if (resource instanceof Task)
58594      composeTask(name, (Task)resource);
58595    else if (resource instanceof TerminologyCapabilities)
58596      composeTerminologyCapabilities(name, (TerminologyCapabilities)resource);
58597    else if (resource instanceof TestReport)
58598      composeTestReport(name, (TestReport)resource);
58599    else if (resource instanceof TestScript)
58600      composeTestScript(name, (TestScript)resource);
58601    else if (resource instanceof ValueSet)
58602      composeValueSet(name, (ValueSet)resource);
58603    else if (resource instanceof VerificationResult)
58604      composeVerificationResult(name, (VerificationResult)resource);
58605    else if (resource instanceof VisionPrescription)
58606      composeVisionPrescription(name, (VisionPrescription)resource);
58607    else if (resource instanceof Binary)
58608      composeBinary(name, (Binary)resource);
58609    else
58610      throw new Error("Unhandled resource type "+resource.getClass().getName());
58611  }
58612
58613  protected void composeType(String prefix, Type type) throws IOException {
58614    if (type == null)
58615      ;
58616    else if (type instanceof Extension)
58617       composeExtension(prefix+"Extension", (Extension) type);
58618    else if (type instanceof Narrative)
58619       composeNarrative(prefix+"Narrative", (Narrative) type);
58620    else if (type instanceof Count)
58621       composeCount(prefix+"Count", (Count) type);
58622    else if (type instanceof Dosage)
58623       composeDosage(prefix+"Dosage", (Dosage) type);
58624    else if (type instanceof MarketingStatus)
58625       composeMarketingStatus(prefix+"MarketingStatus", (MarketingStatus) type);
58626    else if (type instanceof SubstanceAmount)
58627       composeSubstanceAmount(prefix+"SubstanceAmount", (SubstanceAmount) type);
58628    else if (type instanceof Population)
58629       composePopulation(prefix+"Population", (Population) type);
58630    else if (type instanceof Distance)
58631       composeDistance(prefix+"Distance", (Distance) type);
58632    else if (type instanceof Age)
58633       composeAge(prefix+"Age", (Age) type);
58634    else if (type instanceof Duration)
58635       composeDuration(prefix+"Duration", (Duration) type);
58636    else if (type instanceof ProductShelfLife)
58637       composeProductShelfLife(prefix+"ProductShelfLife", (ProductShelfLife) type);
58638    else if (type instanceof Timing)
58639       composeTiming(prefix+"Timing", (Timing) type);
58640    else if (type instanceof ProdCharacteristic)
58641       composeProdCharacteristic(prefix+"ProdCharacteristic", (ProdCharacteristic) type);
58642    else if (type instanceof Meta)
58643       composeMeta(prefix+"Meta", (Meta) type);
58644    else if (type instanceof Address)
58645       composeAddress(prefix+"Address", (Address) type);
58646    else if (type instanceof Contributor)
58647       composeContributor(prefix+"Contributor", (Contributor) type);
58648    else if (type instanceof Attachment)
58649       composeAttachment(prefix+"Attachment", (Attachment) type);
58650    else if (type instanceof DataRequirement)
58651       composeDataRequirement(prefix+"DataRequirement", (DataRequirement) type);
58652    else if (type instanceof Money)
58653       composeMoney(prefix+"Money", (Money) type);
58654    else if (type instanceof HumanName)
58655       composeHumanName(prefix+"HumanName", (HumanName) type);
58656    else if (type instanceof ContactPoint)
58657       composeContactPoint(prefix+"ContactPoint", (ContactPoint) type);
58658    else if (type instanceof Identifier)
58659       composeIdentifier(prefix+"Identifier", (Identifier) type);
58660    else if (type instanceof Coding)
58661       composeCoding(prefix+"Coding", (Coding) type);
58662    else if (type instanceof SampledData)
58663       composeSampledData(prefix+"SampledData", (SampledData) type);
58664    else if (type instanceof Ratio)
58665       composeRatio(prefix+"Ratio", (Ratio) type);
58666    else if (type instanceof Reference)
58667       composeReference(prefix+"Reference", (Reference) type);
58668    else if (type instanceof TriggerDefinition)
58669       composeTriggerDefinition(prefix+"TriggerDefinition", (TriggerDefinition) type);
58670    else if (type instanceof Quantity)
58671       composeQuantity(prefix+"Quantity", (Quantity) type);
58672    else if (type instanceof Period)
58673       composePeriod(prefix+"Period", (Period) type);
58674    else if (type instanceof Range)
58675       composeRange(prefix+"Range", (Range) type);
58676    else if (type instanceof RelatedArtifact)
58677       composeRelatedArtifact(prefix+"RelatedArtifact", (RelatedArtifact) type);
58678    else if (type instanceof Annotation)
58679       composeAnnotation(prefix+"Annotation", (Annotation) type);
58680    else if (type instanceof ContactDetail)
58681       composeContactDetail(prefix+"ContactDetail", (ContactDetail) type);
58682    else if (type instanceof UsageContext)
58683       composeUsageContext(prefix+"UsageContext", (UsageContext) type);
58684    else if (type instanceof Expression)
58685       composeExpression(prefix+"Expression", (Expression) type);
58686    else if (type instanceof Signature)
58687       composeSignature(prefix+"Signature", (Signature) type);
58688    else if (type instanceof CodeableConcept)
58689       composeCodeableConcept(prefix+"CodeableConcept", (CodeableConcept) type);
58690    else if (type instanceof ParameterDefinition)
58691       composeParameterDefinition(prefix+"ParameterDefinition", (ParameterDefinition) type);
58692    else if (type instanceof CodeType) {
58693      composeCodeCore(prefix+"Code", (CodeType) type, false);
58694      composeCodeExtras(prefix+"Code", (CodeType) type, false);
58695    }
58696    else if (type instanceof OidType) {
58697      composeOidCore(prefix+"Oid", (OidType) type, false);
58698      composeOidExtras(prefix+"Oid", (OidType) type, false);
58699    }
58700    else if (type instanceof CanonicalType) {
58701      composeCanonicalCore(prefix+"Canonical", (CanonicalType) type, false);
58702      composeCanonicalExtras(prefix+"Canonical", (CanonicalType) type, false);
58703    }
58704    else if (type instanceof UuidType) {
58705      composeUuidCore(prefix+"Uuid", (UuidType) type, false);
58706      composeUuidExtras(prefix+"Uuid", (UuidType) type, false);
58707    }
58708    else if (type instanceof UrlType) {
58709      composeUrlCore(prefix+"Url", (UrlType) type, false);
58710      composeUrlExtras(prefix+"Url", (UrlType) type, false);
58711    }
58712    else if (type instanceof UnsignedIntType) {
58713      composeUnsignedIntCore(prefix+"UnsignedInt", (UnsignedIntType) type, false);
58714      composeUnsignedIntExtras(prefix+"UnsignedInt", (UnsignedIntType) type, false);
58715    }
58716    else if (type instanceof MarkdownType) {
58717      composeMarkdownCore(prefix+"Markdown", (MarkdownType) type, false);
58718      composeMarkdownExtras(prefix+"Markdown", (MarkdownType) type, false);
58719    }
58720    else if (type instanceof IdType) {
58721      composeIdCore(prefix+"Id", (IdType) type, false);
58722      composeIdExtras(prefix+"Id", (IdType) type, false);
58723    }
58724    else if (type instanceof PositiveIntType) {
58725      composePositiveIntCore(prefix+"PositiveInt", (PositiveIntType) type, false);
58726      composePositiveIntExtras(prefix+"PositiveInt", (PositiveIntType) type, false);
58727    }
58728    else if (type instanceof DateType) {
58729      composeDateCore(prefix+"Date", (DateType) type, false);
58730      composeDateExtras(prefix+"Date", (DateType) type, false);
58731    }
58732    else if (type instanceof DateTimeType) {
58733      composeDateTimeCore(prefix+"DateTime", (DateTimeType) type, false);
58734      composeDateTimeExtras(prefix+"DateTime", (DateTimeType) type, false);
58735    }
58736    else if (type instanceof StringType) {
58737      composeStringCore(prefix+"String", (StringType) type, false);
58738      composeStringExtras(prefix+"String", (StringType) type, false);
58739    }
58740    else if (type instanceof IntegerType) {
58741      composeIntegerCore(prefix+"Integer", (IntegerType) type, false);
58742      composeIntegerExtras(prefix+"Integer", (IntegerType) type, false);
58743    }
58744    else if (type instanceof UriType) {
58745      composeUriCore(prefix+"Uri", (UriType) type, false);
58746      composeUriExtras(prefix+"Uri", (UriType) type, false);
58747    }
58748    else if (type instanceof InstantType) {
58749      composeInstantCore(prefix+"Instant", (InstantType) type, false);
58750      composeInstantExtras(prefix+"Instant", (InstantType) type, false);
58751    }
58752    else if (type instanceof BooleanType) {
58753      composeBooleanCore(prefix+"Boolean", (BooleanType) type, false);
58754      composeBooleanExtras(prefix+"Boolean", (BooleanType) type, false);
58755    }
58756    else if (type instanceof Base64BinaryType) {
58757      composeBase64BinaryCore(prefix+"Base64Binary", (Base64BinaryType) type, false);
58758      composeBase64BinaryExtras(prefix+"Base64Binary", (Base64BinaryType) type, false);
58759    }
58760    else if (type instanceof TimeType) {
58761      composeTimeCore(prefix+"Time", (TimeType) type, false);
58762      composeTimeExtras(prefix+"Time", (TimeType) type, false);
58763    }
58764    else if (type instanceof DecimalType) {
58765      composeDecimalCore(prefix+"Decimal", (DecimalType) type, false);
58766      composeDecimalExtras(prefix+"Decimal", (DecimalType) type, false);
58767    }
58768    else
58769      throw new Error("Unhandled type");
58770  }
58771
58772  protected void composeTypeInner(Type type) throws IOException {
58773    if (type == null)
58774      ;
58775    else if (type instanceof Extension)
58776       composeExtensionInner((Extension) type);
58777    else if (type instanceof Narrative)
58778       composeNarrativeInner((Narrative) type);
58779    else if (type instanceof Count)
58780       composeCountInner((Count) type);
58781    else if (type instanceof Dosage)
58782       composeDosageInner((Dosage) type);
58783    else if (type instanceof MarketingStatus)
58784       composeMarketingStatusInner((MarketingStatus) type);
58785    else if (type instanceof SubstanceAmount)
58786       composeSubstanceAmountInner((SubstanceAmount) type);
58787    else if (type instanceof Population)
58788       composePopulationInner((Population) type);
58789    else if (type instanceof Distance)
58790       composeDistanceInner((Distance) type);
58791    else if (type instanceof Age)
58792       composeAgeInner((Age) type);
58793    else if (type instanceof Duration)
58794       composeDurationInner((Duration) type);
58795    else if (type instanceof ProductShelfLife)
58796       composeProductShelfLifeInner((ProductShelfLife) type);
58797    else if (type instanceof Timing)
58798       composeTimingInner((Timing) type);
58799    else if (type instanceof ProdCharacteristic)
58800       composeProdCharacteristicInner((ProdCharacteristic) type);
58801    else if (type instanceof Meta)
58802       composeMetaInner((Meta) type);
58803    else if (type instanceof Address)
58804       composeAddressInner((Address) type);
58805    else if (type instanceof Contributor)
58806       composeContributorInner((Contributor) type);
58807    else if (type instanceof Attachment)
58808       composeAttachmentInner((Attachment) type);
58809    else if (type instanceof DataRequirement)
58810       composeDataRequirementInner((DataRequirement) type);
58811    else if (type instanceof Money)
58812       composeMoneyInner((Money) type);
58813    else if (type instanceof HumanName)
58814       composeHumanNameInner((HumanName) type);
58815    else if (type instanceof ContactPoint)
58816       composeContactPointInner((ContactPoint) type);
58817    else if (type instanceof Identifier)
58818       composeIdentifierInner((Identifier) type);
58819    else if (type instanceof Coding)
58820       composeCodingInner((Coding) type);
58821    else if (type instanceof SampledData)
58822       composeSampledDataInner((SampledData) type);
58823    else if (type instanceof Ratio)
58824       composeRatioInner((Ratio) type);
58825    else if (type instanceof Reference)
58826       composeReferenceInner((Reference) type);
58827    else if (type instanceof TriggerDefinition)
58828       composeTriggerDefinitionInner((TriggerDefinition) type);
58829    else if (type instanceof Quantity)
58830       composeQuantityInner((Quantity) type);
58831    else if (type instanceof Period)
58832       composePeriodInner((Period) type);
58833    else if (type instanceof Range)
58834       composeRangeInner((Range) type);
58835    else if (type instanceof RelatedArtifact)
58836       composeRelatedArtifactInner((RelatedArtifact) type);
58837    else if (type instanceof Annotation)
58838       composeAnnotationInner((Annotation) type);
58839    else if (type instanceof ContactDetail)
58840       composeContactDetailInner((ContactDetail) type);
58841    else if (type instanceof UsageContext)
58842       composeUsageContextInner((UsageContext) type);
58843    else if (type instanceof Expression)
58844       composeExpressionInner((Expression) type);
58845    else if (type instanceof Signature)
58846       composeSignatureInner((Signature) type);
58847    else if (type instanceof CodeableConcept)
58848       composeCodeableConceptInner((CodeableConcept) type);
58849    else if (type instanceof ParameterDefinition)
58850       composeParameterDefinitionInner((ParameterDefinition) type);
58851    else
58852      throw new Error("Unhandled type: "+type.fhirType());
58853  }
58854
58855}
58856